I am reading the place names from a database and doing geocoding using
google maps api. I am using circle icons instead of default red markers.
Now i would like to know whether those circle icon can be appear in
different colours based on the value in the csv data using google maps api?
for ex i will get a json response for the region_name and average as
$.getJSON(json_link,
function (data) {
//console.log(data)
// response(data);
var place_names = [];
var average_value = [];
for (i=0; i<data.rows.length; i++) {
unique = data.rows[i].region_name;
place_names.push(unique);
}
for (i=0; i<data.rows.length; i++) {
average_values = data.rows[i].average;
average_value.push(average_values);
}
console.log(place_names);
console.log(average_value);
And those region_names will have corresponding average values which is
stored in average_value array. For those particular region_names with their
corresponding average_value, i should get the color of the circle icon vary.
And my geocoding part is
var address = place_names;
console.log(address);
for (i=0; i<=address.length; i++) {
geocoder.geocode({'address': address[i]},
function(results, status) {
if (status ===
google.maps.GeocoderStatus.OK) {
map.setCenter(results[0].geometry.location);
var marker = new
google.maps.Marker({
position:
results[0].geometry.location,
icon: {
path:
google.maps.SymbolPath.CIRCLE,
scale: 10,
fillColor: "#F00",
fillOpacity: 0.4,
strokeWeight: 0.4
},
map: map
});
marker.setIcon({
path:
google.maps.SymbolPath.CIRCLE,
scale: 10,
fillColor: "#F00",
fillOpacity: 0.5,
strokeWeight: 1
});
--
You received this message because you are subscribed to the Google Groups
"Google Maps JavaScript API v3" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-maps-js-api-v3.
For more options, visit https://groups.google.com/d/optout.