Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google maps api user can select area

I want to create a local map for my city where people can cover area with polygons and get their latitude and longitude

For Example there is a world map and someone come and he wanted to cover us then he can simply cover it and get its latitude and longitude of corners or borders

Is there any way or example i searched about it on google and Site both but didn't get Anything

Sorry I've no Codes i want idea, code or something helpful.

like image 891
Gates Bill Avatar asked Nov 05 '11 09:11

Gates Bill


People also ask

How do you highlight area on a map?

You can add regions to your map by selecting 'Additions' then 'Highlight Regions' from your map menu. This will give you the following options: countries, states, cities, counties, circles, rectangle, polygon, zip (post) code area, or draw freehand.

Can you customize Google Maps API?

Google Maps Platform offers Cloud-based maps styling features that make it easy to style, customize, and manage your maps using the Google Cloud Console, letting you create a customized map experience for your users without having to update your apps' code each time you make a style change.


2 Answers

A simple search yielded http://www.the-di-lab.com/polygon/ and you can find a lot more samples at http://code.google.com/apis/maps/documentation/javascript/demogallery.html.

Unfortunately the above demo is a minified js. But the essential part of drawing a polygon (area) on google maps is to 1. load the map 2. trap the click events and the position (lat/lon) 3. draw lines 4. Finally when a double click is received, close the polygon

I unfortunately do not have a ready made sample in hand.

like image 80
Muthu Avatar answered Oct 19 '22 15:10

Muthu


The answers here are quite outdated. Google Maps now have a drawing library, This library allows the user to insert markers, circles, polygons and other types as well.

You can find an example on it here. And the library reference here. And the documentation here.

enter image description here

like image 5
Abkarino Avatar answered Oct 19 '22 16:10

Abkarino