Thanks Salvatore,i tried:epsg = vlayerA.crs().authid()
epsg = epsg[5:len(epsg)]
self.epsg = int(epsg)
because i'd like to convert the string to integer but i receive this error:


p, li { white-space: pre-wrap; }

self.epsg = int(epsg)
UnboundLocalError: local variable 'int' referenced before assignment
Do you know why?
Thanks
Francesco



----Messaggio originale----

Da: lrssv...@gmail.com

Data: 16/02/2013 15.33

A: "francescobocca...@libero.it"<francescobocca...@libero.it>

Cc: <qgis-developer@lists.osgeo.org>

Ogg: Re: [Qgis-developer] Extract epgs code from input layer



Hi,

2013/2/16 francescobocca...@libero.it <francescobocca...@libero.it>

Hi all,

i would like to extract epsg code from inputvector layer.

My code is:



vlayerA = QGisLayers.getObjectFromUri(self.getParameterValue(href.INPUT))

self.epsg = vlayerA.crs().srsid()



Is it corrects?

If i print the values it show strange value.



Those are not strange values, the srs id is the primary key that reference to 
SRS in sqlite db.
You should use authid() [1] to get EPSG code or description() [2] to get a 
textual description of the SRS.




Regards,

-SL
 
[1] - http://goo.gl/o29FU
[2] - http://goo.gl/IPvYx
 

Thanks



Francesco

_______________________________________________

Qgis-developer mailing list

Qgis-developer@lists.osgeo.org

http://lists.osgeo.org/mailman/listinfo/qgis-developer



-- 
Salvatore Larosa
linkedIn: http://linkedin.com/in/larosasalvatore
twitter: @lrssvt
skype: s.larosa

IRC: lrssvt on freenode





 
_______________________________________________
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to