<?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: How to store ArcGIS JSON feature into Oracle SDO Geometry database? in ArcGIS Enterprise Questions</title>
    <link>https://community.esri.com/t5/arcgis-enterprise-questions/how-to-store-arcgis-json-feature-into-oracle-sdo/m-p/470800#M18185</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A &lt;A href="https://www.google.com/?gws_rd=ssl#q=jgeometry+jar+file" rel="nofollow noopener noreferrer" target="_blank"&gt;google&lt;/A&gt; resulted in this link: &lt;A href="http://stackoverflow.com/questions/23363078/jgeometry-cannot-be-resolved-to-a-type" title="http://stackoverflow.com/questions/23363078/jgeometry-cannot-be-resolved-to-a-type" rel="nofollow noopener noreferrer" target="_blank"&gt;oracle - jgeometry cannot be resolved to a type - Stack Overflow&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can fashion simple SQL in the form:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;INSERT INTO foo(geometry) VALUES(
&amp;nbsp; MDSYS.SDO_GEOMETRY(!gtype!,!srid!,NULL,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MDSYS.SDO_ELEM_INFO_ARRAY(
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; !int_eleminfo_array_members!),
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MDSYS.SDO_ORDINATE_ARRAY(
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; !double_ordinate_array_members!)
)&amp;nbsp; );&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but you quickly run out of the maximum number of comma-delimited terms.&amp;nbsp; Which is where the JGeometry object comes in.&amp;nbsp; You can plug the gtype, srid, eleminfo array, and ordinate array into the JGeometry &lt;A href="https://docs.oracle.com/cd/B19306_01/appdev.102/b14373/oracle/spatial/geometry/JGeometry.html#JGeometry_int__int__int____double___" rel="nofollow noopener noreferrer" target="_blank"&gt;constructor&lt;/A&gt;, then pass the &lt;A href="https://docs.oracle.com/cd/B19306_01/appdev.102/b14373/oracle/spatial/geometry/JGeometry.html#store_oracle_spatial_geometry_JGeometry__java_sql_Connection_" rel="nofollow noopener noreferrer" target="_blank"&gt;STRUCT&lt;/A&gt; into JDBC.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code is simple enough, but be sure to validate multi-ring shapes (simple polygon with one exterior ring, polygon with one exterior ring and one interior ring, polygon with one exterior and two interior rings, polygon with two exterior rings, polygon with one interior ring in one of three exterior rings, polygon with multiple interior rings in multiple exterior rings,...).&amp;nbsp; They're all formatted the same in JSON (array of array of x,y pairs), but manifest differently in the resulting geometry (einfo codes).&amp;nbsp; If ArcGIS generated the JSON in the first place, the ring orientation should be reliable (first is exterior, interior rings are in reverse order [area calculation by trapezoid rule returns opposite sign]). It's a bit tedious but not difficult.&amp;nbsp; You may need to reverse the part arrays if Oracle is expecting a different order (left hand rule vs right hand rule; I don't think JSON cares, so long as it's consistent).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I used graph paper to assemble a bunch of boxes and triangles with labels like p1x, p1y, p2x,.... and encoded the JSON from the labels with search/replace.&amp;nbsp; Assembling a test harness was probably harder than the code (especially because I hosed one of the test cases).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- V&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 20:50:32 GMT</pubDate>
    <dc:creator>VinceAngelo</dc:creator>
    <dc:date>2021-12-11T20:50:32Z</dc:date>
    <item>
      <title>How to store ArcGIS JSON feature into Oracle SDO Geometry database?</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/how-to-store-arcgis-json-feature-into-oracle-sdo/m-p/470794#M18179</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'm developing in Java. I retrieve a JSON String from an ArcGIS Online Service Area service. I'd like to store the features returned in the JSON String into an Oracle (SDO Geometry) database.&lt;/P&gt;&lt;P&gt;Is there a fast way of doing that? &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jan 2015 09:16:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/how-to-store-arcgis-json-feature-into-oracle-sdo/m-p/470794#M18179</guid>
      <dc:creator>ab1</dc:creator>
      <dc:date>2015-01-22T09:16:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to store ArcGIS JSON feature into Oracle SDO Geometry database?</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/how-to-store-arcgis-json-feature-into-oracle-sdo/m-p/470795#M18180</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just wondering whether you checked out "JSON to Features" GP tool?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are using ArcObjects, then I believe you can use some of JSON classes and interfaces (like &lt;A href="http://resources.arcgis.com/en/help/arcobjects-java/api/arcobjects/com/esri/arcgis/geometry/JSONConverterGeometry.html" title="http://resources.arcgis.com/en/help/arcobjects-java/api/arcobjects/com/esri/arcgis/geometry/JSONConverterGeometry.html"&gt;JSONConverterGeometry (ArcObjects Java API)&lt;/A&gt;) to do the job.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jan 2015 17:12:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/how-to-store-arcgis-json-feature-into-oracle-sdo/m-p/470795#M18180</guid>
      <dc:creator>TanuHoque</dc:creator>
      <dc:date>2015-01-22T17:12:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to store ArcGIS JSON feature into Oracle SDO Geometry database?</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/how-to-store-arcgis-json-feature-into-oracle-sdo/m-p/470796#M18181</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;One way would be to convert the JSON geometry definition into a well-known-text (WKT) format, and then use the Oracle &lt;A href="http://docs.oracle.com/cd/B28359_01/appdev.111/b28400/sdo_util.htm#SPATL1234"&gt;SDO_UTIL.FROM_WKTGEOMETRY&lt;/A&gt; method to convert the WKT to a Geometry (i.e. inside a stored procedure).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.esri.com/thread/78855"&gt;Here is a post&lt;/A&gt; on converting JSON geometry text to WKT.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jan 2015 17:29:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/how-to-store-arcgis-json-feature-into-oracle-sdo/m-p/470796#M18181</guid>
      <dc:creator>ErinBrimhall</dc:creator>
      <dc:date>2015-01-22T17:29:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to store ArcGIS JSON feature into Oracle SDO Geometry database?</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/how-to-store-arcgis-json-feature-into-oracle-sdo/m-p/470797#M18182</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The problem with passing through WKT is volume.&amp;nbsp; I've run into limits in SQL statement size using WKT through JDBC.&amp;nbsp; The JGeometry handle provided by Oracle worked quickly, even for polygons with large numbers of vertices.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- V&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Jan 2015 06:05:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/how-to-store-arcgis-json-feature-into-oracle-sdo/m-p/470797#M18182</guid>
      <dc:creator>VinceAngelo</dc:creator>
      <dc:date>2015-01-23T06:05:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to store ArcGIS JSON feature into Oracle SDO Geometry database?</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/how-to-store-arcgis-json-feature-into-oracle-sdo/m-p/470798#M18183</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;@Tanu I don't want to use more GP services because retrieving the JSON is already taking a lot of time. I don't use ArcObjects.&lt;/P&gt;&lt;P&gt;@Erin The polygons I'm handling have indeed large number of vertices. Vince says that WKT is not suitable for large amounts of data. So ...&lt;/P&gt;&lt;P&gt;@Vince I tried using JGeometry but I didn't find the library anywhere to download it!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The solution I opted for is parsing the JSON with Java and inserting the SDO_GEOMETRY into the database with SQL. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Jan 2015 08:49:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/how-to-store-arcgis-json-feature-into-oracle-sdo/m-p/470798#M18183</guid>
      <dc:creator>ab1</dc:creator>
      <dc:date>2015-01-23T08:49:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to store ArcGIS JSON feature into Oracle SDO Geometry database?</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/how-to-store-arcgis-json-feature-into-oracle-sdo/m-p/470799#M18184</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's not easy!!! Do you know where I can fin JGeometry library ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Jan 2015 14:10:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/how-to-store-arcgis-json-feature-into-oracle-sdo/m-p/470799#M18184</guid>
      <dc:creator>ab1</dc:creator>
      <dc:date>2015-01-23T14:10:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to store ArcGIS JSON feature into Oracle SDO Geometry database?</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/how-to-store-arcgis-json-feature-into-oracle-sdo/m-p/470800#M18185</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A &lt;A href="https://www.google.com/?gws_rd=ssl#q=jgeometry+jar+file" rel="nofollow noopener noreferrer" target="_blank"&gt;google&lt;/A&gt; resulted in this link: &lt;A href="http://stackoverflow.com/questions/23363078/jgeometry-cannot-be-resolved-to-a-type" title="http://stackoverflow.com/questions/23363078/jgeometry-cannot-be-resolved-to-a-type" rel="nofollow noopener noreferrer" target="_blank"&gt;oracle - jgeometry cannot be resolved to a type - Stack Overflow&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can fashion simple SQL in the form:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;INSERT INTO foo(geometry) VALUES(
