Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing elevation data for specific routes #137

Closed
nrenner opened this issue Jan 3, 2019 · 2 comments
Closed

Missing elevation data for specific routes #137

nrenner opened this issue Jan 3, 2019 · 2 comments

Comments

@nrenner
Copy link
Contributor

nrenner commented Jan 3, 2019

Reported in nrenner/brouter-web#147 by @MichaelK92.

http://brouter.de/brouter-web/#map=17/44.44707/15.18322/OpenStreetMap&lonlats=15.183293,44.447082|15.181603,44.448656

    "coordinates": [
      [15.183296, 44.447090],
      [15.183191, 44.447111],
      [15.183030, 44.447200],
      [15.182328, 44.447885],
      [15.181645, 44.448615, 37.5],
      [15.181602, 44.448655, 37.5]
    ]

Moving the start point past the previous node in the curve, some elevation data is filled in:
http://brouter.de/brouter-web/#map=17/44.44707/15.18322/OpenStreetMap&lonlats=15.18339,44.447082|15.181603,44.448656

    "coordinates": [
      [15.183390, 44.447079, 27.0],
      [15.183354, 44.447079, 27.5],
      [15.183191, 44.447111, 27.5],
      [15.183030, 44.447200, 27.5],
      [15.182328, 44.447885, 27.5],
      [15.181645, 44.448615, 37.5],
      [15.181602, 44.448655, 37.5]
    ]

Ways:
https://www.openstreetmap.org/way/253261970
https://www.openstreetmap.org/way/253354195

@bagage
Copy link
Contributor

bagage commented May 8, 2019

@nrenner
Copy link
Contributor Author

nrenner commented May 30, 2019

Out of interest I took a closer look at the elevation data for those cases (GeoTIFF from http://srtm.csi.cgiar.org/srtmdata/, converted to BIL format, and to ASCII for debugging with MapcreatorTest.java):

Coastal road, Rudelić-Draga

http://brouter.de/brouter-web/#map=18/44.44725/15.18269/osm-mapnik-german_style&lonlats=15.181603,44.448656;15.183572,44.447143

Screenshot Leaflet-raw-DEM - Rudelić-Draga

Screenshot leaflet-raw-dem srtm_40_04_bil.zip

The red cells are voids (no data), the CGIAR CSI SRTM has shorelines cut out (FAQ).

BRouter interpolates height within a block of four cells, if one of these cells has no data, the elevation of the node is also set to no data:

31  54    
11  30    30  56
          nd  27    27  40    40  25
= 37.5              nd  16    16  11
          = n/d          
                    = n/d     = 27.5
                      

double eval = (1.-wrow)*(1.-wcol)*get(row ,col )
+ ( wrow)*(1.-wcol)*get(row+1,col )
+ (1.-wrow)*( wcol)*get(row ,col+1)
+ ( wrow)*( wcol)*get(row+1,col+1);
// System.out.println( "eval=" + eval );
return missingData ? Short.MIN_VALUE : (short)(eval*4);
}
private short get( int r, int c )
{
short e = eval_array[ (nrows-1-r)*ncols + c ];
if ( e == Short.MIN_VALUE ) missingData = true;
return e;
}

Ferry, Bremerhaven

http://brouter.de/brouter-web/#map=12/53.5235/8.5707/osm-mapnik-german_style&lonlats=8.584442,53.538267;8.565903,53.529595;8.545475,53.520411

Screenshot Leaflet-raw-DEM - Bremerhaven

Screenshot leaflet-raw-dem srtm_38_02_bil.zip

The shoreline with no data reaches into the river mouth where the ferry crosses.

Bridge, Saint-Vallier

https://brouter.damsy.net/latest/#map=15/45.1781/4.8188/standard&lonlats=4.814286,45.18863;4.811883,45.184122;4.814329,45.180613

The river has elevation data (srtm_37_03_bil.zip), but BRouter is removing elevation from bridges and tunnels, in order to interpolate between start and end elevation:

public short getSElev()
{
// if all bridge or all tunnel, elevation=no-data
return ( bits & NO_BRIDGE_BIT ) == 0 || ( bits & NO_TUNNEL_BIT ) == 0 ? Short.MIN_VALUE : selev;
}

This just doesn't work if a route point as start of a segment is on the bridge.

So this is generally working as designed and these exceptional cases are probably hard to improve, therefore closing.

edit: fix interpolation blocks layout, last block no vertical offset

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants