0

I want to display a google maps in my browser. I am thinking of using the plugin

http://gmap3.net/

However the main issue is I want to mark a region instead of a point. For example, if I say "Pacific Ocean", I don't want a point in the center, I want the whole ocean marked visually. Possibly the region can be a certain color, and if you hover over it, the region becomes more opaque and maybe a hover tooltip shows.

Does anyone know how to do this?

Thanks

omega
  • 40,311
  • 81
  • 251
  • 474
  • possible duplicate of [Outline areas on a Google Map using Google Map API v3](http://stackoverflow.com/questions/15184584/outline-areas-on-a-google-map-using-google-map-api-v3) – Terry Aug 26 '14 at 22:40
  • This requires you to know the coordinates which make the boundry. I just want to give a string of a location, and google should automatically convert it into a region. – omega Aug 26 '14 at 22:42
  • That functionality isn't available directly from Google Maps. You might be able to find data as KML or in FusionTables that lets you do what you want (but you still have to find the data). – geocodezip Aug 26 '14 at 23:19
  • @omega You'll have to provide the coordinates of the boundaries to define the polygon — how'd you expect Google to know how the boundary you intend around a single point to be delimited based on a single pair of coordinates? – Terry Aug 27 '14 at 00:57

1 Answers1

0

Take a look at the example at: https://developers.google.com/maps/documentation/javascript/examples/polygon-simple.

It appears to be relatively straightfoward. Hope this helps!

Zak
  • 1,910
  • 3
  • 16
  • 31
  • This requires you to know the coordinates which make the boundry. I just want to give a string of a location, and google should automatically convert it into a region. – omega Aug 26 '14 at 22:43
  • Ok, I understand, will have a look for you now. – Zak Aug 26 '14 at 22:44
  • This doesn't appear possible to do automatically at the moment. The only solution I can think of is using the API to find the co-ordinates of the points of the polygon, and then plot it. You could probably create your own plugin to do this. – Zak Aug 26 '14 at 22:46
  • How do you use the API to find the co-ordinates? I thought that wasn't possible. I thought you had to manually get the coordinates. – omega Aug 26 '14 at 22:50
  • Look at geocoding on the Google Maps API – Zak Aug 26 '14 at 23:11
  • The Google Maps Geocoding API does not return polygons (at least at present), only the suggested viewport and bounds for the location in question. – geocodezip Aug 26 '14 at 23:17
  • One of the parameters it returns is a longitude and latitude, see [link](https://developers.google.com/maps/documentation/geocoding/#GeocodingResponses). You could then input these in order to create a polygon. @geocodezip – Zak Aug 26 '14 at 23:24
  • @omega If you liked my response, could you accept my answer. Thanks – Zak Aug 26 '14 at 23:25
  • @zak-cutner A latitude and longitude is not adequate to create a polygon (to display a region). The bounds object contains 2 sets of coordinates (two corners of a rectangle), and can be used to a rectangle, however, most regions (like the pacific ocean) are not rectangular. – geocodezip Aug 27 '14 at 00:00