/gist:9e3b413278f2404512e4 Secret
Created
June 7, 2013 12:30
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Get LatLngBounds from passed coordinates in form of | |
//"bounds": { | |
// "southWest": { | |
// "lat": 51.633983, | |
// "lng": 7.402899 | |
// }, | |
// "northEast": { | |
// "lat": 50.633983, | |
// "lng": 6.402899 | |
// } | |
//} | |
DbGeography bounds = this.GetBounds(values); | |
//"Convert" DbGeography to SqlGeometry to be able to get the envelope (polygon) | |
var geom = SqlGeometry.STGeomFromWKB(new SqlBytes(bounds.AsBinary()), 32637); | |
//Create the envelope (polygon) from LatLngBounds | |
var envelop = geom.STEnvelope(); | |
poi.Shape = DbGeography.FromGml(envelop.AsGml().Value); | |
return; | |
//EF error message: | |
//{"The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. | |
// Parameter 3 (\"@2\"): The supplied value is not a valid instance of data type geography. | |
// Check the source data for invalid values. | |
// An example of an invalid value is data of numeric type with scale greater than precision."} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment