2

I add an empty vector layer using the following script.

layer =  QgsVectorLayer('LineString', 'MyLayer' , 'memory')
QgsMapLayerRegistry.instance().addMapLayers([layer])

After I run the script, "Coordinate Reference System selector" dialog appear. How can I get rid of this dialog? Or, is there a script that will close the dialog?

enter image description here

2 Answers 2

4

You can specify the CRS when you create your memory layer:

vl = QgsVectorLayer('LineString?crs=EPSG:2964', 'MyLayer' , 'memory')
1

Under Settings -> Options -> CRS you can specify what CRS a new layer should be given, if it can not be read from file.

Another choice would be to add the CRS to your layer with your script.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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