Ionic Reorder when a google maps marker click - google-maps

Is it possible to reorder ionic list according to the click on a google maps marker?
I have a homepage that has a google map on top with a list under this map.
I want the list to be reordered when a marker clicked. The item that is related with the marker click will come to the top of the list.
Any idea how to do it or any examples that might help me? Is this feasible with ionic2 and google maps functionalities ?

I solved this putting a function call that will sort the list, inside the marker listener. :D So your listener will look like this:
google.maps.event.addListener(marker, 'click', () => {
this.map.setCenter(marker.getPosition());
this.infoWindow.open(this.map, marker);
this.sortWithMarkerClick(marker_key);
});

Related

Tracking marker clicks on Google Maps - Using google tag manager

I'm trying to track people clicking on map markers with google Tag Manager, is this possible and if so, what are my options?
Thanks in advance!
I would expect so, see https://developers.google.com/tag-manager/devguide#events
You want to trigger this dataLayer.push event on click of the markers, e.g.
google.maps.event.addListener(marker, 'click', function() {
dataLayer.push({'event': 'markerClick'});
}

Navigating on Google Maps

I am working on a Google Map project. I need to accomplish something interactive. On the map, there will be lots of markers indicating different places and one place will be set as center. Clicking on the marker will pop up the infoWindow. On the infoWindow there will be a link named “NEXT”. Hitting that link will take the viewer to another marker place. It seems to be straight forward, so my question is there any API method to accomplish such task? Any help/suggestion will be highly appreciated.
Use the domready event of the infowindow to bind your click events, as described here.
var infoWindow = new google.maps.InfoWindow();
google.maps.event.addListener(infoWindow, 'domready', function() {
// whatever you want to do once the DOM is ready
});

Select position inside Google Maps

I wonder if there is any plugin that lets me do this:
Click on the map, and auto generate the latitude and longitude. I have seen one somewhere, but don't know what library the site is using.
Click on the map, generate closest address. This I haven't seen before.
You can get the position with a simple click listener
google.maps.event.addListener(map, 'click', function(e) {
alert(e.latlng);
});
To get the closest address take a look at reverse Geocoding.
http://code.google.com/apis/maps/documentation/geocoding/#ReverseGeocoding
Edit: all of this is included in the basic google maps api :)

Google Maps API 3 - Check if marker is in view

I see that there is a getVisible call, but that only checks if the marker is on the map NOT if the marker is in the current view.
I want to check if the marker is in the current view bounds?
I guess you want
map.getBounds().contains(marker.getPosition())
You need to tell map that your markers should be contained within view by adding following code
google.maps.event.addListener(map, 'bounds_changed', function() {
map.getBounds().contains(marker.getPosition())
});
Here bound_changed event is triggered.

Adding click listener to Google Maps v3 Compass (navigation control)

I am trying to figure out how i can attach a click event to a google maps v3 compass.
I have created a function that re-draws markers on a map and want this to be fired when the user click on the compass (arrows top left) of the google map.
I am working with google maps v3 and cant seem to find any way of doing this through the documentation.
Does anyone know how to do this?
Thanks in advance!
Click event of the compass is probably attached to the bounds_change event. Essentially, you are changing the bounds of the map.
You can listen to the center of the map changing:
google.maps.event.addListener(map, 'center_changed', function() {
// Call your function to redraw markers here.
});