Select to view content in your preferred language

SQL Server 2008 R2 Geometry Polygons

2907
8
04-15-2010 08:49 PM
KevinCoetzee
Emerging Contributor
Hi

I'm new too ESRI Silverlight and I have imported SHP files, using the SQLTools. These in turn have loaded the tables and the spatial data into GEOMETRY type (not Geography) columns in my SQL Server 2008 R2 database.

I have tried using the MAPIT data service and plug onto a Feature Layer - with no success. I am assuming I'll have to right a webservice which can be consumed. Does anyone perhaps have sample code which will allow me to connect to SQL Server, retrieve the GEOMETRY column and then display the POLYGON onto the ESRI Silverlight MAP?

Thank You in advance...
0 Kudos
8 Replies
HubertLo
Emerging Contributor
Try this sample from ArcGIS Silverlight code gallery:

http://resources.esri.com/arcgisserver/apis/silverlight/index.cfm?fa=codeGalleryDetails&scriptID=164...


I started with this and reverse engineered the WCF class to my current production code. There is one limitation I noticed: The data contract for the query result contains a collection of ESRI Geometry objects. If you are returning more than roughly 500 items, the WCF call will crash. If you run into that problem you may want to pass back a collection of strings in WKT format and parse the WKT in the Silverlight project.
0 Kudos
dotMorten_esri
Esri Notable Contributor
Hi
I have tried using the MAPIT data service and plug onto a Feature Layer - with no success.


I'm curious what problems you were having with this? It's a fairly simple install process to get your MapID SDS REST endpoint running, but there are a few gotchas.

MapIt is ESRI's official supported way of serving up raw SQL Server Geometry/Geography to the client APIs (besides ArcGIS Server of course).
0 Kudos
KevinCoetzee
Emerging Contributor
Morten

Thanks for the reply. Please excuse my ignorance. I have tried geography types, exposed throught the MAPIT services and they work great. I have taken the SHAPEFILES and using the SQLTools converted them to GEOMETRY as this is all it would convert too. Attached I have put one of the shapefiles, I'm assuming there might be something specific with them. I just can't seem to plot them on a ESRI Map

I would appreciate your assistance on this.
0 Kudos
KevinCoetzee
Emerging Contributor
Another thing, up and above what I have said, I did a quick ToString() on the Geometry Type and below is part of the output and it just seems wrong... I'm just trying to figure out where I'm going wrong.
 
POLYGON ((-105007.31790555734 -2878601.9842749489, -105125.62059931271 -2878828.23042175, -105405.27413772233 -2879363.7116128067, -105539.43618392479 -2879610.5916303722, -105649.44805784523 -2879820.7151398351, -105725.61231659539 -2879965.6812729761, -105774.44137298595 -2880066.889866814, -105834.16513400245 -2880190.166801014, -105859.82656342816 -2880228.2059731353, -105893.97620651033 -
0 Kudos
KevinCoetzee
Emerging Contributor
I might be heading into the complete wrong direction, but since I'm forced to use GEOMETERY, it seems that the coordinate system of the viewport is set to PLANAR. So from reading various blogs, it seems I somehow need to convert this to be more GEOGRAPHY based. The only issue I have is, that I have no clue how to convert the SHP files. Any suggestions will be appreciated to be able convert from PLANAR.
0 Kudos
dotMorten_esri
Esri Notable Contributor
A viewport is always planar (unless your screen is actually shaped like a sphere :-).
Why do you require the use of geographic? MapIt will automatically re-project on the fly for you to any spatial reference you desire.
0 Kudos
KevinCoetzee
Emerging Contributor
I'm not sure if I'm heading in the right direction. I need to project maps in South Africa, where we use the Hartebeesthoek projections. These are based on transverse mercator.

These projections , from what I can see, are not supported, making it impossible for me to plot these on ESRI (probably my ignorance).

Please can you look at the SHAPEFILE attached previously and let me know, how to sort this out. I've tried reading through MAPIT and nothing seems to work...
0 Kudos
KevinCoetzee
Emerging Contributor
I struggled with the ESRI tools (probably due to lack of knowledge), I downloaded a free trial or Global Mapper(http://www.globalmapper.com/) and then did a conversion to Geography and changed the projection and bingo! ESRI MAPIT reads it perfectly!!!
0 Kudos