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
389 stars 105 forks source link

How to deal with a xmap file ? #1435

Open perwhite opened 4 years ago

perwhite commented 4 years ago

Hey, i am a computer science student and i am working on a python project. I would like to make a kind of pathfinding algorithm from an orienteering map. So, my main problem now is how to get data from the map file. There is a lot of things in xml(xmap?) and i don't how to deal with and what is the data I only need. Any advice is appreciated, thanks.

mpickering commented 4 years ago

You can export shapefiles which you can the load into standard tools such as QGIS to perform your analysis. That was added in this PR https://github.com/OpenOrienteering/mapper/pull/1068

ghost commented 4 years ago

You can export shapefiles

@perwhite You could export your map in various format supported by GDAL

  1. Open your map, check if map is georeferenced; if not - do it firstly 1.1. https://www.openorienteering.org/mapper-manual/pages/georeferencing.html
  2. In Mapper menu go to "File > Export as... > Geospatial vector data";
  3. In opened file dialog input name for resulted file with needed file extension (it depend on expected output format: OpenStreetMap XML - *.osm; ESRI Shapefile - *.shp; etc.) 3.1. http://www.gdal.org/ogr_formats.html
  4. Click Save.

After that try process resulted file in QGIS or any other.

I am working on a Python project

FTR, As Mapper *.xmap/*.omap files in some way similar to OpenStreetMap XML, as start point you could try to modify exists Python parsers for *.osm to parse *.xmap.

puzzlepaint commented 4 years ago

I'd also consider the following approach: First, modify the symbol set of the file to assign a specific color to all passable features, and another color to all impassable features (or optionally more colors for different levels of runabiliy). Then export the map as a raster image (ideally without anti-aliasing). This allows to perform the pathfinding on the resulting image, where each pixel's color indicates whether that pixel is passable or not. This format might be easier to handle than vector data.

ghost commented 4 years ago

First, modify the symbol set of the file to assign a specific color to all passable features, and another color to all impassable features (or optionally more colors for different levels of runabiliy)

Think, it would be better to create such symbol set separately & create CRT-rules for converting.

perwhite commented 4 years ago

Thanks for your replies. As converting data is not the purpose of my project, I think I'm just going to use an exported image with colors proportional to runability as @puzzlepaint said. And dealing with vector data seems to be too complicated for me.

mpickering commented 4 years ago

If you are serious about the project then using a raster is not a good way to go. "converting data" is all that programming is about and you will save a lot of time using the vector layers in the long run.

puzzlepaint commented 4 years ago

Why do you think that vector layers would save time in the long run? I don't see how this would be the case for pathfinding as an application. And it doesn't seem reasonable to me to potentially spend lots of time on interpreting and pre-processing the vector data just to get suitable input data for pathfinding, if an image export allows to start with the actual task almost immediately.

jmacura commented 4 years ago

I am just pinging @kolovsky, because I remember he was working on a very similar task some time ago. If you are serious about the project @perwhite , I believe you should talk to him (not in this issue thread though).