Add option map of google maps using gmaps.js

4

I would like to know how I could add one more option to the map of google maps link

For example, next to Satellite add another option that shows me another map (which I have customized). Seeing the doc I see that it can be with events, but they do not specify well how to do it.

    
asked by Kevin AB 10.07.2016 в 23:00
source

2 answers

1

On the very page you link, there is a section called " Map Types " (in the Utils section).

If you go there you will see an example of how you can add a new button (in your case pointing to a map of the same location but OpenStreetMaps):

map.addMapType("osm", {
  getTileUrl: function(coord, zoom) {
    return "https://a.tile.openstreetmap.org/" + zoom + "/" + coord.x + "/" + coord.y + ".png";
  },
  tileSize: new google.maps.Size(256, 256),
  name: "OpenStreetMap",
  maxZoom: 18
});

As explained on that page (my translation):

  

You can define many map types from external map services. [...] You must define a function called getTileUrl , that returns a URL of the box depending on the coordinates of the map.

    
answered by 03.08.2016 в 07:42
0

The simplest thing would be to go to the page where you have your examples examples And once you choose it, right click - > see source code, that's where the whole piece of code comes from. Greetings!

    
answered by 03.08.2016 в 07:30