Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin dont use the FILTER to the layer #12

Open
aperi2007 opened this issue Dec 29, 2015 · 2 comments
Open

Plugin dont use the FILTER to the layer #12

aperi2007 opened this issue Dec 29, 2015 · 2 comments

Comments

@aperi2007
Copy link

The new one plugin seem don't detect (or detect but don't use) the opzionally FILTER setting at layer level.

img-1

img-2

The exported mapfile don't show any filter setting.

I'll try to patch in my fork.

@aperi2007
Copy link
Author

I see in the plugin code, the FILTER is supported only for the POSTGRES dataprovider,
my test are all using the spatialite. The spatialite qgis dataprovider allow a filter like the postgres, but the plugin code ignore it.

@aperi2007
Copy link
Author

Resolved.
The solution is more simply rather than I guess.
The postgres code in the plugin was a good sample of what need to do.
:)

In the file "MapfileExporter.py" around the line 353 change this block of code:

-------
        elif layer.providerType() == 'spatialite':
            msLayer.setConnectionType(mapscript.MS_OGR, '')
            uri = QgsDataSourceURI(layer.source())
            msLayer.connection = toUTF8(uri.database())
            msLayer.data = toUTF8(uri.table())
-------

with this other block of code:

------
        elif layer.providerType() == 'spatialite':
            msLayer.setConnectionType(mapscript.MS_OGR, '')
            uri = QgsDataSourceURI(layer.source())
            msLayer.connection = toUTF8(uri.database())
            
            if uri.sql() != '':
                tempString = 'NATIVE_FILTER=(%s)' % str(uri.sql())
                msLayer.addProcessing( tempString )
            
            msLayer.data = toUTF8(uri.table())
------

The new code for the FILTER in a spatialite provider use a new sintax added to mapserver in the last released version.

Unfortunatelly I was not able to produce a PULL for github.
My customized version of the plugin has too many changes in it, and I'm not sufficient skilled on github to manage all this differences.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant