Jump to content

Pyrogenesis, Atlas and OpenStreetMap


Sturm
 Share

Recommended Posts

Hello guys. Just thinking around here ... What is the level of technical difficulties of using Pyrogenesis, Atlas and/or tools like YAMG to auto-generate a 3D render of OpenStreetMap (OSM) maps? Something like CityGen 3D, for example.  FlightGear, an open-source flight simulator is able to use OSM data to build scenery; the same for SuperTuxKart, X-Plane and the freewebcar chung  game.

Edited by Sturm
Link to comment
Share on other sites

The map Elephantine is using OpenStreetMap data to create the shape of the river and island.

It was not only a fancy proof of concept, but necessary, because all available heightmap data was way too imprecise to capture any shape of the island at all.

/**
 * Heightmap image source:
 * OpenStreetMap, available under Open Database Licence, www.openstreetmap.org/copyright
 * https://download.geofabrik.de/africa.html
 *
 * To reproduce the river image:
 * You need a gdal version that supports osm, see https://www.gdal.org/drv_osm.html
 * wget https://download.geofabrik.de/africa/egypt-latest.osm.pbf
 * lon=32.89; lat=24.09175; width=0.025;
 * lat1=$(bc <<< ";scale=5;$lat-$width/2"); lon1=$(bc <<< ";scale=5;$lon+$width/2"); lat2=$(bc <<< ";scale=5;$lat+$width/2"); lon2=$(bc <<< ";scale=5;$lon-$width/2")
 * rm elephantine.geojson; ogr2ogr -f GeoJSON elephantine.geojson -clipdst $lon1 $lat1 $lon2 $lat2 egypt-latest.osm.pbf -sql 'select * from multipolygons where natural="water"'
 * gdal_rasterize -burn 10 -ts 512 512 elephantine.geojson elephantine.tif
 * convert elephantine.tif -threshold 50% -negate elephantine.png
 *
 * No further changes should be applied to the image to keep it easily interchangeable.
 */

 

  • Like 3
Link to comment
Share on other sites

Notice that the data displayed on opentopomap are (1) elevation data, probably a derive of the old SRTM NASA data, and (2) polygons for that island. I think (2) is exactly the OpenStreetMap data, and especially not part of the heightmap. So yes, I think exactly what you're seeing there is the same data used on the map.

Notice that the implementation of Elephantine was done by converting that to a heightmap image. I recall spending one or more days trying to load the polygon as JSON, but failed for some very specific reason. Should be mentioned in the IRC logs of the time before Elephantine was committed, I don't remember exactly what it was. Selection of which shapes one wants is one challenge, because OSM provides a lot of information one doesn't want to add to the elevation map (streets for instance), and the polygon needs to be filled, so one would need an additional algorithm for that (flood fill). Coordinate transformations can also be annoying. (But there was some other specific complication that took me like 10 hours to discover, I don't recall.)

These commandline tools are very important, it allows one to generate a heightmap at an arbitrary geocoordinate and arbitrary zoom level. I remember that I needed something like 10-20 tries to find the coordinates and zoom levels so that the terrain shapes one had looked for become recognizable. Then 10-20 coordinate / zoom trial and error modifications to center the map perfectly for artistic and balancing aspects. But if one takes a screenshot from a map browser, edits it in gimp, one has one try. Chances are it might not be ideal. Then the entire map created in Atlas is stuck to that error forever. But if there is code to place the entities and actors, you just need to press 4 buttons to do the entire map all over.

atlas_heightmap_grus_plan.jpg

(There is a terrain recentering patch on trac, but the lost area is replaced with a level plane instead of the heightmap data, and one can't change the zoom level)

  • Like 3
  • Haha 1
Link to comment
Share on other sites

  • 4 years later...

I would Like it to have an Openstreetmap integration in 0AD.

It would be nice If could use on OSM mapped castles and ruins they would be available as starting point in 0AD.

In such a Map an Import of rivers, forests and hills would be enough.

Link to comment
Share on other sites

21 hours ago, Mercos said:

I would Like it to have an Openstreetmap integration in 0AD.

It would be nice If could use on OSM mapped castles and ruins they would be available as starting point in 0AD.

In such a Map an Import of rivers, forests and hills would be enough.

You can already use json data in random maps see => https://github.com/0ad/0ad/blob/bbae4080acaf09e2716cde8027c7a3c2cd3eaff4/binaries/data/mods/public/maps/random/elephantine.js#L1

You can probably bind the tree data to existing assets (you won't be able to import actual geometry though)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...