DEV Community

Cover image for How to draw a radius on Google Maps
Chris Texe
Chris Texe

Posted on

How to draw a radius on Google Maps

I'm sure you saw many times maps like this:

Image description

On this map we have a radius (circle) with operating range of some company. We have red line around the circle and also this radius is filled by transparent red. So how to make this?

Step one

First we have to open Google Maps, type the city name in search field. Then we should copy GPS coordinates by right click on the city and click on GPS coordinates:

Image description

Step two

Next open any KML generator, I usually use this KML circle generator but you can use any. KML means Keyhole Markup Language and it is a file format used to display geographic data in an Earth browser such as Google Earth. Then paste these GPS coordinates into form field and type radius in kilometers, miles etc. You can select color. Finally click Generate button and download the KML file.

Image description

Step three

Open Google My Maps sign in, and create a new map. In the new window beside Untitled layer click Import and upload a KML file you've created in step one.

Image description

Next select color and line width. You can name your map if you want.

Image description

Step four

Click on Share and enable Anyone with this link can view. You can decide if others can see you name and photo on this map. Next click Close.

Image description

Image description

Step five

Click on preview.

Image description

The new tab will open with default view of this map. Click Share and choose <> Embed on my site. Copy the code and paste it in your website code.

Image description

Example of the code looks like this:

<iframe src="https://www.google.com/maps/d/embed?mid=1AJnVYcE_SzVL3kbu-FRkQLFbKOzB1JE&ehbc=2E312F" width="640" height="480"></iframe>
Enter fullscreen mode Exit fullscreen mode

And you have a map with operating range on your site! You can adjust width and height.

Image description

It would great if you will follow me on Twitter: Chris Texe

Top comments (0)