Google Maps URL Tile Server API and Documentation? - google-maps-api-3

I would like to use Google Maps tiles for maps inside of my Wolfram Language projects. There are currently 18 Google Maps APIs and I think I need the Static Maps API. However, this API appears to return whole maps instead of individual tiles.
Which API do I need for use as a URL tile server for the GeoServer option in the Wolfram Language Maps & Cartography functions? Also, where is there official documentation of the URL tile server in Google's documentation?
Update
From #ChrisDegnen answer below I think the Static Map API is the only option. However. I wanted to use the map as a background to the existing Maps & Cartography functions in the Wolfram Language. Unfortunately, the Static Map API does not allow explicit specification of the lat-long boundaries so it is not a good fit.
For example to map the continental USA using the "visible" parameter to set the map bounds.
visible =
StringReplace["\n" -> "|"]#
ExportString[
Flatten[Outer[List, Sequence ## GeoBounds[Entity["Country", "UnitedStates"]]], 1],
"CSV"]
"25.1246466,-124.733151|25.1246466,-66.949806|49.3844900814454,-124.733151|49.3844900814454,-66.949806|"
The Static Map API returns this map (my personal key having been removed).
URLExecute["http://maps.googleapis.com/maps/api/staticmap",
{
"size" -> "600x300",
"visible" -> visible,
"key"-> "mykey"
}
]
The Static Map API adds far too much padding when compared to the default GeoGraphics map.
GeoGraphics[{Entity["Country", "UnitedStates"]},
ImageSize -> {600, 300}]
This extra padding will throw off anything I add to the map in my code. So in the end I can't use the Google maps.

The Mathematica documentation demonstrates use of the Static Maps API, if that's any help.
https://www.wolfram.com/mathematica/new-in-10/url-manipulation/call-urls-like-functions.html
URLExecute[
"http://maps.googleapis.com/maps/api/staticmap",
{"center" -> "Brooklyn Bridge,New York,NY",
"zoom" -> "13", "size" -> "600x300"}, "Method" -> "GET"]

Related

Assets are hiding under the map for Terrain with Labels with ArcGIS Runtime maps Xamarin.Forms

Assets are hiding under the map for Terrain with Labels basemap.It is not happening with other basemaptypes like Streetvector. ArcGIS Runtime 100.13.0 and Xamarin.Forms 5.0.0.2337 used.please help to solve the issue.
myMap.Basemap = Basemap.CreateTerrainWithLabelsVector();
myMap.OperationalLayers.Add(publicLayer);
featureLayer = new FeatureLayer(featureLayer);
await _featureLayer.LoadAsync();
myMap.OperationalLayers.Add(_featureLayer);
MyMapView.Map = myMap;
Thanks for reporting this. Turns out there is a bug in the Runtime SDK to do with this basemap when created from the Basemap static factory method which we'll address in the next release.
UPDATE: The 100.14.1 patch that was released today should address this.
You could adopt the Basemap Styles Enum and constructor, which uses metered basemaps and requires an API Key or other authentication, or you could create the basemap from a Portal Item (this is the Portal Item for the Terrain with Labels web map).

How to export here maps to image file for printing programmatically?

Just like leaflet and Arcgis JS Api have support for printing and exporting map to image files, how to do it in here maps? I explored here API and searched web but found nothing.
You have to take a look at our Map Image REST API.
https://developer.here.com/documentation/map-image/topics/what-is.html
What Is the Map Image API?
The HERE Map Image API is a REST API that allows you to request static map images for all regions in the world. The map images show conventional map views, but can also include points of interest, routes (for example, with turning points and junction views), statistics and heat maps.
In addition, the API offers a variety of supplementary services for displaying location-based data. For example, it is possible to present roadsigns.
You can also request the map images in different formats:
0 PNG
1 JPEG (default)
2 GIF
3 BMP
4 PNG8
-5 SVG (only for companylogo)
If this is not given, JPEG is used as default.
Within JavaScript, you can configure a MapTileService to request tiles of the map.
https://developer.here.com/documentation/maps/topics_api/h-service-maptileservice.html
There is a capturing functionality in HERE javascript API.
I made a quick draft how you can easily export the captured canvas element of the map with anything rendered on top of it:
// overlay element containing captured canvas element
var captureBackground = document.createElement('div'),
bgStyle = captureBackground.style;
bgStyle.width='100%';
bgStyle.position='absolute';
bgStyle.top='0';
bgStyle.bottom='0';
bgStyle.background='rgba(0,0,0,0.7)';
bgStyle.padding='30px';
bgStyle.zIndex=1000;
captureBackground.addEventListener('click', function(e) {
document.body.removeChild(this);
});
// capture the map:
map.capture(function(capturedCanvas) {
// remove previously added canvas from the overlay
captureBackground.innerHTML = '';
captureBackground.appendChild(capturedCanvas);
document.body.appendChild(captureBackground);
}, [], 50, 50, 700, 700);
For more information see https://developer.here.com/documentation/maps/topics_api/h-map.html#h-map__capture

Store Locator API + Geolocation

I am trying to create a Store Locator with the Google API, very similar to the one in the Google examples here:
http://storelocator.googlecode.com/git/examples/panel.html
However I've hit a wall trying to get the Store Locator API to get the user's position through Geolocation, so when I click on Get Direction in the infowindow I get directions to the user position; instead of having to type my address in the: Where are you? Panel box.
In the documentation what I have seen is that geolocation is a boolean in the View Option that is set to True by default. But this does not solve my problem.
Does anyone have any idea on how to do this?
seems that the googlecode page you said is no longer exist. So I can't give any further insight about what you want to make.
However, by your description, Luckily I made similar site few months ago. It is on Grocery Store Near Me .
The concept of Geolocation is an HTML5 (actually W3C) Geolocation API which is now already embed in most modern browser. It is an API which you can obtain user's location (latitude, longitude, altitude, and accuracy).
you can call it with simply
navigator.geolocation.getCurrentPosition(success, error, geo_options);
Success and error is a callback function in which you can define.
In my case, the function looks like these
function success(position) {
var latitude = position.coords.latitude;
var longitude = position.coords.longitude;
// use the lat and long to call function to fetch an API through AJAX
fetchStoreData(latitude, longitude);
}
In the Store Locator schema (like mine in Grocery Store Near Me), Geolocation is used to obtains user lat and long. The lat and long, then send to server via AJAX to get data about nearby store location.
The server serve an API in which accept lat and long as parameter, then fetch the store data (either using database, or other external API like foursquare), then you can display it either on list, or on a maps.

Using Google API v3 - administrative_area_level_2 tag

I'm using HTML to display a map area with a number of points/markers in it.
I use this function to 'pan' / move the map to see a specific place (list of places on the side of my web page).
function animate(lati,long) {
var latLng = new google.maps.LatLng(lati, long); //Makes a latlng
map.panTo(latLng); //Make map global
}
QUERY :- I've found in this website, a Google tag called "administrative_area_level_2"
https://developers.google.com/maps/documentation/geocoding/
From what i gather - this tag tells Google maps / API services to display the COUNTY area / borders (in USA at least & other countries).
However, when looking at maps.google.com & finding a USA county - the HTML source code is so confusing / jumbled.
Has anyone used this administrative_area_level_2 tag before to show a county border ? & are there any tutorials / examples of how to use it ?
Or is this tag something completely different ?
(Some of my markers are counties - but others are towns / cities).
From what i gather - this tag tells Google maps / API services to display the COUNTY area / borders (in USA at least & other countries)
This "tag" tells Google maps when used inside a request, that the response should be filtered to this component.
When returned within the response it tells you the type of the component .
This "tag" will not have any effect to the drawing of the map, and currently there isn't any implemented option to automatically draw any borders .

google map api v3 Weather information

How do we add the weather overlay option to a Google map, just like on Google my maps?
I've searched for it, but i can't find the answer.
Do i have to call a weather web service?
You can display the WeatherLayerdev-guide on your map by taking two steps:
First, load the WeatherLayer library by adding the libraries parameter to the URL you use to load the map:
<script type="text/javascript"
src="http://maps.googleapis.com/maps/api/js?libraries=weather&sensor=false">
</script>
Then, you must create an instance of the google.maps.weather.WeatherLayerapi-doc class, passing any options in a WeatherLayerOptionsapi-doc object, and attach the WeatherLayer to the map:
var weatherLayer = new google.maps.weather.WeatherLayer({
temperatureUnits: google.maps.weather.TemperatureUnit.FAHRENHEIT
});
weatherLayer.setMap(map);
In addition to the WeatherLayer, there is also a separate google.maps.weather.CloudLayerapi-doc class that you may create in a similar way:
var cloudLayer = new google.maps.weather.CloudLayer();
cloudLayer.setMap(map);
There is no separate library that you must load to use the CloudLayer; adding the libraries=weather parameter to the URL that loads the map makes both the WeatherLayer and the CloudLayer available on your map. There as a Google Maps JavaScript API v3 Example: Weather Layer, that shows the usage of both layers.
I have got same trouble when I tried to use Google map apiv3 with weather layer. But luckily, I found this site http://code.google.com/p/gmaps-samples-v3/ that provides all Google map api v3 samples and they are worked. Hope this help.
Cuong Vo

Resources