import com.esri.arcgis.geometry.Polygon; import com.esri.arcgis.system.JSONReader; import com.esri.arcgis.geodatabase.JSONDeserializerGdb; JSONReader reader = new JSONReader(); reader.readFromString(jsonTxt); JSONDeserializerGdb ds = new JSONDeserializerGdb(); ds.initDeserializer(reader, null); Polygon polygon = (Polygon) ds.readGeometry(esriGeometryType.esriGeometryPolygon);
I was trying this in C#. However when I cast that to IPolygon (which should be the .NET-equivalent to the Polygon-interface in your Java-solution), I get an InvalidCastException, as seen here https://community.esri.com/thread/215252-jsonconvertergeometryclass-creates-invalid-geometries
Hy,you should ask this question in the ArcObjects forum.But here my solution in Java:import com.esri.arcgis.geometry.Polygon; import com.esri.arcgis.system.JSONReader; import com.esri.arcgis.geodatabase.JSONDeserializerGdb; JSONReader reader = new JSONReader(); reader.readFromString(jsonTxt); JSONDeserializerGdb ds = new JSONDeserializerGdb(); ds.initDeserializer(reader, null); Polygon polygon = (Polygon) ds.readGeometry(esriGeometryType.esriGeometryPolygon); This should be similar in C++.Tom
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.