[QGIS-trac] Re: [Quantum GIS] #1339: Can't set projection to WGS84 UTM Zone 15N

Quantum GIS qgis at qgis.org
Tue Oct 28 16:20:25 EDT 2008


#1339: Can't set projection to WGS84 UTM Zone 15N
-----------------------------------------------------+----------------------
        Reporter:  vedgewater                        |         Owner:  nobody       
            Type:  bug                               |        Status:  new          
        Priority:  major: does not work as expected  |     Milestone:  Version 1.0.0
       Component:  Projection Support                |       Version:  0.11.0       
      Resolution:                                    |      Keywords:  UTM SRSID    
Platform_version:                                    |      Platform:  Gentoo       
        Must_fix:  No                                |   Status_info:  0            
-----------------------------------------------------+----------------------
Comment (by vedgewater):

 Hi Fernando,

 Sorry for not getting back to you sooner, I have been away last week.

 Using python console, I am now able to reproduce the error....

 If you:

 1 Open the attached shape file in QGIS (it's lat/lon)
 2 Save the this as a QGIS workspace
 3 Right click the layer, properties, General tab, change SRS, select ID
 2992
 4 Hit Apply, then OK
 5 save the workspace
 6 Close QGIS
 7 Open QGIS
 8 Open last used workspace
 9 Check through properties again, it should show the layer as UTM
 10 Open python console:
 11 iface.activeLayer().srs().srsid()
    i get 2992
 12 Close and re-open QGIS
 13 Open the project again and type the following into python console:

 def getVectorLayerByName(myName):
   mc = iface.getMapCanvas()
   nLayers = mc.layerCount()
   for l in range(nLayers):
     layer = mc.getZpos(l)
     if str(layer.name()) == str(myName):
       vlayer = QgsVectorLayer(str(layer.source()),  str(myName),
 str(layer.getDataProvider().name()))
       if vlayer.isValid():
         return vlayer

 regionLayer = getVectorLayerByName("boundaryPolygons_004")

 regionLayer.srs().srsid()

 i get 3344

 now type iface.activeLayer().srs().srsid()

 i get 2992

 I think this might be something to do with changing the SRS in properties
 only being saved in the workspace and not in the layer itself.  If I then
 save the shape file as a different layer...

 (right click layer, save as...)

 Add the layer and then in the console:

 >>> regionLayer = getVectorLayerByName("boundaryPolygons_005")
 >>> regionLayer.srs().srsid()
 2992
 >>> iface.activeLayer().srs().srsid()
 2992

 Then it's working consistently.

 Please bear with me as I'm new to QGIS!

 Hopefully you can re-produce this now at your end.  Please let me know if
 for some reason you can't see the layer I attached.

 Regards,

 Vince

-- 
Ticket URL: <https://trac.osgeo.org/qgis/ticket/1339#comment:2>
Quantum GIS <http://qgis.org>
Quantum GIS is an Open Source GIS viewer/editor supporting OGR, PostGIS, and GRASS formats


More information about the QGIS-trac mailing list