Author Topic: Altitude from Google Earth API  (Read 14187 times)

0 Members and 1 Guest are viewing this topic.

VovKa

  • Water Moccasin
  • Posts: 1629
  • Ukraine
Re: Altitude from Google Earth API
« Reply #15 on: September 25, 2014, 04:39:09 AM »
I played around with the google api
actually my code does not use "google api". it works the same way as any browser. it downloads tiles and coverts their coordinates into you working projected CS
What are you using for a scaling factor to bring in the image at the correct size?
does this mean that images are inserted/scaled/rotated correctly? i'm asking because i had to write some new code to make it work in FL83-NF without any chance to test.

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Altitude from Google Earth API
« Reply #16 on: September 25, 2014, 10:52:53 AM »
I played around with the google api
actually my code does not use "google api". it works the same way as any browser. it downloads tiles and coverts their coordinates into you working projected CS
That's pretty cool, but aren't you using google maps to retrieve the data?


does this mean that images are inserted/scaled/rotated correctly? i'm asking because i had to write some new code to make it work in FL83-NF without any chance to test.
Your program recognized FL83-NF when I loaded it on my machine, but it didn't match the coordinates. I had the same problem when using a program to import geotagged images. I think it was using UTM. I abandoned it and started working on my own.

I'm getting them to insert 'close' to where they should be, but it appears to be more of a scale factor. I used a zoom factor of 15, scale of 2, and a size of 500x500. When I brought the image into autocad, I scaled it by multiplying the zoom times the size (* 15 500). It seems to work, but it felt like I was just making something up.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

VovKa

  • Water Moccasin
  • Posts: 1629
  • Ukraine
Re: Altitude from Google Earth API
« Reply #17 on: September 25, 2014, 03:37:13 PM »
That's pretty cool, but aren't you using google maps to retrieve the data?
yes i do
but i do not query http://maps.googleapis.com/maps/api/
i use browser like interface. for example https://mts0.google.com/vt/lyrs=m@275317119&x=70&y=106&z=8&s=Gali (for google) or http://ak.dynamic.t0.tiles.virtualearth.net/comp/ch/12030?it=G,VE,BX,L,LA&shading=hill&og=60&n=z (for bing)

when I loaded it on my machine, but it didn't match the coordinates.
if it's not a problem for you, can you please send me coordinates (FL83-NF) of any object that is clearly visible on google satellite images (building, pole, fence...). if it'd be a dwg file, save it please in acad2000 version.
i've never worked with Lambert projection before. so i could have made a mistake somewhere.

mailmaverick

  • Bull Frog
  • Posts: 493
Re: Altitude from Google Earth API
« Reply #18 on: September 26, 2014, 05:51:55 AM »
http://www.theswamp.org/index.php?topic=33065.msg385105#msg385105
Code: [Select]
(defun vk_GetGEarthElevation (lat lon)
  (atof
    (last
      (assoc "elevation"
     (last
       (assoc "result"
      (last
(assoc "ElevationResponse"
       (vk_ReadXML
(strcat "http://maps.googleapis.com/maps/api/elevation/xml?locations="
(rtos lat 2 16)
","
(rtos lon 2 16)
)
       )
)
      )
       )
     )
      )
    )
  )
)
;;;(vk_GetGEarthElevation 50.747778 25.324444)

Excellent !!!!
« Last Edit: September 26, 2014, 06:11:50 AM by mailmaverick »

mailmaverick

  • Bull Frog
  • Posts: 493
Re: Altitude from Google Earth API
« Reply #19 on: September 14, 2016, 03:46:55 AM »
Hi,

Vovka has given an excellent function to get Elevation of any point on Earth from Latitude and Longitude. My queries are :-

1.) What is the accuracy of these Elevations, is the +/- range specified anywhere by Google ?

2.) I ran this function to get elevation for 10-15 random points, and I got the results. Is this service by Google free even if I want elevations of 5000 points by use of Vovka's function ?

3.) I have an area which I can define in form of 4 coordinates / Latitude+Longitude (in form of a rectangle), can I get google earth image of these coordinates in AutoCAD ?

Thanks.


mailmaverick

  • Bull Frog
  • Posts: 493
Re: Altitude from Google Earth API
« Reply #21 on: September 14, 2016, 06:58:28 AM »
Thanks for your answer Vovka, but in the link provided by you, it says that Resolution is the maximum distance between data points from which the elevation was interpolated.

However, my question is about the accuracy of Elevation provided. Because I have heard (I may be wrong) that Google Earth forcefully creates some error and does not give accurate results due to strategic / defense purposes.


snownut2

  • Swamp Rat
  • Posts: 971
  • Bricscad 22 Ultimate
Re: Altitude from Google Earth API
« Reply #22 on: September 14, 2016, 07:11:38 AM »
Thanks for your answer Vovka, but in the link provided by you, it says that Resolution is the maximum distance between data points from which the elevation was interpolated.

