filter to label countries only (and not all their islands)

Home Forums Natural Earth Map Data Cultural Vectors filter to label countries only (and not all their islands)

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #3640

    topoman
    Participant

    First of all, thank you very much for providing such wonderful geographical data!

     

    After quite a lot of trial and error, I managed to display in QGIS the countries included in shapefile “Admin 0 – Countries” on top of a raster map (Natural Earth 1). I need to label the countries with their name (field NAME), but the name is also displayed for all small islands belonging to the country, making for instance Norway shorelines littered with names! How can I filter the names so that small islands are not labelled? I couldn’t find any appropriate entry in the various fields provided (LabelRank, etc…) that I could use to define a filter.

     

    There surely must exist a simple solution to this problem!

     

    Thank you in advance for your help.

     

    #4396

    Nathaniel
    Keymaster

    If you have one of the newer QGIS, there is a new labeling tool in the toolbar with ABC at an angle over a blue line. Click that while your target layer is selected. This labeling engine is a lot smarter than the basic one available in the layer properties label tab.

    You can also download the “scale rank” version of the countries file which has some of what you’re looking for. Or just label using the 50m version of countries. You want to label based on the label rank or the scale rank.

    And make sure you’re not labeling all parts of a multipart feature.

    #4397

    topoman
    Participant

    I’m impressed by how quick you answered!

    Using this new labeling tool does indeed solve basically the problem!

    I would like to prevent the names on some islands to appear (some instance Jersey). Using the old labeling tool, I could filter with SCALERANK to do that, but I don’t see how to filter the output of the new labeling tool. Can we apply filters to it?

    As a workaround, I tried defining a new field “LABEL_SIZE” (=13 is scalerank=1 and 0 otherwise), but I didn’t manage to set the label font size to the value of this field, because this new field did not appear in the menu proposed in the label properties window. If you have any tip, I’ll appreciate!

    #4398

    Nathaniel
    Keymaster

    Under the layer’s normal property dialog, the general tab, query builder button. Make the filter selection.

    You’ll want to have 2 layers, one for drawying the shapes on the map. The other for just the labels.

    #4399

    topoman
    Participant

    It worked, thank you Nathaniel!

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.