Alright so since I posted this the first time and I failed hardcore at properly explaining what I was looking to do, here’s my second attempt.
On my site I’ve got Google Maps V3 Javascript implemented. A predefined set of points is created (from within the CMS) and pushed to the map via an array with the required information. What my client is wondering is if the users of this site can execute a search to find an existing point from this array. I was thinking that this was going to involve using the Places library but this returns all valid results from google, not from the array of custom points that are being created in the CMS.
$('#points-search').submit(function(){
geocoder = new gm.Geocoder();
var searchAddress = $(this).children('input[type="text"]').val();
var searchPoints = [];
if (geocoder){
geocoder.geocode({'address' : searchAddress}, function(results, status){
if (status == gm.GeocoderStatus.OK){
$.each(results, function(i, result){
searchPoints.push({"lat" : result.geometry.location.Xa, "lng" : result.geometry.location.Ya});
});
} else {
alert('nothing found!')
}
});
}
return false;
});
That code isn’t yet finished, of course. Theoretically what I’d like to do is, say, if I search for “4777 Avenue Pierre-de Coubertin”, it would find the proper point in my $points array instead of finding that existing address in Montreal AND all the other points in the world with that address.
lat: 45.5
lng: -73.553459
location: "2 Rue de la Commune Ouest, <br />Montreal, QC H2Y 2E2, Canada"
name: "Montreal Science Centre"
pointType: "Community"
url: "/points/item/montreal-science-centre"
lat: 45.514229
lng: -73.531342
location: "4777 Avenue Pierre-de Coubertin<br />Montreal, QC H1V 1B3, Canada"
name: "Montreal Biodome"
pointType: "Curated"
url: "/points/item/montreal-biodome"
I hope this is a bit clearer of a description of what I’m trying to do. Thanks very much.
The answer is yes. What criteria are involved in the search? Data in the infowindow? Closest point? Do you have a database that might do the search more efficiently?
You have choices: