OpenOrienteering / mapper

OpenOrienteering Mapper is a software for creating maps for the orienteering sport.
https://www.openorienteering.org/apps/mapper/
GNU General Public License v3.0
399 stars 106 forks source link

Enhancement: support selecting specific layers of shapefile #1124

Open mstahv opened 6 years ago

mstahv commented 6 years ago

With OCAD it is easy to import shapefiles that contains multiple symbols on separate layers, e.g. normal contours and index contours. One can select certain "layer" of the imported features and assign them to specific symbol.

In the screenshot below you can see a dialog from Ocad where certain features of Finland's open data shape files is being converted to contour.

screen shot 2018-08-17 at 18 46 27

Unless I have missed something, with mapper I currently have to pick objects one by one. I don't think the UI in Ocad is perfect or something to replicate, but importing could either have an option to put different layers to different symbol or just to import specific layers.

dg0yt commented 6 years ago

There is no such tool like that on the screen. But there are some other tools:

  1. Shape file layer names are imported to the "layer" tag of the objects. Use menu View > Tag Editor to make the tags visible. Cf. https://www.openorienteering.org/mapper-manual/pages/object_tags.html

  2. Menu Edit > Find... has a tool to search for objects. You may search for 2052100 or layer = "2052100" - with "Find all", they will be selected, and you can switch the symbol of the selected objects as usual. Cf. https://www.openorienteering.org/mapper-manual/pages/find_objects.html

  3. There is also menu Symbols > Load CRT file... which will lead to the symbol replacement dialog. So you can easily reuse frequent assignments, e.g.

    101    layer = 2052100
  4. Mapper may automatically load a CRT file on import, either based on the data file name, or based on the combination of import driver file name and symbol set ID. For example, we supply CRT files for OSM import in the symbol set folder. Cf. https://www.openorienteering.org/mapper-manual/pages/crt_files.html

ghost commented 6 years ago

There is no such tool like that on the screen.

That's why https://github.com/OpenOrienteering/mapper/issues/1121 created.

dg0yt commented 6 years ago

@Symbian9 Your comment doesn't help here. This issue here is about import of data, not display of templates. 1121 should have been left open anyway.

@mstahv Did the given alternatives help? We could improve the editing capabilites of the CRT/symbol replacement dialog, or add actions ("Replaces symbol" etc.) to the search dialog.

mstahv commented 6 years ago

Oh yes, a lot. I built this conversion table for converting the open data by National Land Survay of Finland to make a bare bones ISOM 2017 map of it. Roads, big water areas, buildings, fields and electric lines are usually accurate enough for real orienteering map. Used that to create a huge basis (two closest towns) for a MTB-O map.

For generic use (and maybe inclusion to the distribution) the CRT files would need to support wildcards or full regexp. The CRT is attached below, there is Buildings part with comments.

MAASTOTIETOKANTA-ISOM2017.crt.txt

Another improvement idea for using those files as a basis: Import dialog could allow selecting multiple files at once.

dg0yt commented 6 years ago

I considered adding regular expressions (it wouldn't need much extra code) but I wasn't sure how many people would use it. What would your preferred syntax look like?
a) layer = /Some.*patter/i (i.e. / as special token) b) layer =~ /Some.*patter/i (i.e. / as special token, and Perl-ish =~, which allows for negation, !~) c) ...

For now you can do something similar to wildcards with ~= expressions, and the order of the CRT file entries lets you start with general rules, and come to special cases (more complex rules) towards the end of the file.

mstahv commented 6 years ago

I'd probably go with b as it wouldn't accidentally harm those not familiar with regexp.

ghost commented 6 years ago

I considered adding regular expressions (it wouldn't need much extra code) but I wasn't sure how many people would use it.

+1. It would be cool if such feature could be added into Mapper.