Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there any example to convert spatial data (point,line,polygon) stored as geographic in sql server 2008 into Json and display data using Arcgis Javascript Api 3.0.I have tried converting geographic data into Json given Geometry to Json but as my data stored in geographic data format it failed.Thank you in advance.

share|improve this question
up vote 2 down vote accepted

In theory just replace all SQL commands having geometry:: cast to geography casts (assuming that you 2008 R2 MSSQL server) Edit: looked that example code . Change Microsoft.SqlServer.Types.SqlGeometry to Microsoft.SqlServer.Types.SqlGeography OR Find SQL command which select code and force it to cast your geography objects to geometry

share|improve this answer

Just off the top of my head in SQLServer,

You can query the geography data type using: .ToString () See for the reference info.

Then you'll just have a long and lat floats which you can send to json.

share|improve this answer
Thank you! That does give me POINT (150.00 -33.00) but the .ToString() makes it slow. Perhaps I should convert it in my C#, though thanks for .ToString() – JP Hellemons Apr 18 at 12:13

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.