<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Creating an ESRI Geometry from GML 2.0 using the Core &amp; CoreHost API in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/creating-an-esri-geometry-from-gml-2-0-using-the/m-p/814856#M2527</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A href="https://community.esri.com/migrated-users/355902"&gt;Lars Domesjö&lt;/A&gt;‌,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The error seem to be happening at this line =&amp;gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;SPAN style="display: inline !important; float: none; background-color: #f6f6f6; color: #3d3d3d; font-family: inherit; font-size: 100%; font-style: inherit; font-variant: normal; font-weight: inherit; letter-spacing: normal; orphans: 2; overflow-wrap: break-word; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;using (var esriLayer = esriDataSource.CreateLayer("baseLayer", spatialReference, g.GetGeometryType(), new string[] {}))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #f6f6f6; color: #3d3d3d; font-family: inherit; font-size: 100%; font-style: inherit; font-variant: normal; font-weight: inherit; letter-spacing: normal; orphans: 2; overflow-wrap: break-word; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;g look like null.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #3d3d3d; font-family: Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; font-size: 15px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; overflow-wrap: break-word; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;Apart from GeometryEngine line of code, you seem to be using the other external libraries outside of ArcGIS runtime and ArcGIS pro sdk.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #3d3d3d; font-family: Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; font-size: 15px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; overflow-wrap: break-word; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;Additionally I assume&amp;nbsp;&lt;SPAN style="display: inline !important; float: none; background-color: #f6f6f6; color: #3d3d3d; font-family: inherit; font-size: 100%; font-style: inherit; font-variant: normal; font-weight: inherit; letter-spacing: normal; orphans: 2; overflow-wrap: break-word; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;tempFile&lt;/SPAN&gt; is the shape file from your code, you can test whether you successfully generated or not by importing into ArcGIS pro or ArcMap and visualize it.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;Best Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 13 Mar 2020 05:23:39 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2020-03-13T05:23:39Z</dc:date>
    <item>
      <title>Creating an ESRI Geometry from GML 2.0 using the Core &amp; CoreHost API</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/creating-an-esri-geometry-from-gml-2-0-using-the/m-p/814855#M2526</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I&amp;nbsp;in the process of writing a utility which creates ArcGIS Features in a geodatabase based on information coming in via an XML.&lt;/P&gt;&lt;P&gt;This XML contains geometries in GML 2.0-format which I wish to convert into Shapes on a Feature.&lt;/P&gt;&lt;P&gt;I looked around within the ArcGIS Pro Core API and couldn't find built-in functionality to import shapes from GML so i started using GDAL to convert the geometries from GML 2.0 to ESRI Shapefiles, as the geometryengine does have a function to create geometries from ESRI Shapefiles.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am currently using the following C#-code to create the ESRI Shapefile using GDAL:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;using (var g = OSGeo.OGR.Geometry.CreateFromGML(gmlElement.ToString()))&lt;BR /&gt; using (var esriDriver = Ogr.GetDriverByName("ESRI Shapefile"))&lt;BR /&gt; using (var esriDataSource = esriDriver.CreateDataSource(tempFile, new string[] {}))&lt;BR /&gt; using (var esriLayer = esriDataSource.CreateLayer("baseLayer", spatialReference, g.GetGeometryType(), new string[] {}))&lt;BR /&gt; using (var esriLayerDefinition = esriLayer.GetLayerDefn())&lt;BR /&gt; using (var feature = new Feature(esriLayerDefinition))&lt;BR /&gt; {&lt;BR /&gt; feature.SetGeometry(g);&lt;BR /&gt; esriLayer.CreateField(new FieldDefn("id", FieldType.OFTInteger), 0);&lt;/P&gt;&lt;P&gt;feature.SetField("id", 123);&lt;BR /&gt; var i = esriLayer.CreateFeature(feature);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;var bytes = File.ReadAllBytes(tempFile);&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am then using the following code to import into a ESRI Geometry from the ESRI Shapefile byte-array created using GDAL:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;var geometry = GeometryEngine.Instance.ImportFromEsriShape(EsriShapeImportFlags.esriShapeImportNoSwap, bytes, CreateSpatialReference(3006));&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the ArcGIS Pro SDK does not seem to like this however as it seems to be unable to find any geometries within the provided ESRI Shapefile:&lt;/P&gt;&lt;P&gt;ArcGIS.Core.Geometry.GeometryObjectException: 'GeometryObjectException: A null geometry does not correspond to any Esri geometry type.'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you have any hints for me on what I might be doing wrong? Or know of a better way to go from a shape in GML 2.0 format to an ESRI Geometry using the Core &amp;amp; CoreHost APIs?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Mar 2020 10:00:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/creating-an-esri-geometry-from-gml-2-0-using-the/m-p/814855#M2526</guid>
      <dc:creator>LarsDomesjö</dc:creator>
      <dc:date>2020-03-12T10:00:05Z</dc:date>
    </item>
    <item>
      <title>Re: Creating an ESRI Geometry from GML 2.0 using the Core &amp; CoreHost API</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/creating-an-esri-geometry-from-gml-2-0-using-the/m-p/814856#M2527</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A href="https://community.esri.com/migrated-users/355902"&gt;Lars Domesjö&lt;/A&gt;‌,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The error seem to be happening at this line =&amp;gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;SPAN style="display: inline !important; float: none; background-color: #f6f6f6; color: #3d3d3d; font-family: inherit; font-size: 100%; font-style: inherit; font-variant: normal; font-weight: inherit; letter-spacing: normal; orphans: 2; overflow-wrap: break-word; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;using (var esriLayer = esriDataSource.CreateLayer("baseLayer", spatialReference, g.GetGeometryType(), new string[] {}))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #f6f6f6; color: #3d3d3d; font-family: inherit; font-size: 100%; font-style: inherit; font-variant: normal; font-weight: inherit; letter-spacing: normal; orphans: 2; overflow-wrap: break-word; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;g look like null.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #3d3d3d; font-family: Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; font-size: 15px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; overflow-wrap: break-word; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;Apart from GeometryEngine line of code, you seem to be using the other external libraries outside of ArcGIS runtime and ArcGIS pro sdk.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #3d3d3d; font-family: Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; font-size: 15px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; overflow-wrap: break-word; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;Additionally I assume&amp;nbsp;&lt;SPAN style="display: inline !important; float: none; background-color: #f6f6f6; color: #3d3d3d; font-family: inherit; font-size: 100%; font-style: inherit; font-variant: normal; font-weight: inherit; letter-spacing: normal; orphans: 2; overflow-wrap: break-word; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;tempFile&lt;/SPAN&gt; is the shape file from your code, you can test whether you successfully generated or not by importing into ArcGIS pro or ArcMap and visualize it.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;Best Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Mar 2020 05:23:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/creating-an-esri-geometry-from-gml-2-0-using-the/m-p/814856#M2527</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2020-03-13T05:23:39Z</dc:date>
    </item>
    <item>
      <title>Re: Creating an ESRI Geometry from GML 2.0 using the Core &amp; CoreHost API</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/creating-an-esri-geometry-from-gml-2-0-using-the/m-p/814857#M2528</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Lars,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As you found, GML 2.0 format is not currently&amp;nbsp;supported in the Pro API.&amp;nbsp; &amp;nbsp; I also don't have&amp;nbsp;knowledge of the GDAL libraries you are using to create a shapefile, but I would check the following.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Firstly a shapefile is composed of at least 3 files; a .shp, a .shx and a .dbf file.&amp;nbsp; You need to make sure that all three of these files are created.&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Secondly I would attempt to load the output shapefile into ArcMap or ArcGIS Pro to ensure that you have geometries, and that the geometries match what you expect from your source&amp;nbsp;data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After this you will need to read the shapefile.&amp;nbsp;Rather than using the ImportFromEsriShape function (which does not work on an entire shapefile but on a feature by feature basis), you should use the geodatabase API which is available in ArcGIS.Core.Data to connect to the shapefile.&amp;nbsp; Here is a snippet that should help&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://github.com/ArcGIS/arcgis-pro-sdk/wiki/ProSnippets-Geodatabase#opening-a-featureclass-from-a-shapefile-datastore" title="https://github.com/ArcGIS/arcgis-pro-sdk/wiki/ProSnippets-Geodatabase#opening-a-featureclass-from-a-shapefile-datastore"&gt;https://github.com/Esri/arcgis-pro-sdk/wiki/ProSnippets-Geodatabase#opening-a-featureclass-from-a-shapefile-datastore&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once you have the shapefile feature class open you should be able to use a search cursor to obtain all the rows and iterate through to obtain the geometries.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this helps.&amp;nbsp; Let me know if you&amp;nbsp;have additional questions.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Narelle&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Mar 2020 21:05:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/creating-an-esri-geometry-from-gml-2-0-using-the/m-p/814857#M2528</guid>
      <dc:creator>NarelleChedzey</dc:creator>
      <dc:date>2020-03-13T21:05:30Z</dc:date>
    </item>
    <item>
      <title>Re: Creating an ESRI Geometry from GML 2.0 using the Core &amp; CoreHost API</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/creating-an-esri-geometry-from-gml-2-0-using-the/m-p/814858#M2529</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Narelle!&amp;nbsp; I went another route and went from GML to WKB (via an external library) and then from WKB to ESRI Geometries in the end.&lt;/P&gt;&lt;P&gt;Will try to try this at some point as well though.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Mar 2020 15:31:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/creating-an-esri-geometry-from-gml-2-0-using-the/m-p/814858#M2529</guid>
      <dc:creator>LarsDomesjö</dc:creator>
      <dc:date>2020-03-25T15:31:09Z</dc:date>
    </item>
  </channel>
</rss>

