Google Map Drawing Area

4 answers

A toolkit that allows users to draw polygons on MyMaps was available in the form of GeometryControls

+4
source

If you want to use the Google Maps API, check out the Polylines documentation (it should be what it is): http://code.google.com/intl/pt-PT/apis/maps/documentation/overlays.html#Polylines_Overview

+1
source

You need to create an instance of GPolygon and add it (using addOverlay ) to the GMap2 object:

var polygon = new GPolygon([new GLatLng(48.922499263758255,-94.921875), new GLatLng(49.03786794532641,-128.671875), new GLatLng(38.95940879245423,-126.38671875), new GLatLng(31.95216223802497,-118.30078125), new GLatLng(24.686952411999155,-96.50390625), new GLatLng(28.149503211544566,-87.1875), new GLatLng(23.725011735951796,-79.62890625), new GLatLng(44.59046718130883,-59.765625)], "#ff0000", 5, 1, "#0000ff", 0.2); map.addOverlay (polygon); 

The first parameter is an array of points (which make up your polygon), then the stroke color (this is the outline), weight (thickness) and transparency (like transparent), then the fill color and opacity.

The following is an example:

+1
source

Try this code: It really helped me

 PolygonOptions rectOptions = new PolygonOptions() .add(new LatLng(34.578289, 36.277231), new LatLng(34.580568, 36.262041), new LatLng(34.549016, 36.287584), new LatLng(34.560977, 36.282660), new LatLng(34.578289, 36.277231)); // Get back the mutable Polygon Polygon polygon = mMap.addPolygon(rectOptions.strokeColor(Color.RED) .fillColor(Color.BLUE)); 

Link: https://developers.google.com/maps/documentation/android/shapes#customizing_appearances

where mMap GoogleMap mMap; and add: import com.google.android.gms.maps.model.PolygonOptions;

Hope this helps you

+1
source

All Articles