Draw area around province on google maps

2
Hi, I want to highlight a complete province on google maps using the google maps widget. I have read this previous post: https://community.mendix.com/questions/6938/Google-Maps-polygon-drawingmapping Does anyone have experience with this and have maybe implemented it already? ...When I use google maps in my browser and search for a province e.g. zuid holland, I see that there is a line drawn around the province. I want to get this same functionality in the google maps widget as well. I understand that with the standard options this is not possible, because there is only one lat/long field.
asked
1 answers
2

The answer can be found here: http://gis.stackexchange.com/questions/113695/zip-code-highlighted-in-google-map

The Google API doesn't support this feature, quoting: "Google presumably translates the address to lat/longs, then checks for spatial membership in any number of 'neighborhood' layers, including neighborhood proper, zip code, probably others. If you searched for a specific zip code, their parser recognizes that as such and returns the corresponding feature from the tabulation area shapefile, and returns the corresponding polygon.".

So, for this to work in Mendix, I think you should create your own widget for this. Knowledge of the GoogleMaps API V3 is required for this, see for instance:

https://developers.google.com/maps/documentation/javascript/examples/polygon-simple

The data for the boundaries, states and provinces can be found in Fusion tables, which are publicly accesible. See, for instance one for all the polygons and KML's for all countries in the world:

https://www.google.com/fusiontables/DataSource?docid=1uL8KJV0bMb7A8-SkrIe0ko2DMtSypHX52DatEE4#card:id=2

Two options:

1. KML

Host the KML files on the Mendix server and conditionally call on them from within your own widget.

2. Polygon

Create a polygon entity in your Mendix domainmodel, feed this entity to the widget and plot it on Google Maps. What you could do is create an attribute of type String which will contain the coordinatesstring for each Polygon object. This attribute is then needed in the widget to create a GoogleMaps Polygon object with it's path as your coordinatesstring. In the same manner as in the already available GoogleMaps widget, plot this GoogleMaps Polygon object on the map.

answered