&amp;nbsp; MDSYS.SDO_GEOMETRY(!gtype!,!srid!,NULL,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MDSYS.SDO_ELEM_INFO_ARRAY(
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; !int_eleminfo_array_members!),
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MDSYS.SDO_ORDINATE_ARRAY(
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; !double_ordinate_array_members!)
)&amp;nbsp; );&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but you quickly run out of the maximum number of comma-delimited terms.&amp;nbsp; Which is where the JGeometry object comes in.&amp;nbsp; You can plug the gtype, srid, eleminfo array, and ordinate array into the JGeometry &lt;A href="https://docs.oracle.com/cd/B19306_01/appdev.102/b14373/oracle/spatial/geometry/JGeometry.html#JGeometry_int__int__int____double___" rel="nofollow noopener noreferrer" target="_blank"&gt;constructor&lt;/A&gt;, then pass the &lt;A href="https://docs.oracle.com/cd/B19306_01/appdev.102/b14373/oracle/spatial/geometry/JGeometry.html#store_oracle_spatial_geometry_JGeometry__java_sql_Connection_" rel="nofollow noopener noreferrer" target="_blank"&gt;STRUCT&lt;/A&gt; into JDBC.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code is simple enough, but be sure to validate multi-ring shapes (simple polygon with one exterior ring, polygon with one exterior ring and one interior ring, polygon with one exterior and two interior rings, polygon with two exterior rings, polygon with one interior ring in one of three exterior rings, polygon with multiple interior rings in multiple exterior rings,...).&amp;nbsp; They're all formatted the same in JSON (array of array of x,y pairs), but manifest differently in the resulting geometry (einfo codes).&amp;nbsp; If ArcGIS generated the JSON in the first place, the ring orientation should be reliable (first is exterior, interior rings are in reverse order [area calculation by trapezoid rule returns opposite sign]). It's a bit tedious but not difficult.&amp;nbsp; You may need to reverse the part arrays if Oracle is expecting a different order (left hand rule vs right hand rule; I don't think JSON cares, so long as it's consistent).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I used graph paper to assemble a bunch of boxes and triangles with labels like p1x, p1y, p2x,.... and encoded the JSON from the labels with search/replace.&amp;nbsp; Assembling a test harness was probably harder than the code (especially because I hosed one of the test cases).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- V&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 20:50:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/how-to-store-arcgis-json-feature-into-oracle-sdo/m-p/470800#M18185</guid>
      <dc:creator>VinceAngelo</dc:creator>
      <dc:date>2021-12-11T20:50:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to store ArcGIS JSON feature into Oracle SDO Geometry database?</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/how-to-store-arcgis-json-feature-into-oracle-sdo/m-p/470801#M18186</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Vince &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;I finally found the JGeometry library (sdoapi.jar)!&lt;/P&gt;&lt;P&gt;I tried to insert the SDO Geometry using SQL but since the polygon has a large number of vertices, I got an SQL exception all the time. I'll try with JGeometry and see if it works ...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jan 2015 08:45:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/how-to-store-arcgis-json-feature-into-oracle-sdo/m-p/470801#M18186</guid>
      <dc:creator>ab1</dc:creator>
      <dc:date>2015-01-26T08:45:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to store ArcGIS JSON feature into Oracle SDO Geometry database?</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/how-to-store-arcgis-json-feature-into-oracle-sdo/m-p/470802#M18187</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It works perfectly! Thanks Vince &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/wink.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jan 2015 13:30:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/how-to-store-arcgis-json-feature-into-oracle-sdo/m-p/470802#M18187</guid>
      <dc:creator>ab1</dc:creator>
      <dc:date>2015-01-26T13:30:53Z</dc:date>
    </item>
  </channel>
</rss>