However, my question is about the accuracy of Elevation provided. Because I have heard (I may be wrong) that Google Earth forcefully creates some error and does not give accurate results due to strategic / defense purposes.

Mailmaverick,
If you noticed the usage limits from the Google Map API are 512 points per request and 2,500 request per day for free.  Google also interprets the request per day to be spaced apart by some minimum time, so if they are two close together you will get booted. 

I have noticed that in heavily wooded areas the Google elevation accuracy suffers, I doubt this is a function of some built in mechanism.   

I have also found when comparing elevation data from the Google map api or from the national map query service (=http://nationalmap.gov/epqs/), the national map data is much closer to actual flown topography (at least in my area and must be in the US).

Currently the resolution of the national map service is 1/3 arc second, (or 3 meter pixels), by 2020 they are supposed to be going to 1/9 arc second (1 meter pixel size).  Meaning if you submit data for points closer then 3 meters apart they will return the same elevation. Google fixes this by interpolating from one pixel to the next so the same data is not returned for multiple points, sort of fooling the user to think its better data.  I've found that requesting national points closer than 50' results in a zigzag elevation data when contours are generated.  In a few years though this should be greatly improved with the 1/9 arc second mapping.
« Last Edit: September 14, 2016, 07:20:54 AM by snownut2 »

mailmaverick

  • Bull Frog
  • Posts: 493
Re: Altitude from Google Earth API
« Reply #23 on: September 14, 2016, 07:54:21 AM »
Thanks snownut, Vovka's function requests elevation of a single point. How to get elevation of 512 points in a single request ?


VovKa

  • Water Moccasin
  • Posts: 1629
  • Ukraine
Re: Altitude from Google Earth API
« Reply #24 on: September 14, 2016, 08:00:52 AM »
Code: [Select]
(defun vk_MAssoc (Key InList)
  (vl-remove-if-not
    (function (lambda (e) (equal Key (car e))))
    InList
  )
)
(defun vk_ConcatList (StrList Delimiter)
  (or Delimiter (setq Delimiter ""))
  (substr (apply 'strcat
(mapcar (function (lambda (s) (strcat Delimiter (vl-princ-to-string s))))
StrList
)
  )
  (1+ (strlen Delimiter))
  )
)
(defun vk_GE-GetElevations (lst / url)
;;;  https://developers.google.com/maps/documentation/elevation/intro
;;;  https://developers.google.com/maps/documentation/elevation/usage-limits
;;;  2,500 free requests per day, calculated as the sum of client-side and server-side queries.
;;;  512 locations per request.
;;;  50 requests per second, calculated as the sum of client-side and server-side queries.
  (setq url "http://maps.googleapis.com/maps/api/elevation/xml?locations=")
  (mapcar (function (lambda (e)
      (list (cons 'E (atof (last (assoc "elevation" (last e)))))
    (cons 'R (atof (last (assoc "resolution" (last e)))))
      )
    )
  )
  (vk_MAssoc "result"
     (last
       (assoc "ElevationResponse"
      (vk_ReadXML
(strcat url
(vk_ConcatList (mapcar (function (lambda (e) (strcat (rtos (car e) 2 8) "," (rtos (cadr e) 2 8))))
       lst
       )
       "|"
)
)
      )
       )
     )
  )
  )
)

mailmaverick

  • Bull Frog
  • Posts: 493
Re: Altitude from Google Earth API
« Reply #25 on: October 17, 2018, 11:03:26 AM »
Has anyone noticed that this routine no longer works to get Google Earth Elevations.
Any reason known so far ?

ronjonp

  • Needs a day job
  • Posts: 7527

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

VovKa

  • Water Moccasin
  • Posts: 1629
  • Ukraine
Re: Altitude from Google Earth API
« Reply #27 on: October 17, 2018, 11:38:04 AM »
Has anyone noticed that this routine no longer works to get Google Earth Elevations.
Any reason known so far ?
https://developers.google.com/maps/documentation/elevation/usage-and-billing

kirby

  • Newt
  • Posts: 127
Re: Altitude from Google Earth API
« Reply #28 on: October 17, 2018, 01:54:43 PM »
The Bing Maps API still offers free services, but you need to register for an access key (no keyless requests anymore).

How to get a key
https://msdn.microsoft.com/en-us/library/ff428642.aspx

Elevation API
https://msdn.microsoft.com/en-us/library/jj158961.aspx

kirby

  • Newt
  • Posts: 127
Re: Altitude from Google Earth API
« Reply #29 on: October 17, 2018, 02:02:29 PM »
Or you can grab NASA's SRTM data (Shuttle Radar Topography Mission) through USGS site

Newly available in 1 arc-second resolution for USA (approx. 30m grid at equator),
but only available in 1 arc-second resolution for the rest of the world  :-(

Read about it:
https://www2.jpl.nasa.gov/srtm/index.html

Get the data (STRM1 is 1 arc-second, STRM 3 is 3 arc-second):
https://dds.cr.usgs.gov/srtm/version2_1/

Better than nothing (but no good for small areas)