Skip to main content
12-Amethyst
October 16, 2015
Solved

Changing view / centering Google Map on selected location

  • October 16, 2015
  • 11 replies
  • 5239 views

I'm working with the GoogleMap widget, and have found that when my data has locations specified around the world, the Map is zoomed out almost fully, and is centered on the pacific ocean, which is not particularly interesting.

I'd like to be able to center the currently selected location on the map.  Specifying a Selected Location of 0,0 does not center the map at 0,0; it just puts the selected location marker at 0,0.

The Boundary bindings are strictly source bindings and will not work as a target, so I can't specify four corners manually / programmatically.

Does anyone know a way that I can adjust the centering of the map and possibly the Zoom level at the same time?

Best answer by Aanjan

Jeremy, what is your current setting for the AutoZoomBehavior? You can set it to 'AutoZoom only when the AutoZoom widget service is invoked' for the Map to not zoom out and show all locations unless invoked.

11 replies

Aanjan5-Regular MemberAnswer
5-Regular Member
October 16, 2015

Jeremy, what is your current setting for the AutoZoomBehavior? You can set it to 'AutoZoom only when the AutoZoom widget service is invoked' for the Map to not zoom out and show all locations unless invoked.

12-Amethyst
October 16, 2015

I've changed the AutoZoomBehaviour to "AutoZoom only when service is invoked" and now see the selected location is the center of the map on Mashup load.  Thanks for that.

My next question would be whether or not it's possible to get the map to center on the currently selected marker when selection changes.  Tying the Google Map Widget's Changed event to the AutoZoom service does nothing, and there don't appear to be any other services that could allow me to do this.

5-Regular Member
October 23, 2015

I don't believe there is any way to auto zoom to the selected marker. One way to 'simulate' this would be is by using a TooltipMashup. In this case, if you hover over your selection marker, it map would automatically center on that marker (but display the Mashup you've bound in the ToolipMashupName property too).