2

I generate a Google Map like the following:

lat_lng = new google.maps.LatLng(51.165691, 10.451526);
mapOptions = {
  zoom: 4,
  mapTypeId: google.maps.MapTypeId.ROADMAP,
  center: lat_lng,
}
map = new google.maps.Map(document.getElementById('map'), mapOptions);

also i got multiple markers that are dynamically added to the map. So as far as i know there is no way in my case to do it without the javascript API.

My Question is:

Is there any way to open that generated map (with all options and markers) in google maps? (https://www.google.com/maps/ ...)

... unfortunately it is not enough to just use the fullscreen functionality of maps!

Thanks in advance :)

FalcoB
  • 1,333
  • 10
  • 25
  • Possible duplicate: https://stackoverflow.com/questions/35400664/google-maps-multiple-markers-via-url-only – Blue Jan 19 '18 at 17:17
  • 1
    What are you trying to achieve? Why do you need it without the JS API? In what, opening it in Google Maps would solve the (which?) problem? What about the [Static Maps API](https://developers.google.com/maps/documentation/static-maps)? – MrUpsidown Jan 20 '18 at 14:52
  • @MrUpsidown Static API is not an option because its an excplicit requirement by the customer that they can open the map directly in google maps for further tasks... it has to be JS API because the environment requires it – FalcoB Jan 22 '18 at 09:32
  • hi, what options are you using in your generated google map? – Jonathan Chaplin Jan 22 '18 at 19:07
  • What about exporting marker info to a file, then importing it into google maps? – Jonathan Chaplin Jan 22 '18 at 19:18
  • @JonathanChaplin there aren't any other options the thing about exporting is, that i want to open the map with markers directly in google maps like https://www.google.com/maps/dir/Bahnhofpl.+1,+80335+M%C3%BCnchen/@48.1397026,11.4915988,12z/data=!4m7!4m6!1m5!1m1!1s0x479e75f9e9fbeed1:0x84773056350ba6e2!2m2!1d11.5616385!2d48.1397239 but not using any directions... just a map with multiple markers – FalcoB Jan 23 '18 at 08:15
  • I see, I don't think I'm much help then. For what it is worth if you can write a csv file with marker data you can import into maps. https://www.create.net/support/how-to-pin-point-multiple-locations-on-google-maps – Jonathan Chaplin Jan 23 '18 at 14:33

3 Answers3

3

The correct answer is yes and no.

There is no way to do such thing on the official Google Maps site, however you can create a map in Google's My Maps. The url does start with 'https://www.google.com/maps'. You can easily add your markers via the UI and I believe it also supports some file formats to import a batch of markers easily. I think you can also set some of the options you want.

Here's an example of an existing map created with this technique.

The only other option I know is to use the Google Maps API to create your custom map with all your markers and options, as suggested by other users.

DaniGuardiola
  • 861
  • 6
  • 18
  • 1
    There is way to do uploads/downloads too using arbitrary data formats, here is official Google Maps User Manual https://support.google.com/mymaps/answer/3024836 – Milan Jaric Jan 26 '18 at 10:45
  • 1
    btw, there is also an option in My Maps to link KML file with online source, so it can be linked only once and updates will automatically take place. – Milan Jaric Jan 26 '18 at 10:47
1

@JonathanChaplin was correct in his suggestion @FalcoB... if I understand you correctly...

Your aim is for a google map to display, and when it does it shows all map markers like this:

enter image description here

To achieve this you need to store information (such as lat and lng values) externally, like for example in a json file. I have done this previously and my bit of code was simply:

//loads the data from json file resulting in markers being displayed
    map.data.loadGeoJson('../upload/file.json');

Google has published documentation on this which can be viewed here:

https://developers.google.com/maps/documentation/javascript/importing_data

Dan
  • 951
  • 1
  • 23
  • 46
  • thanks for your reply, but actually that wasn't my question... my question is: is there a way to use/set those markers on the "normal" google maps website... there is a way to do so with one marker, but not multiple as far as i know – FalcoB Jan 25 '18 at 08:27
-1

I think you can't put the map in google maps, but you can display full screen in your webpage.