<?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 Knowledge Graph geometry type not accepted in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/knowledge-graph-geometry-type-not-accepted/m-p/1408716#M9874</link>
    <description>&lt;P&gt;I have a code (below) that accepts a geometry type and builds a shape dict to be added to my knowledge graphs. This works without issue if the geometry type is 'esriGeometryTypePoint', but any other type and I get the following error (shown after code):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def build_spatial_props(geo_type):
    space_types = []
    space_dict = {
        "name": "shape",
        "alias": "shape",
        "fieldType": "esriFieldTypeGeometry",
        "geometryType": geo_type,
        "hasZ": False,
        "hasM": False,
        "editable": True,
        "visible": True,
        "required": False,
        "IsSystemMaintained": False,
        "role": "esriGraphPropertyRegular"
    }
    space_types.append(space_dict)
    return space_types&lt;/LI-CODE&gt;&lt;LI-CODE lang="python"&gt;spatial_poly = build_spatial_props("esriGeometryTypeMultipoint")

kg.graph_property_adds(type_name='Matthew_Flood_Impact', graph_properties=spatial_poly)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;~\AppData\Local\ESRI\conda\envs\gf\Lib\site-packages\arcgis\graph\_service.py&lt;/SPAN&gt; in &lt;SPAN class=""&gt;graph_property_adds&lt;/SPAN&gt;&lt;SPAN class=""&gt;(self, type_name, graph_properties)&lt;/SPAN&gt;
&lt;SPAN class=""&gt;    868&lt;/SPAN&gt;         r_enc &lt;SPAN class=""&gt;=&lt;/SPAN&gt; _kgparser&lt;SPAN class=""&gt;.&lt;/SPAN&gt;GraphPropertyAddsRequestEncoder&lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;)&lt;/SPAN&gt;
&lt;SPAN class=""&gt;    869&lt;/SPAN&gt;         &lt;SPAN class=""&gt;for&lt;/SPAN&gt; prop &lt;SPAN class=""&gt;in&lt;/SPAN&gt; graph_properties&lt;SPAN class=""&gt;:&lt;/SPAN&gt;
&lt;SPAN class=""&gt;--&amp;gt; 870&lt;/SPAN&gt;             r_enc&lt;SPAN class=""&gt;.&lt;/SPAN&gt;add_property&lt;SPAN class=""&gt;(&lt;/SPAN&gt;prop&lt;SPAN class=""&gt;)&lt;/SPAN&gt;
&lt;SPAN class=""&gt;    871&lt;/SPAN&gt; 
&lt;SPAN class=""&gt;    872&lt;/SPAN&gt;         r_enc&lt;SPAN class=""&gt;.&lt;/SPAN&gt;encode&lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;)&lt;/SPAN&gt;

&lt;SPAN class=""&gt;ValueError&lt;/SPAN&gt;: Unexpected geometry type.&lt;/PRE&gt;&lt;P&gt;The following are listed as geometry types for properties:&amp;nbsp;&lt;A href="https://github.com/Esri/arcgis-python-api/blob/d89788423fdf430cf84a28614f3effed7bc8706a/guide/17-working-with-knowledge-graphs/part3_edit_knowledge_graph.ipynb" target="_self"&gt;https://github.com/Esri/arcgis-python-api/blob/d89788423fdf430cf84a28614f3effed7bc8706a/guide/17-working-with-knowledge-graphs/part3_edit_knowledge_graph.ipynb&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;esriFieldTypeGeometry&lt;UL&gt;&lt;LI&gt;with this type, you also need to&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://github.com/Esri/knowledge-pbf/blob/master/proto/esriPBuffer/EsriTypes.proto" target="_blank"&gt;define geometryType&lt;/A&gt;:&lt;UL&gt;&lt;LI&gt;esriGeometryTypePoint&lt;/LI&gt;&lt;LI&gt;esriGeometryTypePolyline&lt;/LI&gt;&lt;LI&gt;esriGeometryTypePolygon&lt;/LI&gt;&lt;LI&gt;esriGeometryTypeMultipoint&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;</description>
    <pubDate>Thu, 11 Apr 2024 20:13:41 GMT</pubDate>
    <dc:creator>dariusmb</dc:creator>
    <dc:date>2024-04-11T20:13:41Z</dc:date>
    <item>
      <title>Knowledge Graph geometry type not accepted</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/knowledge-graph-geometry-type-not-accepted/m-p/1408716#M9874</link>
      <description>&lt;P&gt;I have a code (below) that accepts a geometry type and builds a shape dict to be added to my knowledge graphs. This works without issue if the geometry type is 'esriGeometryTypePoint', but any other type and I get the following error (shown after code):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def build_spatial_props(geo_type):
    space_types = []
    space_dict = {
        "name": "shape",
        "alias": "shape",
        "fieldType": "esriFieldTypeGeometry",
        "geometryType": geo_type,
        "hasZ": False,
        "hasM": False,
        "editable": True,
        "visible": True,
        "required": False,
        "IsSystemMaintained": False,
        "role": "esriGraphPropertyRegular"
    }
    space_types.append(space_dict)
    return space_types&lt;/LI-CODE&gt;&lt;LI-CODE lang="python"&gt;spatial_poly = build_spatial_props("esriGeometryTypeMultipoint")

