Search code examples
openstreetmapopenscenegraph

Use osgearth_package to download OpenStreetMaps Washington DC


I am attempting to download and convert OpenStreetMap data of the Washington DC area using osgEarth.

I am using the openstreetmap_flat.earth example from osgEarth.

<map name="OpenStreetMap" type="projected" version="2">

<options>
    <profile>spherical-mercator</profile>
    <lighting>false</lighting>
    <terrain engine="quadtree" range_mode="PIXEL_SIZE_ON_SCREEN" tile_pixel_size="256"/>
</options>

<image name="osm" driver="xyz">
    <url>http://[abc].tile.openstreetmap.org/{z}/{x}/{y}.png</url>
    <profile>spherical-mercator</profile>
    <cache_policy usage="none"/>
</image>

</map>

My bounding box for the DC area is SW(-77.0518, 38.8414) NE(-76.9488, 38.9589)

I'm using osgearth_package with the following command line options to perform my download. The goal is to get 19 levels of detail of the DC area. I believe I'm entering the coordinates in as UTM but I could be miserably wrong.

osgearth_package --tms ../openstreetmap_flat.earth --out c:/osgearth/ --out-earth osm.earth --max-level 19 --verbose --bounds -8564949.622936 4698767.775034 -8587714.346282 4698703.947754

The output isn't quite right. I'm getting parts of south america, and africa. Also, while I do get higher level of detail from the DC area, it's nowhere near 19 levels. It's more like 5 levels.

I'm expecting only the DC area to show up on my map with 19 levels of detail, nothing else.

Am I doing something wrong? Any suggestions?


Solution

  • I think your problem is spherical Mercator vs UTM. The docs for osgearth_package http://docs.osgearth.org/en/latest/user/tools.html#osgearth-package

    say --bounds xmin ymin xmax ymax bounds to package (in map coordinates; default=entire map) You can provide multiple bounds

    So, I think your bounds coordinates need to be in spherical Mercator, not in UTM.