Select to view content in your preferred language

SketchEditor spatial reference for geometry

529
1
07-11-2019 02:14 PM
JonShuler
Emerging Contributor

We are using the SketchEditor to allow users to draw polygons on the map and the geometry is being saved to SQL Server.  By default the geometry returned from the SketchEditor is wkid 102100.  We have existing geometry data in the database whose wkid is 4326.  We want all the data in the database to have the same SRID.

I did not see a way to specify the spatial reference used by the SketchEditor.  The spatial reference for the Map property is null so assuming 102100 is the default.

Is there a way to change the spatial reference used by the SketchEditor?

0 Kudos
1 Reply
JoeHershman
MVP Regular Contributor

The spatial reference that is drawn is the same as the basemap that is loaded.  If you are using an esri basemap this will be WebMercator.  Which should be wkid 3857, although it is the same as 102100 just the number was changed a while back. 

But you need to project you geometry prior to save if you want in Wgs84

var wgsGeometry = GeometryEngine.Project(webMercatorGeometry, SpatialReferences.Wgs84);
Thanks,
-Joe
0 Kudos