I want to create a web map on which only a selection of data from a layer is displayed. To the best of my knowledge the tool seems to output the full layer.

In Mapinfo I'd run a query to create a new table which would display only the selection of data I want. I've not done anything similar with QGIS - and I don't know if it would work if I did.

I realise I could pursue a non-elegant solution in the short term - extracting data from the layer and saving it as a new file... but there must be a more flexible/elegant way (because this layer would need to be updated each time the parent layer changed).

  • 1
    This is a good point to exported only selected features. I've created an issue for it and will implement it in one of the next releases! github.com/Geolicious/qgis2leaf/issues/176
    – Riccardo
    Dec 13 '14 at 9:17
  • 1
    Great! Can I briefly take the opportunity to say what an excellent tool this is. Personally I'm able to undertake this process by hand, but I have colleagues who may just be converted to QGIS by this (and of course I'll not need to do it by hand). Dec 15 '14 at 0:46

You can filter your features by right-clicking the layer and selecting "Filter...". There you can enter a string much like the WHERE clause in SQL.

The same feature is available on the "General" tab of the Layer Properties dialog, where it is labeled as "Feature subset".

You can combine filters using AND, e.g.

"fid" IN (1, 2, 3) AND
"street" ILIKE 'electric%' AND

These filters transfert into qgis2leaf and the resulting Leaflet layer only contains the selected features.

  • I was wondering about this. Is it possible to have more than one filter working at the same time (as would be possible with separate queries in Mapinfo)? More importantly, does this filtered dataset transfer into the leaflet map with qgis2leaf? Dec 13 '14 at 0:02
  • Yes, see my edits to the answer.
    – underdark
    Dec 13 '14 at 13:50
  • @user27285 Not sure how you intend to combine filters, but the typical SQL logical operators AND and OR are available. Also, you can add the same data source multiple times with different filters.
    – Scro
    Dec 13 '14 at 16:20
  • Thank you for these answers. Exactly what I wanted to know. Dec 15 '14 at 0:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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