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

francescoboccacci at libero.it francescoboccacci at libero.it
Sat Feb 16 07:00:50 PST 2013


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: lrssvtml at gmail.com

Data: 16/02/2013 15.33

A: "francescoboccacci at libero.it"<francescoboccacci at libero.it>

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

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



Hi,

2013/2/16 francescoboccacci at libero.it <francescoboccacci at 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 at 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





 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20130216/2e4749b4/attachment.html>


More information about the Qgis-developer mailing list