I have a ORACLE database 10g(Oracle Database 10g Enterprise Edition Release with a SDE.ST_Geometry field and i want to make a program in python so i can create several shapefiles based on this ST_Geometry field and use other fields as well so i can fill my shapes with attributes. I only have database access and i have no idea which arcgis is related.

How can i do this? Is there any suggestion?

  • Please update the question to specify the exact Oracle release and the version of ArcGIS which created the ST_GEOMETRY. Has the listener been correctly configured to permit SDE.ST_AsText invocation from SQL*Plus? Do you have the rest of ArcGIS available? What Python libraries for shapefile manipulation do you have available? – Vince Sep 30 '14 at 11:25
  • @Vince i'm not using nothing, im starting from scratch. I have no idea how to do this so i'm asking for suggestion how to start this. Where to look at.. At this moment i'm looking for GDAL libs.However i follow your advice by updating my question. – ePascoal Sep 30 '14 at 11:47
  • There's likely scores of shapefile and/or GML access libraries, dozens of them written in Python. As it stands, your question is very broad, and not particularly answerable. – Vince Sep 30 '14 at 12:18
  • @Vince, my question is pretty simple if you have some experience on my issue, which is how to export/create a shapefile from a oracle database base on the field sde.st_geommetry, to shapefile or gml, please help me. If you know dozens of libs that allows me to do this, i just want to know at least one example of that dozens libs that you've experience, so i can investigate? I just need suggestions to start with. – ePascoal Sep 30 '14 at 13:36

If you have the same issue GDAL can be a good aproach..

Please take a look on



import cx_Oracle
# Import osgeo
        from osgeo import ogr, osr, gdal
        print "Import success!"
        sys.exit('ERROR: cannot find GDAL/OGR modules')

# To connect to oracle database you will need:
     Connection_String = 'username/pwd@ (DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = xx.xxx.xxx.xx)(PORT = xxxx))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = name.service)))'   

    cur = db.cursor()
    cur.execute("select shape.minx, shape.miny, somefield from mydbase.table")

# "shape" is the name of your SDE.ST_Geometry field.

finally you just have to follow this link:


and problem solved.. If you have this same issue and find this question useful, please vote.

  • Could you add the final lines with SDO driver? – jlSta May 30 '17 at 11:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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