question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to get Geometry object by selecting shape column from oracle?

See original GitHub issue

I am trying to get Geometry object directly from sql.

I use this sql:

select shape from table;

Then try to get Geometry object by these codes:

//ResultSet rs, String columnName
byte[] bytes = rs.getBytes(columnName);
ByteBuffer buffer = ByteBuffer.wrap(bytes);
OperatorImportFromESRIShape op = (OperatorImportFromESRIShape) OperatorFactoryLocal.getInstance().getOperator(Operator.Type.ImportFromESRIShape);
Geometry g = op.execute(0, Geometry.Type.Unknown, buffer);

But result is null. Please show me a way how to get Geometry object directly from sql.

Thanks Gavin Men

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
stolstovcommented, Dec 11, 2015

@FalconIA ST_AsBinary returns wkb. Try OperatorImportFromWkb.

0reactions
FalconIAcommented, Dec 11, 2015

@stolstov Ok, i got it. ArcSDE does not store geometries ESRI Shape format, just the column called SHAPE. I will use OperatorImportFromWkb instead.

Thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to view coordinates instead of geometry object in ...
I find useful viewing geometry as WKT, which contains all coodinates - use this SQL: select sdo_util.to_wktgeometry(shape) shape_wkt, shape, ...
Read more >
4 Querying Spatial Data
The following example finds the two objects from the SHAPE column in the COLA_MARKETS table that are closest to a specified point (10,7)....
Read more >
How I can get TYPE of GEOMETRY? - Oracle Communities
I think you want the GET_GTYPE method, which is equivalent to getting the sdo_gtype mod 100. 1* SELECT c.mkt_id, c.shape.
Read more >
2 Spatial Data Types and Metadata - Oracle Help Center
A geometry is stored as an object, in a single row, in a column of type SDO_GEOMETRY. Spatial index creation and maintenance is...
Read more >
2.2 SDO_GEOMETRY Object Type
Oracle Spatial and Graph defines the object type SDO_GEOMETRY as: ... All geometries in a geometry column must have the same SDO_SRID value...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found