On Thu, Jan 6, 2011 at 9:16 PM, Chris Crook <[email protected]> wrote:
> Hi All
>
> I'm wanting to create a memory provider in Python without invoking the CRS 
> selection dialog (even if the QGIS settings are set to "Prompt for CRS when a 
> new layer is created".
>
> At the moment my code looks like:
>
>        settings = QSettings()
>        prjSetting = settings.value("/Projections/defaultBehaviour")
>        settings.setValue("/Projections/defaultBehaviour", QVariant(""))
>        layer = QgsVectorLayer("point",name,"memory")
>        if prjSetting:
>            settings.setValue("/Projections/defaultBehaviour",prjSetting)
>
> This does work, but it seems a bit cumbersome (at first glance it doesn't 
> even look like creating a vector layer!), so I'm wondering if there is a 
> cleaner approach..

Hi Chris

I agree this is cumbersome. A possible solution would be to extend the
URI for memory provider - currently it accepts only a string with
geometry type. New syntax could be introduced that would explicitly
set layer CRS, e.g. "geometry=point&crs=4326". Any thoughts and
patches are welcome.

Regards
Martin
_______________________________________________
Qgis-developer mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to