The open source cx_Oracle Python extension makes it easy to interoperate between Python apps and Oracle Spatial. cx_Oracle works with Python version 2.7 and 3.4+, and supports Oracle Client 11.2+ and therefore any database version supported by Oracle Client 11.2+ (i.e. Oracle Database 9i+) . Working with Spatial is streamlined by cx_Oracle's handling of object types (i.e. SDO_GEOMETRY) and LOBS (WKT, WKB).
See details here: https://oracle.github.io/python-cx_Oracle.
We've provided sample code for working with Python and Spatial using cx_Oracle, specifically
- Binding SDO_GEOMETRY to Python objects and loading geometries to the database
- Retrieving the geometries back from Spatial to Python objects for analysis using the popular GeoPandas Python package.
Please find the sample code here: https://github.com/oracle/python-cx_Oracle/blob/master/samples/SpatialToGeoPandas.py
The script returns a geometry in WKT format which you can view by pasting into Wicket: