Ok, almost solved. I am trying to use the place attribute from a nearbySearch (shown below)
var request = {
location: pyrmont,
radius: '500',
types: ['atm','bus_station','parking']
};
infowindow = new google.maps.InfoWindow();
service = new google.maps.places.PlacesService(map);
service.nearbySearch(request, callback);
The markers are stored in an array ( below)
function createMarker(place) {
var iconType = {};
iconType['atm'] = "http://maps.google.com/mapfiles/ms/micons/dollar.png";
iconType['bus_station'] = "http://maps.google.com/mapfiles/ms/micons/bus.png";
//iconType['restaurant'] = "http://maps.google.com/mapfiles/ms/micons/restaurant.png";
iconType['parking'] = "http://maps.google.com/mapfiles/ms/micons/parkinglot.png";
var placeLoc = place.geometry.location;
var marker = new google.maps.Marker({
map : map,
icon : iconType[place.types[0]],
position : place.geometry.location,
types : place.types
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.setContent(place.name);
infowindow.open(map, this);
});
return marker;
}
Now the problem is that the 'if' statement below is not matching the place in the array, with the string I enter, Im not sure if the statement itself is wrong, or if I am not retrieving the place.types attribute correctly from the Google request.
function onRemoveBtn_Clicked() {
var i;
for (i = 0; i < markers.length; i++) {
if (markers[i].get("types") != ATM) {
markers[i].setMap(null);
}
}
I have had great help with this problem up until now and would like to thank all those who have taken the time to help me, this is the last that I will bother you :)