Re: [OpenMap Users] Elevation data from ETOPO Layer

From: Don Dietrick <dfdietrick_at_gmail.com>
Date: Wed, 23 Jun 2010 14:26:32 -0400

Hello,

You're right, there's no API method provided for retrieving the elevation at a specific lat/lon for ETOPO data. You could extend the code to add a method that does the following:

double getElevation(double lat, double lon) {

               // check... dfd
               if (minuteSpacing == 2) {
                  lon += 180.;
               } else {
                  if (lon < 0.)
                     lon += 360.;
               }

               // find indicies
               int lat_idx = (int) ((90. - lat) * scy);
               int lon_idx = (int) (lon * scx);

               // offset
               int ofs = lon_idx + lat_idx * bufferWidth;

                double elevation = dataBuffer[ofs];
}

I'd add it myself, but I don't have time to test it right now, etc...

- Don


On Jun 21, 2010, at 12:58 PM, dph wrote:

>
> I am displaying the ETOPO-5 data. Does anyone know how to get the elevation
> for a given lat lon from an ETOPO Layer? It is trivial for DTED, but seems
> nigh impossible for an ETOPOLayer. Thanks in advance.
> --
> View this message in context: http://old.nabble.com/Elevation-data-from-ETOPO-Layer-tp28950982p28950982.html
> Sent from the OpenMap mailing list archive at Nabble.com.
>
> --
> [To unsubscribe to this list send an email to "majdart_at_bbn.com"
> with the following text in the BODY of the message "unsubscribe openmap-users"]

--
[To unsubscribe to this list send an email to "majdart_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Wed Jun 23 2010 - 14:27:12 EDT

This archive was generated by hypermail 2.3.0 : Tue Mar 28 2017 - 23:25:09 EDT