Get Google Map's Marker Content - google-maps

When I am adding a Google Map marker using this tutorial, I am able to add my own content into the body of the marker. Instead of adding my own content, I want to use the content that Google has stored about my business. I am wondering how would I be able to do this?

As far as I know, there is no way to have Google populate the marker for you. On my site I use the Google Places API to display info on the tooltip when a marker is clicked.
You can query the places API to using the Google reference number. Here's a direct link to the Google PlaceDetailsRequest section. Scroll down and you will see the PlaceResult object which gives you all the data Google has about that particular place.
If you just want to display the information for your business, you are better off statically putting the content into the marker. Otherwise, if the data needs to be dynamic you need to pull it from somewhere yourself and Google Places is good if you don't have your own data.

Related

How do you shift the centre of the map in an embedded Google map?

I have a Google Map that I have embedded on my web site. I have managed to size and position the iFrame so that it sits where I want it to sit on my web page. I am using the new Google Maps version.
However, I want to be able to shift the centre of the map to the right, because as it standsnow, the box that displays the map layers is covering some of the locations I have marked.
I am not at this point using any Javascript or jQuery. I have simply taken the iFrame link provided by Google's embed feature and placed it in my HTML. I see there are other questions about map centering, but I can't parse them for my situation because they assume some Javascript implementation. Also, I'm hoping that I do not have to take on a whole API or Javascript library to solve this. Further, it is unclear to me if the other questions relate to the new Google Maps version, which is what I'm using.
Is there a way I can alter the centre of the embedded Google Map?
Just add a "center" parameter to your iframe url. Like so - center="40.714728,-73.998672". You can get the required coordinates by searching in google maps and picking them from the address.
You could alternatively also use a query parameter but center is more accurate.
refer - https://developers.google.com/maps/documentation/static-maps/intro#location

How can I make custom Google Maps markers with a custom dialog message

I need to create iframe Google Maps that I can embed on a site with a custom marker that would be the companies logo.
Once the marker is clicked, it should show a dialog with custom information instead of Google's default information with an address etc. I would like to modify it so it shows some information about the business. Just like the one that can be seen here: http://ekogaze.lv/kontakti.html
Thank you.
Creating custom marker can be found here.
Adding custom information can be done by updating values in the marker div.

Query existing, public Google Map via the Google Maps API v3

I am trying to embed an existing, public Google Map into a website. Specifically this one:
http://goo.gl/maps/cHf2
Of course I could use the iframe embed to achieve this, but I would like a little more control over the map … I imagined being able to pull all the markers from the map and display them as an index next to the map. Kind of like Google already does, but embedded in my page with my own styles and images.
I have been digging through Google, Stack Overflow and the API instructions and couldn’t find any relevant posts. In the GET string of the map on Google we can see this chunk:
&msid=212828439842926497866.0004bfae4da003d8ffd1f&mid=1341413217
I thought in there might be a maps ID and I could use it to query the content of the map through the API? The intention is using Google Maps as a CMS for less technical minded people and not dealing with geo data in our own CMS.
Any help would be greatly appreciated. Maybe I am just missing the forest for the trees.
You can download the kml that specifies the markers in that page and display that on your API based map. This example defaults to displaying it using geoxml3, but you can hide that and display the KmlLayer version.
You should be able to just point KmlLayer to the link (I downloaded the kml and put it on my server so it would work with geoxml3).
Here is an example (taken directly from the documentation) that does that
here is the original

Search a google map I have created and embedded into my website

I have a Google map I have created to highlight the location of several support groups by adding my own pins using my maps and embedding this into my website.
Is there a Google widget of any description to allows people to search my custom map and find their nearest support group (or nearest pin).
I have read through the Google maps stuff but cant seem to find anything that meets my requirements.
Any help appreciated.
The map has no clue about which markers or overlays you have put on it. Therefore there are no way you can do what you want using Google Maps directly. You can however do something else.
When you create your markers/overlays and place them on the map you can add them to an array. When you users then enters a location you can search through that array to find the markers that are closest to the location the user has entered. Google Maps API has a method for getting the distance between two latlngs, but you can also use an ordinary Haversine formula for calculating it.
Once you have found the closest markers it is not hard making sure they are the only ones that are shown on the map.

Do i need use google maps api only to embed litle map with route calculator/display for only one destination?

Well i want to upgrade contact page with dynamic map showing location and give oportunity to calculate route for comapny headquatters. Id it necessery for such simple task use Google api? i mean here generating akey etc? Fo i have any other alternatives to google maps?
There's really no reason to mess with the API at all unless you need to customize the appearance or behavior of gmaps. Why not just use an iframe with a url of:
http://maps.google.com/?q=[you-url-encoded-address-here]
or better yet, set up a textbox and a 'get directions' button to redirect that frame to:
http://maps.google.com/maps?saddr=[their-address]&daddr=[your-address]
edit: this works well in modal dialog if you don't want the google logo sticking out like a sore thumb in your pageflow
You could probably embed directly with a specific URL that will configure it to have the destination you want.
By the way, well written answers are much more likely to receive useful responses here.
You could consider http://www.openlayers.org/ as an alternative to google maps.
In fact open layers can be used to add a Google map, or an OpenStreetMap map or a Bing map, etc.