How to add a business/“default” location marker an

2019-01-27 03:28发布

Is is possible to add a business location marker WITH IT'S "DEFAULT" INFOWINDOW bubble like the ones in maps.google.com?

I'm making a contact page for a a company, where I have the GMaps element with a location and a marker, naturally.

Example:

Go to maps.google.com and search for "Colosseum" (for example, any "known" location/business will do). When you click the Colosseum marker, you get an infoWindow that has the business/sight/whatever info in the window (screenshot: https://dl.dropbox.com/u/1122582/colosseum.jpg)

What I want to see, is:

  • When I click the marker on my map on my webpage, it will open the same style (or atleast very similar) infoWindow as in the example (this means logo, address, direction links etc. whatever it has). InfoWindow being provided by the API options, and not handmade by me.

In pseudocode, I would imagine seeing it like this:

myMarker.onClick({
    position: myBusinessLocation,
    useDefaultInfoWindow: true
    map: myMap
});

Worth noting that since coordinates are actually just coordinates and named locations, I would need to make the API understand the Marker points to a business, and not just a point in the map.

Requirements

  • Client-side API usage
  • WITHOUT the use of Google's IFRAME embedding
  • WITHOUT making a custom infoWindow that just looks like the one in the example. The whole point is that I would use the "default" infoWindow (if GMaps API even provides one)

1条回答
够拽才男人
2楼-- · 2019-01-27 03:39

There is no built-in method to create such an infoWindow with the desired content automatically.

That's the nature of an API, it has to offer the ability to create an application, but must not create an application automatically.

You have to create the infoWindow on your own by using e.g. the implemented infoWindow-object.

The contents of the infoWindow you also must collect on your own, you may retrieve the details for a place by using a Place-Details-Request

查看更多
登录 后发表回答