[Qgis-developer] Python binding : wrong srid/epsg/srsid for some files

Michaël Douchin michael.douchin at laposte.net
Mon May 5 12:22:46 EDT 2008


Hi list

I am trying to find the EPSG of vector layers within a python plugin 
with the following code ("layer" is a qgis vector layer):

#####
        #layer provider (ogr, postgres, etc.)
        myprovider = layer.getDataProvider()

        #layer EPSG projection
        mysrs = myprovider.getSRS() #layer spatial reference system
        myepsg = mysrs.epsg()
        mysrsid = mysrs.srsid()
        mysrid = mysrs.srid()
#####

this code returns right codes for some of my vector layer (postgresql or 
shapefiles), but wrong codes with others.
For example, if I try on the IGN river shapefile here:
http://www.ign.fr/telechargement/MPro/produit/BD_CARTHAGE/BDCARTHAGE_SHP_L2E/BDC91_AV3D_L2E.zip

I get these strange codes :
myepsg =43537312 instead of 27572
mysrsid =43535536
mysrid =43687072

Has anyone a clue for explaining this behaviour?

Thanks in advance
Michael




More information about the Qgis-developer mailing list