kg.graph_property_adds(type_name='Matthew_Flood_Impact', graph_properties=spatial_poly)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;~\AppData\Local\ESRI\conda\envs\gf\Lib\site-packages\arcgis\graph\_service.py&lt;/SPAN&gt; in &lt;SPAN class=""&gt;graph_property_adds&lt;/SPAN&gt;&lt;SPAN class=""&gt;(self, type_name, graph_properties)&lt;/SPAN&gt;
&lt;SPAN class=""&gt;    868&lt;/SPAN&gt;         r_enc &lt;SPAN class=""&gt;=&lt;/SPAN&gt; _kgparser&lt;SPAN class=""&gt;.&lt;/SPAN&gt;GraphPropertyAddsRequestEncoder&lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;)&lt;/SPAN&gt;
&lt;SPAN class=""&gt;    869&lt;/SPAN&gt;         &lt;SPAN class=""&gt;for&lt;/SPAN&gt; prop &lt;SPAN class=""&gt;in&lt;/SPAN&gt; graph_properties&lt;SPAN class=""&gt;:&lt;/SPAN&gt;
&lt;SPAN class=""&gt;--&amp;gt; 870&lt;/SPAN&gt;             r_enc&lt;SPAN class=""&gt;.&lt;/SPAN&gt;add_property&lt;SPAN class=""&gt;(&lt;/SPAN&gt;prop&lt;SPAN class=""&gt;)&lt;/SPAN&gt;
&lt;SPAN class=""&gt;    871&lt;/SPAN&gt; 
&lt;SPAN class=""&gt;    872&lt;/SPAN&gt;         r_enc&lt;SPAN class=""&gt;.&lt;/SPAN&gt;encode&lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;)&lt;/SPAN&gt;

&lt;SPAN class=""&gt;ValueError&lt;/SPAN&gt;: Unexpected geometry type.&lt;/PRE&gt;&lt;P&gt;The following are listed as geometry types for properties:&amp;nbsp;&lt;A href="https://github.com/Esri/arcgis-python-api/blob/d89788423fdf430cf84a28614f3effed7bc8706a/guide/17-working-with-knowledge-graphs/part3_edit_knowledge_graph.ipynb" target="_self"&gt;https://github.com/Esri/arcgis-python-api/blob/d89788423fdf430cf84a28614f3effed7bc8706a/guide/17-working-with-knowledge-graphs/part3_edit_knowledge_graph.ipynb&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;esriFieldTypeGeometry&lt;UL&gt;&lt;LI&gt;with this type, you also need to&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://github.com/Esri/knowledge-pbf/blob/master/proto/esriPBuffer/EsriTypes.proto" target="_blank"&gt;define geometryType&lt;/A&gt;:&lt;UL&gt;&lt;LI&gt;esriGeometryTypePoint&lt;/LI&gt;&lt;LI&gt;esriGeometryTypePolyline&lt;/LI&gt;&lt;LI&gt;esriGeometryTypePolygon&lt;/LI&gt;&lt;LI&gt;esriGeometryTypeMultipoint&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Thu, 11 Apr 2024 20:13:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/knowledge-graph-geometry-type-not-accepted/m-p/1408716#M9874</guid>
      <dc:creator>dariusmb</dc:creator>
      <dc:date>2024-04-11T20:13:41Z</dc:date>
    </item>
  </channel>
</rss>

