silverlight - How do I convert a Graphic to a different coordinate system in ArcGIS? -
i trying add functionality silverlight arcgis application allows shapefiles uploaded , displayed on map. whenever upload shapefile, displays correctly in wrong place, such shape should in texas being drawn in sahara.
i'm pretty sure problem our map uses different coordinate system each shapefile, haven't been able find resources can convert shapefile coordinates. webmercator.fromgeographic works of shapefiles, causes application crash others.
i've tried using geometryservice , have tried altering spatialreferences shapes, neither had noticeable effect.
the prj file didn't work fromgeographic looks this:
projcs["basic albers wgs84",geogcs["d_wgs_1984",datum["d_wgs_1984",spheroid["wgs_1984",6378137.0,298.257223563]],primem["greenwich",0.0],unit["degree",0.0174532925199433]],projection["albers"],parameter["false_easting",0.0],parameter["false_northing",0.0],parameter["central_meridian",-96.0],parameter["standard_parallel_1",45.5],parameter["standard_parallel_2",29.5],parameter["latitude_of_origin",23.0],unit["foot_us",0.3048006096012192]]
where can start looking figure out?
edit:
here code how polygon graphic created:
esri.arcgis.client.geometry.polygon geo = new esri.arcgis.client.geometry.polygon(); observablecollection<esri.arcgis.client.geometry.pointcollection> paths = new observablecollection<esri.arcgis.client.geometry.pointcollection>(); esri.arcgis.client.geometry.pointcollection pcol = new esri.arcgis.client.geometry.pointcollection(); foreach (system.windows.point p in this.points) { mappoint mp = new mappoint(); mp.x = p.x; mp.y = p.y; pcol.add(mp); } paths.add(pcol); geo.rings = paths; // random wkid test with. geo.spatialreference = new esri.arcgis.client.geometry.spatialreference(3174); esri.arcgis.client.graphic gr = new esri.arcgis.client.graphic() { geometry = geo, symbol = window.get(symbolpolygon) esri.arcgis.client.symbols.symbol, }; return gr;
the geometryservice used this:
graphicslayer graphicslayer = new graphicslayer(); foreach (shapefilerecord r in sh.records) { graphic g = r.tographic(this); graphicslayer.graphics.add(g); } geoserv.projectasync(graphicslayer.graphics.tolist(), new esri.arcgis.client.geometry.spatialreference(102100)); map.layers.add(graphicslayer);
this may not complete answer, there's info comment.
your source sr, 3174
, incorrect. wkt of sr different .prj file posted:
projcs["nad83 / great lakes albers", geogcs["nad83", datum["north_american_datum_1983", spheroid["grs 1980",6378137,298.257222101, authority["epsg","7019"]], authority["epsg","6269"]], primem["greenwich",0, authority["epsg","8901"]], unit["degree",0.01745329251994328, authority["epsg","9122"]], authority["epsg","4269"]], unit["metre",1, authority["epsg","9001"]], projection["albers_conic_equal_area"], parameter["standard_parallel_1",42.122774], parameter["standard_parallel_2",49.01518], parameter["latitude_of_center",45.568977], parameter["longitude_of_center",-84.455955], parameter["false_easting",1000000], parameter["false_northing",1000000], authority["epsg","3174"], axis["x",east], axis["y",north]]
...where worst problem .prj file has unit["foot_us",0.3048006096012192]
, while 3174 has unit["metre",1]
! why things appearing in sahara. :)
i think best bet use this constructor of spatialreference class, , feed wkt posted prj file.
Comments
Post a Comment