Draw radius around a point in Google map

webjunkie :

I'm using the Google Maps API and have added markers. Now I want to add a 10 mile radius around each marker, meaning a circle that behaves appropriately while zooming. I have no idea how to do that and it seems it's not something common.

I found one example that looks good, and you can have a look at Google Latitude, too. There they use markers with a radius, just like I want them.

Update: Google Latitude uses an image that is scaled, how would that work? (feature deprecated)

Dunc :

Using the Google Maps API V3, create a Circle object, then use bindTo() to tie it to the position of your Marker (since they are both google.maps.MVCObject instances).

// Create marker 
var marker = new google.maps.Marker({
  map: map,
  position: new google.maps.LatLng(53, -2.5),
  title: 'Some location'
});

// Add circle overlay and bind to marker
var circle = new google.maps.Circle({
  map: map,
  radius: 16093,    // 10 miles in metres
  fillColor: '#AA0000'
});
circle.bindTo('center', marker, 'position');

You can make it look just like the Google Latitude circle by changing the fillColor, strokeColor, strokeWeight etc (full API).

See more source code and example screenshots.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How Can I Draw A Radius Around A Map Marker Using Google Maps SDK (Swift/iOS)?

How to draw the circle with certain radius around the point in the plot?

Plot circle with a certain radius around point on a map in ggplot2

Draw a circle with a radius and points around the edge

How to draw a line between two point in Google map?

How To Draw Path On Google Map Based on array of Point in Json String

Draw a line around a single point in the linechart

Draw Point on Map Without Border

Drawing/plotting a circle with some radius around a point (matplotlib)

Draw a path from an origin point to the outside radius of a circle

Draw sector by center point, radius, interior angle and azymuth in postgis

Ploting a Buffer Around a Point on a Map - R SF

GoogleMaps : How to draw dash line to connect with starting point of direction path on google map ios

How add a radius / proximity around a city for estimating traffic (Google Adwords)?

How to find a set of points in a spherical space with specific radius around one point in a unorganized point cloud

PDFsharp - draw text, rotate it around a custom pivot point and move it

How can I draw a "rhombus'ish" shape in a grid around a point

Zooming Google map to specific radius in miles in android

iOS Google Map stop scrolling beyond radius

draw point on map given coordinates with openlayers?

Unable to Draw Polygon on Google map

Draw a route on google map on click

Draw Routes on google map on click

Draw a convex hull on a google map

How to draw circles around markers with the specified radius value using mapbox.js

Radius around touched position

Generate uniform distributed geo points around a geo point (Lat,Long) in a radius

Plotting a filled circle around a XY-coordinate point, with the radius corresponding to actual geographical distance

Is there a way to check a radius around a random point in order for random points to be separate from each other