user2226627
user2226627

Reputation: 13

Plotting "Points" on Google Maps using JavaScript API

I'm currently loading an extensive set of points (latitude, longitude pairs) into a Google Map. My problem is that Google Maps plots these points as markers (the default kind), while I'd rather just have each point plotted as a "point" like in this map: https://www.google.com/maps/search/atm/@54.0260702,-1.6780445,5z

rather than the marker as shown here (on Cimarron National Park): https://www.google.com/maps/dir/Great+Bend,+KS,+USA/Cimarron+National+Grassland,+242+Highway+56,+Elkhart,+KS+67950,+United+States/@37.7162446,-101.3770814,8z/data=!3m1!4b1!4m13!4m12!1m5!1m1!1s0x87a38bb5b59e293d:0x32155928d84780ee!2m2!1d-98.7648073!2d38.3644567!1m5!1m1!1s0x8708c3c3259cc53b:0x8109b72736458f11!2m2!1d-101.79!2d37.124167

Any Idea how this can be achieved through the Google Maps JavaScript API ?

Upvotes: 0

Views: 3972

Answers (1)

geocodezip
geocodezip

Reputation: 161334

A quick and dirty example (took something from the documentation and modified it):

map.data.setStyle(function(feature) {
  return /** @type {google.maps.Data.StyleOptions} */({
    icon: "https://maps.gstatic.com/intl/en_us/mapfiles/markers2/measle.png"
  });
});

working example

Upvotes: 3

Related Questions