<?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 converting geometry from esri st to postgis native using sql in Data Management Questions</title>
    <link>https://community.esri.com/t5/data-management-questions/converting-geometry-from-esri-st-to-postgis-native/m-p/162764#M9051</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi there.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have been trying to convert between esri's st geometry to postgis geometry by using sql. I'm having trouble when there are more de 2 coordinates, eg when there's m and/or z coordinates.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What I tried is to convert from st to well known formats (wkb, wkt, ewkb, or ewkt), and from these build a postgis geometry using it's available sql constructors. For instance:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;select st_geomfromewkb(st_asbinary(shape)) from tablename
select geometrytype(geomfromewkb(st_asbinary(shape))) from tablename
&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;For instance, if my tablename has lineZ or lineM, postgis detects it as being of type point...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What I've found is that esri functions return geometry types that are not recognized by postgis, like LINESTRING ZM. Postgis uses "plain" LINESTRING in these cases.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So there is a mismatch in geometry type names that esri uses that prevent the use of geometry constructors in postgis, even though we are in "interoperability land"...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Has anyone found this problem? Any solution or suggestion?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Duarte Carreira&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 08:32:57 GMT</pubDate>
    <dc:creator>DuarteCarreira</dc:creator>
    <dc:date>2021-12-11T08:32:57Z</dc:date>
    <item>
      <title>converting geometry from esri st to postgis native using sql</title>
      <link>https://community.esri.com/t5/data-management-questions/converting-geometry-from-esri-st-to-postgis-native/m-p/162764#M9051</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi there.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have been trying to convert between esri's st geometry to postgis geometry by using sql. I'm having trouble when there are more de 2 coordinates, eg when there's m and/or z coordinates.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What I tried is to convert from st to well known formats (wkb, wkt, ewkb, or ewkt), and from these build a postgis geometry using it's available sql constructors. For instance:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;select st_geomfromewkb(st_asbinary(shape)) from tablename
select geometrytype(geomfromewkb(st_asbinary(shape))) from tablename
&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;For instance, if my tablename has lineZ or lineM, postgis detects it as being of type point...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What I've found is that esri functions return geometry types that are not recognized by postgis, like LINESTRING ZM. Postgis uses "plain" LINESTRING in these cases.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So there is a mismatch in geometry type names that esri uses that prevent the use of geometry constructors in postgis, even though we are in "interoperability land"...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Has anyone found this problem? Any solution or suggestion?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Duarte Carreira&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 08:32:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/converting-geometry-from-esri-st-to-postgis-native/m-p/162764#M9051</guid>
      <dc:creator>DuarteCarreira</dc:creator>
      <dc:date>2021-12-11T08:32:57Z</dc:date>
    </item>
    <item>
      <title>Re: converting geometry from esri st to postgis native using sql</title>
      <link>https://community.esri.com/t5/data-management-questions/converting-geometry-from-esri-st-to-postgis-native/m-p/162765#M9052</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If PostGIS doesn't support the well-known text specification (ISO standard), then I'd think&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;it would be their responsibility to provide a filter mechanism to the portion of the standard&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;they do support (or simply ignore the extra dimensions).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It looks like ST_GeomFromEWKT comes the closest, but that you'll need to prepend the SRID&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;as a string and replace the standard "LINESTRING ZM" to their private "LINESTRINGZM"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(or "LINESTRINGMZ", since the online doc doesn't say what it might be).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Writing your own custom filter to strip Z/M text is probably possible, but you'd need to consult&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;with a PostgreSQL folks on how to write a custom SQL function that accepts TEXT (CLOB)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;and returns TEXT.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;- V&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 May 2012 10:36:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/converting-geometry-from-esri-st-to-postgis-native/m-p/162765#M9052</guid>
      <dc:creator>VinceAngelo</dc:creator>
      <dc:date>2012-05-15T10:36:58Z</dc:date>
    </item>
    <item>
      <title>Re: converting geometry from esri st to postgis native using sql</title>
      <link>https://community.esri.com/t5/data-management-questions/converting-geometry-from-esri-st-to-postgis-native/m-p/162766#M9053</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello Vince. Thanks for your answer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I was convinced the ogc sfs 1.2 referred to suffixes without any spaces (eg. POINTZ). I will take this question to the postgis folks. I'll post here if I find a solution. Anyway, I cannot get postgis 1.4 to create a Z,M, or ZM feature using well known text. Only 2.0 (maybe 1.5?) does this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Duarte&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 May 2012 11:48:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/converting-geometry-from-esri-st-to-postgis-native/m-p/162766#M9053</guid>
      <dc:creator>DuarteCarreira</dc:creator>
      <dc:date>2012-05-15T11:48:03Z</dc:date>
    </item>
    <item>
      <title>Re: converting geometry from esri st to postgis native using sql</title>
      <link>https://community.esri.com/t5/data-management-questions/converting-geometry-from-esri-st-to-postgis-native/m-p/162767#M9054</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;hmm. i have to rephrase this. I can create z-m-zm coordinates in postgis 1.4, using the 2d geometry types strings (POINT, LINESTRING, etc.). Postgis parses the coordinates to see there are z or m. I just cannot use the geometry types strings that esri uses "POINT Z", "LINESTRING Z", etc.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Duarte&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 May 2012 12:46:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/converting-geometry-from-esri-st-to-postgis-native/m-p/162767#M9054</guid>
      <dc:creator>DuarteCarreira</dc:creator>
      <dc:date>2012-05-15T12:46:30Z</dc:date>
    </item>
  </channel>
</rss>

