Discussions
Categories
- 196.9K All Categories
- 2.2K Data
- 239 Big Data Appliance
- 1.9K Data Science
- 450.3K Databases
- 221.7K General Database Discussions
- 3.8K Java and JavaScript in the Database
- 31 Multilingual Engine
- 550 MySQL Community Space
- 478 NoSQL Database
- 7.9K Oracle Database Express Edition (XE)
- 3K ORDS, SODA & JSON in the Database
- 545 SQLcl
- 4K SQL Developer Data Modeler
- 187K SQL & PL/SQL
- 21.3K SQL Developer
- 295.9K Development
- 17 Developer Projects
- 138 Programming Languages
- 292.6K Development Tools
- 107 DevOps
- 3.1K QA/Testing
- 646K Java
- 28 Java Learning Subscription
- 37K Database Connectivity
- 155 Java Community Process
- 105 Java 25
- 22.1K Java APIs
- 138.1K Java Development Tools
- 165.3K Java EE (Java Enterprise Edition)
- 18 Java Essentials
- 160 Java 8 Questions
- 86K Java Programming
- 80 Java Puzzle Ball
- 65.1K New To Java
- 1.7K Training / Learning / Certification
- 13.8K Java HotSpot Virtual Machine
- 94.3K Java SE
- 13.8K Java Security
- 204 Java User Groups
- 24 JavaScript - Nashorn
- Programs
- 440 LiveLabs
- 38 Workshops
- 10.2K Software
- 6.7K Berkeley DB Family
- 3.5K JHeadstart
- 5.7K Other Languages
- 2.3K Chinese
- 171 Deutsche Oracle Community
- 1.1K Español
- 1.9K Japanese
- 232 Portuguese
How to read SDO_GEOMETRY
hi,
I will create a webserver to fetch geometries out of my oracle database (11g Locator).
I am using node.js 4.4.7.
My query works fine for types NUMBER and VARCHAR!
But in addition I wanna read out SDO_GEOMETRY but if I try this the following error occurs:
NJS-010: unsupported data type in select list
Does it mean that I am not able to fetch SDO_GEOMETRY types in the current version?
The work around woudl be to transform the geometry in another type to read this out...
There exists a function inside the database "sdo2geojson3d" which converts the sdo_geometry to a json ( inside db = clob type). But I only get this as result:
[ 1315274,
Lob {
_readableState: [Object],
readable: true,
domain: null,
_events: [Object],
_eventsCount: 2,
_maxListeners: undefined,
_writableState: [Object],
writable: true,
allowHalfOpen: true,
iLob: [Object] },
'BuildingGroundSurface' ],
Is there an easy way to read out sdo_geometries?
Answers
-
There is no native support (as of node-oracledb 1.10) for object types. You will have to write a wrapper module in PL/SQL and decompose the component parts. Some of the techniques mentioned in the section "Using Oracle Locator for Spatial Mapping" of the free PHP & Oracle book apply to node-oracledb.
Also see https://github.com/oracle/node-oracledb/issues/147 where this enhancement request is being tracked.
-
Does it make sense to create a new column for each polygon and convert the coordinates out of the sdo_geometry in an array.
Then I can fetch these coordinates directly. This will be faster I think. Am I right?
I tried it with cx_Oracle but this also have no native support. Now I will check the running time with node.js and then I can make a decision.
I am looking for a fast method to fetch only the coordinates based on the sdo_geometry.
-
Python's cx_Oracle has object (e.g. SDO) support in the default branch: https://bitbucket.org/anthony_tuininga/cx_oracle This release hasn't been finalized or bundled yet but you could try it.
Regarding performance, you should benchmark with your environment and data sizes. If I was just getting the point type for a small data set, I might convert them into 3 "index-by" arrays of x, of y, and of z values. Then I'd bind the three arrays using https://github.com/oracle/node-oracledb/blob/master/doc/api.md#plsqlindexbybinds This may or may not be the best for your use case.