Quantcast
Channel: SQL Server Spatial forum
Viewing all articles
Browse latest Browse all 364

Get the bounding box from a DbGeography MULTIPOINT?

$
0
0

Sorry if the question is not 100% related to SQL Server itself. But I thought it matches the topic close enough to post it here.

I'm using Entity Framework in my ASP.NET Web API project. While creating my POCOs I receive LatLngBounds from the browser client (Google Maps API).

I create a DbGeography (MULTIPOINT) instance from these incoming coordinates that represents my two points to re-create a rectangle.

Now I need the bounding box (polygon) of this MULTIPOINT construct. After some research I thought the STEnvelope function from the SqlGeometry assembly might help on this as I can not find a way to do this with the DbGeography type. Everything looks fine in the code until I try so save the object.

Please see the gist [1] for example code an the error message from EF. See gist [2] for the generated SQL from EF.

Does it make sense to try it this way, or am I missing something important here and there's a much easier way?

[1] gist 1
[2] gist 2



Viewing all articles
Browse latest Browse all 364

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>