public int elevationAt(float lat,float lon){
  if (frame_is_valid == true) {
    if (lat >= dsi.sw_lat && lat <= dsi.ne_lat && lon >= dsi.sw_lon && lon <= dsi.ne_lon) {
      int lat_index=Math.round((lat - dsi.sw_lat) * 36000 / uhl.lat_post_interval);
      int lon_index=Math.round((lon - dsi.sw_lon) * 36000 / uhl.lon_post_interval);
      if (elevations[lon_index] == null)       readDataRecord(lon_index);
      return (int)elevations[lon_index][lat_index];
    }
  }
  return -32767;
}

public int elevationAt ( float lat , float lon ) { if ( frame_is_valid == true ) { if ( lat >= dsi . sw_lat && lat <= dsi . ne_lat && lon >= dsi . sw_lon && lon <= dsi . ne_lon ) { int lat_index = Math . round ( ( lat - dsi . sw_lat ) * 36000 / uhl . lat_post_interval ) ; int lon_index = Math . round ( ( lon - dsi . sw_lon ) * 36000 / uhl . lon_post_interval ) ; if ( elevations [ lon_index ] == null ) readDataRecord ( lon_index ) ; return ( int ) elevations [ lon_index ] [ lat_index ] ; } } return - 32767 ; }
the elevation at the closest sw post to the given lat / lon . this is just a go - to - the - closest - post solution .
