1

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.

2 Answers 2

2

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

1

Just off the top of my head in SQLServer,

You can query the geography data type using: .ToString () See http://msdn.microsoft.com/en-us/library/bb933803.aspx for the reference info.

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

1
  • 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() Commented Apr 18, 2016 at 12:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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