Skip to content

Instantly share code, notes, and snippets.

@DanielSmith
Created April 21, 2019 17:57
Show Gist options
  • Save DanielSmith/3a17ff72d9d06dbd6bcc9ebb7221a03c to your computer and use it in GitHub Desktop.
Save DanielSmith/3a17ff72d9d06dbd6bcc9ebb7221a03c to your computer and use it in GitHub Desktop.
updated-searchResultsMarkers.js
searchResultMarkers(results) {
// if we have not pulled in City Boundaries, this is our default
let filteredresults = results;
if (this.mapNumGeometries > 0 && this.mapGoogleGeometryMultiPoly) {
filteredresults = [];
results.map((curPlace) => {
for (let i = 0; i < this.mapNumGeometries; i++) {
if (google.maps.geometry.poly.containsLocation(
curPlace.geometry.location,
this.mapGoogleGeometryMultiPoly [i]) == true) {
filteredresults.push(curPlace);
}
}
});
}
filteredresults.map((place) => {
let image = {
url: place.icon,
size: new google.maps.Size(71, 71),
origin: new google.maps.Point(0, 0),
anchor: new google.maps.Point(0, 0),
scaledSize: new google.maps.Size(15, 15)
};
let marker = new google.maps.Marker({
map: this.map,
icon: image,
title: place.name,
position: place.geometry.location
});
})
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment