Polygons

You can add a polygon in GMaps.js in the following way:

var path = [[-12.040397656836609,-77.03373871559225], [-12.040248585302038,-77.03993927003302], [-12.050047116528843,-77.02448169303511],	[-12.044804866577001,-77.02154422636042]];

polygon = map.drawPolygon({
  paths: path, // pre-defined polygon shape
  strokeColor: '#BBD8E9',
  strokeOpacity: 1,
  strokeWeight: 3,
  fillColor: '#BBD8E9',
  fillOpacity: 0.6
});

The path of a polygon can be defined as an array of:

  • google.maps.LatLng objects, or
  • arrays of coordinates, with index 0 and 1 as, respectively, latitude and longitude (as in the example)

NOTE: Also, you can add a GeoJSON Polygon or MultiPolygon path using useGeoJSON: true.