Verschlagwortet: 

Betrachte 15 Beiträge - 1 bis 15 (von insgesamt 15)
  • Autor
    Beiträge
  • #31428
    xarly89
    Teilnehmer

    Basically my question is if there are maps that only contain the contour data in it, instead of all other data. Or do I have to generate them myself using the process described here https://www.openandromaps.org/en/oam-forums/topic/reproducing-map-creation-process-2 ?

    Does anybody know if it is feasible to generate my own vector PBF data with the contour lines in it? To be used with other maps libraries. Basically I’m willing to take the effort that it takes to process the whole world, using the information I’ve see here https://www.openandromaps.org/en/oam-forums/topic/reproducing-map-creation-process-2 but instead of creating Mapsforge maps that include the contour data, I’d like to use osmosis to create the osm pbf file that has the contour data, and then convert it to MBTiles or PBF format to be used with the VTM library as an online source for contour.

    Thank you in advance!

    You have here a wonderful project, to be honest. It’s amazing how much information is described to use the maps as you provide them and to even generate them 🙂

    #31435
    Avatar-FotoChristianK
    Administrator

    Hi,

    If you want to create osm.pbf contourdata then
    phyghtmap is your friend.

    http://katze.tfiu.de/projects/phyghtmap/phyghtmap.1.html
    https://wiki.openstreetmap.org/wiki/Phyghtmap

    Here is the additional FREE LIDAR Dataset from @Sonny covering parts of Europe
    https://data.opendataportal.at/dataset/dtm-europe

    Well, its possible to create mapsforge maps with contourlines only, however I never did it.
    You just have to create the osm file and feed the mapsforge writer.
    If these maps are usefull depends weather the APP is able to render transparent Vector maps.

    Best regards
    Christian

    #31437
    xarly89
    Teilnehmer

    It’s indeed possible to display tiles with transparent background in VTM and Mapsforge. I already do for other tiles.

    Alright, so I only have to generate the OSM.PBF, and then generate the .map files with Osmosis. Sounds quite simple 🙂

    By the way, is it possible to not convert the maps in the OpenAndroMaps format (by not using the tag transformation) and still generate the .map files, with the same information as it’s in VTM maps, along with the contour lines? I’d rather stick to my current theme, which is based on the default VTM one. It’s a bit messy and tiring to fully convert it to be adapted to OpenAndroMaps.

    Basically, I want to stick with the VTM vector maps, but I need to generate them with the contour data. So I need to:

    1. – use phyghtmap for that (did some tests yesterday),
    2. – then I need to generate a OSM.PBF with that,
    3. – and then merge it along with the OSM.PBFs I have,
    4. – to finally be able to generate the Mapsforge vector maps that contain the contour data.

    That sounds logical and possible?

    #31499
    Avatar-FotoChristianK
    Administrator

    By the way, is it possible to not convert the maps in the OpenAndroMaps format (by not using the tag transformation)

    Of cause, but these maps are no longer compatible with OAM-Thems.

    – use phyghtmap for that (did some tests yesterday),
    – then I need to generate a OSM.PBF with that,
    – and then merge it along with the OSM.PBFs I have,
    – to finally be able to generate the Mapsforge vector maps that contain the contour data.
    That sounds logical and possible?

    Thats the way I do this.

    Best regards
    Christian

    #31509
    xarly89
    Teilnehmer

    Alright, I’ve got my first error here. I tried the whole process without simplifying ways, and while it produced quite decent results, there was an error I attribute to not simplifying ways (perhaps wrongly, we will see about that later).

    So now I’ve downloaded Osmos 0.39, which I understood is the version I need for simplifying ways. And I’ve got the following error:

    osmosis-0.39/bin/osmosis --read-xml /home/carlos/workspace/osmosis/catalonia_contours.osm --simplify-ways epsilonMeters=10 --wx catalonia_contours_smpld.osm
    d’oct. 03, 2019 11:12:22 A. M. org.openstreetmap.osmosis.core.Osmosis run
    INFO: Osmosis Version 0.39
    d’oct. 03, 2019 11:12:22 A. M. org.openstreetmap.osmosis.core.Osmosis run
    INFO: Preparing pipeline.
    d’oct. 03, 2019 11:12:22 A. M. org.openstreetmap.osmosis.core.Osmosis main
    SEVERE: Execution aborted.
    org.openstreetmap.osmosis.core.OsmosisRuntimeException: Task type simplify-ways doesn't exist.
    	at org.openstreetmap.osmosis.core.pipeline.common.TaskManagerFactoryRegister.getInstance(TaskManagerFactoryRegister.java:60)
    	at org.openstreetmap.osmosis.core.pipeline.common.Pipeline.buildTasks(Pipeline.java:50)
    	at org.openstreetmap.osmosis.core.pipeline.common.Pipeline.prepare(Pipeline.java:112)
    	at org.openstreetmap.osmosis.core.Osmosis.run(Osmosis.java:86)
    	at org.openstreetmap.osmosis.core.Osmosis.main(Osmosis.java:37)
    	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.base/java.lang.reflect.Method.invoke(Method.java:567)
    	at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:329)
    	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:239)
    	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
    	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
    	at org.codehaus.classworlds.Launcher.main(Launcher.java:31)

    The catalonia_contours.osm file, was produced by a long combination of merging all the OSM.PBF that I got with phyghtmap. And as I said earlier, this was enough for generating a map using the tag-transform and tag-mapping to generate the map from Catalonia including contours, that has been correctly (except one issue with contour lines being weirdly drawn in a given area of the map) styled and drawn on VTM with Elements theme.

    Why do I get the above error? I have downloaded Osmosis 0.39 from here: https://dev.openstreetmap.org/~bretth/osmosis-build/osmosis-0.39.zip

    #31511
    Avatar-FotoChristianK
    Administrator

    You need the plugin ##.jar and copy it to ../osmosis/lib/default
    Iv attached the plugin for you

    BTW, I use epsilonMeters=3

    #31518
    xarly89
    Teilnehmer

    Great! Downloaded and placed in that directory. Now the previous error went away, but a new one has appeared:

    osmosis-0.39/bin/osmosis --read-xml /home/carlos/workspace/osmosis/catalonia_contours.osm --simplify-ways epsilonMeters=3 --wx osmosis/catalonia_contours_smpld.osm
    d’oct. 03, 2019 12:37:35 P. M. org.openstreetmap.osmosis.core.Osmosis run
    INFO: Osmosis Version 0.39
    d’oct. 03, 2019 12:37:35 P. M. org.openstreetmap.osmosis.core.Osmosis run
    INFO: Preparing pipeline.
    d’oct. 03, 2019 12:37:35 P. M. org.openstreetmap.osmosis.core.Osmosis main
    SEVERE: Execution aborted.
    java.lang.NoClassDefFoundError: com/vividsolutions/jts/geom/Geometry
    	at de.vwistuttgart.openstreetmap.osmosis.simplifyways.v0_6.WaySimplifier.<init>(Unknown Source)
    	at de.vwistuttgart.openstreetmap.osmosis.simplifyways.v0_6.WaySimplifierFactory.createTaskManagerImpl(Unknown Source)
    	at org.openstreetmap.osmosis.core.pipeline.common.TaskManagerFactory.createTaskManager(TaskManagerFactory.java:60)
    	at org.openstreetmap.osmosis.core.pipeline.common.Pipeline.buildTasks(Pipeline.java:50)
    	at org.openstreetmap.osmosis.core.pipeline.common.Pipeline.prepare(Pipeline.java:112)
    	at org.openstreetmap.osmosis.core.Osmosis.run(Osmosis.java:86)
    	at org.openstreetmap.osmosis.core.Osmosis.main(Osmosis.java:37)
    	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.base/java.lang.reflect.Method.invoke(Method.java:567)
    	at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:329)
    	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:239)
    	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
    	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
    	at org.codehaus.classworlds.Launcher.main(Launcher.java:31)
    Caused by: java.lang.ClassNotFoundException: com.vividsolutions.jts.geom.Geometry
    	at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
    	at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
    	at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)
    	... 16 more

    It seems I’m missing the com/vividsolutions/jts/geom library, which it’s known to me, since I am using it in a few other projects for reading Geometries in GeoJson format.

    Is it as simple as downloading the com/vividsolutions/jts JAR and placing it in the same folder than the previous JAR? I’ve downloaded it from here: https://repo1.maven.org/maven2/com/vividsolutions/jts/1.13/

    And now when I run the command and it seems to have generated the simplified contours OSM file. Gonna try with the rest of the process 🙂

    1 Teilnehmer(n) gefällt dieser Beitrag
    #31520
    xarly89
    Teilnehmer

    Ok, so the generation of the .map with contours has finished, and I’ve been able to view the results using the VTM library. It has reduced, for the Catalonia map, 3MB the total size of the map, which is great. Basically the contours added about 25MB of space to the map file, which is totally affordable for what the hikers are going to get.

    However, there’s an issue I expected to be solved, but it seems it has absolutely nothing to do with the simplification of the contour lines. I have posted 2 screenshots, and as you can see in one of them the contour lines look just beautiful. And this is the case for most of the map. BUT, in the other screenshot, you can observe there’s a weird effect that makes contour lines from a far away place to be connected by a straight line. And it’s not only one line, there are many.

    Since the generation of the map is quite straightforward, I guess my problem will be in the generation of the contour lines, by incorrectly using phyghtmap. So here it’s what I used to achieve the contour lines:

    For Catalonia only:
    phyghtmap –polygon catalonia.poly -o catalonia –source=view3,srtm3 -j 12 –pbf

    For Spain:
    phyghtmap –polygon spain.poly -o spain –source=view3,srtm3 -j 12 –pbf

    By the way, this didn’t happen when I generated the contour lines of the whole Spain. Quite curiously :S

    #31551
    Avatar-FotoChristianK
    Administrator

    Hmmm,

    Add these parameters to phyghtmap

    --max-nodes-per-way=200 --start-node-id=10000000000 --start-way-id=10000000000

    #31566
    xarly89
    Teilnehmer

    That worked ChristianK 🙂 Thank you so much for the help and guidance.
    Will jump to the other post where we are talking about the issue with the simplification of ways and the elimination of the bounds node.

    1 Teilnehmer(n) gefällt dieser Beitrag
    #42638
    xarly89
    Teilnehmer

    Hey ChristianK I was wondering if you’d know by any chance how to add an elevation attribute on each of the lines that are generated with phyghtmap, but on the .pbf files. Prior to any extra processing.

    I’m reading them with QGIS Desktop, and cannot manage to see that attribute there. Although in the map generated to be use with VTM it’s clearly there.

    You can find an attached screenshot with what I mean of QGIS Desktop.

    Could it be that this app doesn’t show all the information? I doesn’t really seem to me that that’s the case due to all the info I can see there. So my only conclusion is that phyghtmap hasn’t added that information to the lines.

    By reading the tagmapping-urban.xml it should be the ele attribute. But it isn’t in the .osm.pbf coming from phyghtmap :S

    Thanks for reading it and any help is more than welcome!

    #42704
    Avatar-FotoChristianK
    Administrator

    Phyghtmap adds these keys

    		<tag k="ele" v="####"/>
    		<tag k="contour" v="elevation"/>
    		<tag k="contour_ext" v="elevation_minor|_MAJOR|_MEDIUM"/>
    
    
    <osm-tag key='contour_ext' value='elevation_major' force-polygon-line='true' zoom-appear='9' />
    <osm-tag key='contour_ext' value='elevation_medium' force-polygon-line='true' zoom-appear='10' />
    <osm-tag key='contour_ext' value='elevation_minor' force-polygon-line='true' zoom-appear='12' />
    <osm-tag key='ele' value='100' zoom-appear='15' />
    <osm-tag key='ele' value='150' zoom-appear='15' />
    <osm-tag key='ele' value='200' zoom-appear='15' />
    

    This is driven by the „-c“ param of Phyghtmap

    #42710
    xarly89
    Teilnehmer

    Alright, the problem wasn’t in Phyghtmap, but later with ogr2ogr.

    If someone finds this useful, the thing is that ogr2ogr, which can be used to convert an .osm.pbf file into GeoJson, for example, ignores the „ele“ attribute in the output file.

    Here more info:
    https://github.com/OSGeo/gdal/blob/master/gdal/data/osmconf.ini

    So basically, the „ele“ attribute has to be removed from the ignore list. In this case, for [lines] geometries.

    1 Teilnehmer(n) gefällt dieser Beitrag
    #44634
    thinknicethings
    Teilnehmer

    Hi,

    I tried to generate contours myself with phyghtmap according to this thread like this:

    phyghtmap \
        --area=6:44:9:47 --step=50 --feet --no-zero-contour \
        --srtm=1 --source=srtm1,view1 --write-timestamp \
        --void-range-max=-500 \
        --max-nodes-per-tile=0 --max-nodes-per-way=200 \
        --start-node-id=10000000000 --start-way-id=10000000000 \
        --pbf

    phyghtmap seems to run w/o errors and generates output of „reasonable size“ (e.g. some 275 MB pbf).

    After this I tried to convert the resuling pbf file with osmosis to a map file like this:

    osmosis --read-pbf file=pbf_file_from_phyghtmap.pbf --mapfile-writer file=out.map type=hd

    this again runs w/o errors but generates a tiny output file of about 130 k.
    If I view this output file in apps like oruxmaps it seems to contain nothing (which doesn’t surprise me as the file is tiny).

    Any ideas?

    #44636
    Avatar-FotoChristianK
    Administrator

    You need to include the tags for contour lines in the tag-mapping

    
    <osm-tag key='contour_ext' value='elevation_major' force-polygon-line='true' zoom-appear='9' />
    <osm-tag key='contour_ext' value='elevation_medium' force-polygon-line='true' zoom-appear='10' />
    <osm-tag key='contour_ext' value='elevation_minor' force-polygon-line='true' zoom-appear='12' />
    <osm-tag key='ele' value='100' zoom-appear='15' />
    <osm-tag key='ele' value='150' zoom-appear='15' />
    <osm-tag key='ele' value='200' zoom-appear='15' />
    
    usw....
    

    .. you have to modify this according to your settings in –step

Betrachte 15 Beiträge - 1 bis 15 (von insgesamt 15)
  • Sie müssen angemeldet sein, um zu diesem Thema eine Antwort verfassen zu können.