# How to combine more locations (GPS coordinates inside one city) with Google map?

I have a list of GPS coordinates.E.g.

GPSList = {{47.680800, 17.626446}, {47.681078, 17.627283}, {47.682759,
17.631810}};


I would like to crate a Google Map of the part of the city (Győr) with some signs. If I could do that, I could change simple red dots to discs or bars showing data.

Show[CountryData["Hungary", {"Shape", "Equirectangular"}],
Axes -> True,
Epilog -> {PointSize[0.01], Red, Point[Reverse /@ GPSList]}]


The resolution of that is not enough.

-
Have you seen this? – gpap Apr 22 '14 at 10:58
And this or this? – Öskå Apr 22 '14 at 11:10
Version 10 will have this built-in. – Sjoerd C. de Vries Apr 22 '14 at 11:38
I think the question needs to be formulated a bit more clearly and in more detail before a solid answer can be given. It sounds like you want to create (typo?) a GoogleMap using Mathematica? If so, this question is certainly not a duplicate nor does it represent functionality present in V10. Do you have an example? Perhaps, a pointer to the type of map you would like to create? – Mark McClure Apr 22 '14 at 13:08
Locations are inside one city, some 100 m far from each other. They are sampling points. Technically I could do printscreen on GoogleMap (appropriate part of the city), than paint the sites on it. But it would be nicer to generate it. I could use it for any field research when I use GPS device e.g. marking of presence of a particular species. Using some Mathematica generated marker instead of Google’s drop would be better, because I could resize it (e.g., proportional to abundance). – Vica Apr 22 '14 at 19:43

I guess you're hoping to take data produced by Mathematica via commands like CountryData and CityData and display that data on a map of some type. From your question, it's honestly not totally clear if you'd prefer an in notebook solution or a completely separate Google Map but both are possible.

### A static map in notebook

In order to display your points as markers on a map contained right in the notebook, we can use Google's static map API. To do so, we simply construct a URL with query string based on your data and Import the result.

GPSList = {{47.680800, 17.626446}, {47.681078, 17.627283}, {47.682759, 17.631810}};
markerString[{lat_, lng_}] := "&markers=" <> ToString[lat] <> "," <> ToString[lng];
url = StringJoin[Flatten[{
markerString /@ GPSList}]]
Import[url]



Quite a lot more could be done with this but, mostly, this involves the static map API, as opposed to Mathematica. Also, as Sjoerd points out, the publicly available Wolfram Language documentation indicates that V10 will have some functionality very similar to this.

Alternatively, you might want to export your data to an entirely separate Google Map using HTML and Javascript. This is a bit more complicated but still quite doable. Here's a relatively simple approach to this. Note that template, which incorporates a fair amount of HTML and Javascript that's rather irrelevant to the Mathematica side, is defined below.

coords = Map[CityData[#, "Coordinates"] &,
{"Asheville", "Atlanta", "Charlotte", "Knoxville"}];
{{s, n}, {w, e}} = {Min[#], Max[#]} & /@ Transpose[coords];
marker[{lat_, lng_}] := StringJoin[
ToString[lat], ", ", ToString[lng], "),
map: map}
);"];
markers = StringJoin[marker /@ coords];
mapHTML = StringReplace[template,
{"(*N*)" -> ToString[n], "(*S*)" -> ToString[s],
"(*E*)" -> ToString[e], "(*W*)" -> ToString[w],
"(*MARKERS*)" -> markers}];
Export["map.html", mapHTML, "Text"]


This should create a file called map.html in your current working directory. If you open it in a web browser, you should see something like so:

Of course, to display this on the web, you'll need a Google Maps API key, but you can open the local file and check it out right away.

Here's the definition of template:

template = "<!DOCTYPE html>
<html>
<meta name='viewport' content='initial-scale=1.0, user-scalable=no' />
<style type='text/css'>
html { height: 100% }
body { height: 100%; margin: 0; padding: 0 }
#map-canvas { height: 100% }
</style>
<script type='text/javascript'
</script>
<script type='text/javascript'>
function initialize() {
var sw = new google.maps.LatLng((*S*), (*W*));
var ne = new google.maps.LatLng((*N*), (*E*));(*MARKERS*)
var bounds = new google.maps.LatLngBounds(sw, ne);
map.fitBounds(bounds);
}