How is defined the 0 level (sea level) in google maps elevation api? - google-elevation-api

How is defined the "0" level in google maps elevation api?
The sea is not precisely at 0, and not uniform around the globe, how does it define the sea level?

Geo location maps are based on the position on conventional "Datums" which are approximations of the earth geoid.
The one commonly used in most GPS mapping systems is WGS84, which is used for Google Earth.
The geoid surface is assumed to be "mean sea level", clearly this is an approximation, but is considered practically acceptable.
http://www.icsm.gov.au/mapping/datums1.html

Related

Creating a Dynamic Google Earth Web Link

I've been tasked with creating a Google Earth Web link programmatically when given coordinates. I have the street address as well, where I'd ideally like to drop a pin.
For example, I can get a link to the white house using its lat/lon at a distance of 150 meters like this:
https://earth.google.com/web/#38.8976633,-77.0365739,150d
If I search using the google earth web app I can generate a link with a pin, where a few of the parameters in the link change slightly:
https://earth.google.com/web/#38.8976763,-77.0365298,18.0497095a,800.41606338d,35y,0h,45t,0r/data=ChIaEAoIL20vMDgxc3EYAiABKAIoAg
Am I able to dynamically generate the data element, or whichever element creates the pin, at my desired location? I've also had trouble finding the correct distance d and elevation a parameters in my links.
As you found, you can generate links to specific views in the Google Earth web client by adding the correct parameters to the URL, including the latitude, longitude and altitude (a) of the view target, and the distance (d) of the camera from that target. Note that altitude and distance are both in meters, and altitude is above sea level, not above ground elevation. If you look at the a and d parameters that Earth puts in the URL as you fly around, often altitude will be the terrain (or builing-top) elevation at the target lat/lon, and the distance will be how far the camera is from that altitude. The other available parameters include heading (h) and roll (r).
So long as your tilt (t) remains zero, then altitude and distance should be interchangeable, or if both are >0, then they will be summed together for the final camera height above sea level. But if you add a tilt (zero degrees is looking straight down), then the altitude determines the elevation of the view target (above the lat & lon location), and the distance determines how far the camera is from that point. If you make d=0, then altitude will define both the view target and camera height above sea level. If you make a=0, then the distance will be from the lat,lon at sea level (even if that's underground).
Unfortunately there's no way to manually construct the data parameter, as it can contain many different things. To do that right would require an API, which Earth for Web currently does not provide. Hopefully that kind of functionality will come after Earth finishes its work to become cross-browser compatible via Web Assembly. Until then, there's not a way to add a point the map via just a URL.

Anything in Leaflet that is similar to isLocationOnEdge() from Google Maps?

Google Maps has the function isLocationOnEdge(point, polyline, tolerance) that takes a tolerance value in degrees and uses it to determine whether a point falls near a polyline.
Is there anything similar in Leaflet(or some plug-in) that does the same thing?
A handful library for such operation is Turf.
For your case, a simple approach would be to:
Create a polygon out of your polyline using turf.buffer with appropriate "tolerance" (Turf takes a distance at Earth surface, or degrees).
Check whether your point is within that polygon or not using turf.inside.
Unfortunately, turf.buffer is only an approximation, it does not takes geodesy into account… therefore for big tolerance you will have a deformed shape.
An exact method could be to:
Use instead turf.pointOnLine to find the nearest point of the polyline.
turf.distance to measure the distance between those 2 points, and compare with your tolerance (or even just Leaflet latLng.distanceTo, but you would have to convert GeoJSON points back to Leaflet LatLngs).

Framework for plotting latitude longitude in a map based on country, state and district depending on the zoom level

I need a framework which takes a set of latitude longitude points and plots on a world map, grouped by country having the count of points as a marker on each country. Grouping here is the count of latitude longitude points in a country.
And as I drill down into a country, the clustering should change to state based one. And the next level, to districts.
Leaflet marker cluster is something very similar to what I have asked for, but the grouping is based on proximity and it doesn't consider country or state boundaries. That is, they are not region aware.
Regionbound.com has tweaked in some code in the leaflet code for making it region aware,
Sample marker definition:
var marker1 = new L.marker([-37.8, 145], {regions: ["Asia-Pac", "Australia", "VIC", "Melbourne"]} );
But the sample code says, every latitude longitude must be defined along with some extra parameter containing place information.
I could get the place information using reverse geocoding, but reverse geocoding every latitude longitude is time consuming right.
Highmaps provided by Highcharts is one another solution, but there, every country has code which should be assigned a value[count of point coordinates belonging to that country].
But all I have is latitude longitude points, no country or state information.
Thus, I need something which takes only a set of latitude longitude and does clustering based on country, state, district depending on the zoom level.
You have 2 separate needs in your questions:
Map your lat/lng coordinates to appropriate administrative areas. E.g. through the reverse geocoding that you mention.
Display "clusters" on those administrative areas depending on zoom level.
As for point 1, you know that lat/lng points do not say by themselves which administrative area(s) they belong to. So "reverse geocoding every latitude longitude" is a mandatory step. Whether time consuming or not depends on the solution you choose to perform this operation.
If I understand correctly, you would like a "framework" that could do that automatically for you. But frameworks are usually data agnostic, and if they do not have data about boundaries of those administrative areas, they cannot help you.
You may rather look for "services" (like the Mapbox Geocoding API that you mention) or software that would already have such data. It is not time consuming if you can program the lookup (or perform "bulk" operations) and if you are not limited by the requests rate and your amount of points to map (which may be the case with Mapbox).
You could very well set up your own application to perform this mapping:
As for the dataset for administrative areas boundaries, you would probably be interested in links in this post: Are there any free administrative boundaries available as shapefiles? If your points are limited to a few countries, it will be easier for you to find the appropriate data source(s).
Once you have that data, many GIS software should be capable of mapping your lat/lng points to the areas they belong to. This would be mainly for a "one-shot" operation, if your set of points do not change much.
A "web-compatible" alternative would be for example to use Leaflet with point in polygon for Leaflet plugin. You would need your boundaries data converted to GeoJSON format first. Again, GIS software should be capable of doing so, or many online services as well (search for "convert geojson" for example).
A server-side solution would avoid having to manage the entire boundaries data through network and in client browser (if you need to perform the mapping dynamically). I am sure many GIS servers are capable of performing this operation, once they are fed with the boundaries data.
For point 2, once you have completed the above step, I think you would have many options available, including those you mention (RegionBound, Highmaps).
Even with standard mapping libraries (Leaflet, OpenLayers 3), you would just need to build your "clusters" (markers on administrative areas with a number saying how many points are in there), like you have to do with Highmaps anyway for example.
Computing the number of "clustered" point is as easy as filtering your points per area name / code. Then switch the clusters to the desired administrative level when the map zoom changes.
So the key is really to determine first to which areas your points belong to (point 1).
Then a small question would rise about where to place the "cluster" marker:
On centroid of the administrative area? You need the coordinates of that centroid from your data source, or a good algorithm to compute it from the boundaries (good luck on that…).
On "center" of the bounding box of the area? Leaflet can easily compute that: from your area vector shape, you would do myShape.getBounds().getCenter().
On barycentre / centroid of the clustered points? This is what Leaflet.markercluster and RegionBound do (do not know for Highmaps).
Good luck!

Get coordinates for highway kilometers in Germany

Is there a way to get LON / LAT coordinates for German highway kilometers? I am looking for a search-string in the Mapbox API
i.e.: Autobahn A5, Kilometer 214 ==> bab+5+km+213+DE
https://api.mapbox.com/v4/geocode/mapbox.places/bab+5+km+213+DE.json?access_token=TOKEN
General bypass assuming the use case for having km mark on highway is if it's associated with some interchange on it: Let's assume we don't have such ready for use easy web API. So we need to build our "reverse geocoder" from km mark on highway to it's lat/lon.
We always have from popular GIS API's (Google maps etc.) coordinates for Interchanges, and of course we can order them.
Key point: In order to drive between 2 adjacent Interchanges, any decent routing web service algorithm (Google maps directions etc.) will always direct you to drive on that highway. It's logical... (with param like "shortest route" in case live heavy traffic and it will try to redirect you).
What I suggest is:
Let the first Interchange of the highway to be 0 K.
Ask for directions to the second interchange -
You will get the distance - so you know what is the km mark for the second interchange.
And so on to cover the highway until the km point you need.

Highest Altitude with best terrain data

I have a program that uses the API to get altitude data of the screen by running through hundreds of thousands of latitude and longitude points. However, Google Earth's data refines itself as one zooms in. So I need to know the minimum altitude I can use to get the best data Google has to offer. I am at a loss to figure out how to do this.
Furthermore, I assume that this depends on the part of the world. I'm going to assume the best part of the world, always.
Thanks for any feedback.
There is no API for determining the quality of the underlying imagery. While this question is not an exact duplicate of Get ground altitude in a reliable way, the same general algorithm can be applied:
Zoom to the required lat/lon at altitude Z
Wait for the imagery to come in (as described in the linked question)
Zoom in "closer" (Z - [delta])
If Google has better imagery, the loaded percentage should drop, wait for it load
Repeat steps 3-4 until the progress is always ~100% (e.g., until no loading is required)
Even with this hack, I'm not sure it will yield reliable results. Your question is flawed for several reasons:
What does "the best data Google has to offer" mean?
You have a lat/lon coordinate. That's a single, infinitely small, point on the Earth
Raw satellite imagery typically covers large sections (many lat/lon points), so the "best" height would be to set the GE camera so that your view convers exactly one satellite image tile
Why do you need the "best" data?
Satellite imagery is expressed in terms of "area covered by a single pixel" (e.g., 1m = 1 pixel in the image covers 1sq m)
Knowing this, the camera height will vary image by image, even for tiles within the same satellite imagery data set (it shouldn't vary much -- but it could slightly.)
Are you trying to cache the imagery off the globe? If so, you should carefully review the TOS to make sure you're not in violation.
Note that if you are just looking to obtain satellite imagery -- there are many good (free) sources. USGS National Map Viewer should be able to get you pretty good imagery for the US (including territories).