<?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: Geometry cannot have Z values in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/geometry-cannot-have-z-values/m-p/1330196#M10419</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Add line after creating&amp;nbsp;&lt;SPAN&gt;ShapeDescription:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;shapeDescription.HasZ = true;&lt;/LI-CODE&gt;&lt;P&gt;Your original geometry has Z value, but your created FeatureClass not.&lt;/P&gt;</description>
    <pubDate>Tue, 19 Sep 2023 15:38:01 GMT</pubDate>
    <dc:creator>GKmieliauskas</dc:creator>
    <dc:date>2023-09-19T15:38:01Z</dc:date>
    <item>
      <title>Geometry cannot have Z values</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/geometry-cannot-have-z-values/m-p/1330109#M10417</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a functionality in which I am searching the data from the DB and then based on that filtered data I am creating a feature layer. But that feature layer is created in In Memory database. And then using SchemaBuilder I am creating a table in that database.&lt;/P&gt;&lt;P&gt;var schemaBuilder = new SchemaBuilder(m_Database);&lt;/P&gt;&lt;P&gt;var shapeDescription = new ShapeDescription(geometryType, spatialReference);&lt;BR /&gt;var featureClassDescription = new FeatureClassDescription(name, fields, shapeDescription);&lt;/P&gt;&lt;P&gt;schemaBuilder.Create(featureClassDescription);&lt;BR /&gt;var tableCreated = schemaBuilder.Build();&lt;/P&gt;&lt;P&gt;The spatial reference used in the Shape Description is taken from the Geometry of the data returned from the database.&lt;/P&gt;&lt;P&gt;After this I am inserting the data into that table. But then getting this error "Geometry cannot have Z values".&lt;/P&gt;&lt;P&gt;I am fetching the data using QueryDef since it involves multiple joins. When I am simply converting the geometry data from the database (which is of object type) to Geometry this issue is coming.&lt;/P&gt;&lt;P&gt;Shape = (Geometry)row["SHAPE"]&lt;/P&gt;&lt;P&gt;I tried one thing which is not to convert directly to Geometry type but to do this:&lt;/P&gt;&lt;P&gt;var wktWithoutZ = GeometryEngine.Instance.ExportToWKT(WktExportFlags.WktExportStripZs, geometry);&lt;BR /&gt;var mapSpatialReference = ArcGIS.Desktop.Mapping.MapView.Active?.Map?.SpatialReference;&lt;BR /&gt;return GeometryEngine.Instance&lt;BR /&gt;.ImportFromWKT(WktImportFlags.WktImportDefaults, wktWithoutZ, mapSpatialReference ?? SpatialReferenceBuilder.CreateSpatialReference(3006));&lt;/P&gt;&lt;P&gt;This is working fine.&lt;/P&gt;&lt;P&gt;But why the issue is coming if not using the above way?&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/12882"&gt;@Wolf&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/42133"&gt;@GKmieliauskas&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/145101"&gt;@CharlesMacleod&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Sep 2023 13:41:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/geometry-cannot-have-z-values/m-p/1330109#M10417</guid>
      <dc:creator>CarlosK</dc:creator>
      <dc:date>2023-09-19T13:41:09Z</dc:date>
    </item>
    <item>
      <title>Re: Geometry cannot have Z values</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/geometry-cannot-have-z-values/m-p/1330196#M10419</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Add line after creating&amp;nbsp;&lt;SPAN&gt;ShapeDescription:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;shapeDescription.HasZ = true;&lt;/LI-CODE&gt;&lt;P&gt;Your original geometry has Z value, but your created FeatureClass not.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Sep 2023 15:38:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/geometry-cannot-have-z-values/m-p/1330196#M10419</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2023-09-19T15:38:01Z</dc:date>
    </item>
  </channel>
</rss>

