4

I'm building my first plugin in qgis, that needs to read some coordinates from an oracle database (not oracle spatial database) and create a shapefile with this points. I'm searching but only find to in oracle spatial!

Is there a way to do this in a simple oracle database?

2 Answers 2

3

This is a common and old misunderstanding.

Since Oracle 9, standard Oracle has had all the basic functionality to store and retrieve SDO_GEOMETRY in an Oracle database, and this functionality was dubbed "Oracle Locator" by Oracle. You don't need Oracle Spatial for that. Oracle Spatial just adds more geometric functions, allowing you to do some basic geoprocessing using Oracle SQL.

But most GIS's, like ArcGIS, don't even use (or at least didn't) this functionality, as things like calculating the Intersection between two polygons, are implemented at the application level (e.g. ArcMap, AutoCAD Map, QGIS), instead of the database level.

Having these spatial functions at the database level, as with Oracle Spatial, is only a real benefit if you intend to do either SQL command line work, or special custom application development (e.g. web-application) without use of a pre-existing GIS desktop application.

5
  • So how can I connect to my Oracle Database in my plugin? Can you give me an example?
    – Alex
    Sep 12, 2013 at 17:55
  • Alex, I am not familiar with QGIS plugin development, but a quick look at some of the documentation, shows that the plugins are (always?) written in Python. Hence you should be looking at "Python and Oracle Spatial" type Google searches. E.g. here is a couple that may be of help:
    – Marco_B
    Sep 14, 2013 at 22:38
  • gissing-much.blogspot.nl/2011/12/…
    – Marco_B
    Sep 14, 2013 at 22:51
  • pypi.python.org/pypi/cx_Oracle
    – Marco_B
    Sep 14, 2013 at 22:52
  • In addition, you may need to look at "Python and ODBC" type searches for useful links. I have only limited experience with Python, but using ODBC, you should be able to extract geometries as well using SQL statements. You can probably use SQL as well to convert the geometries to WKT or some other more easily processed format at the database side for further usage .
    – Marco_B
    Sep 14, 2013 at 22:57
1

In QGIS 1.9, there is an Oracle database connector that you can configure as "Also list tables with no geometry". I suppose you can also read theses tables within your plugin, but I haven't done it.

You can install 1.9 with osgeo4w if you are on windows.

Hopes this help you get a solution!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.