Ruby Shell
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Gborders: Generating a borders overlay in Google Maps

This project is based on the work I have done here and here for adding a live border overlay on Google Maps. See the results in action in as you browse the Meteoalarm layer (



./ 150

generates the country borders for Europe

Example showing the live border layer for Spain:

How does it work

The provided shell script downloads a borders file from, converts it into a sqlite db file then a ruby script processes this database to extract the border polygons and generates a JavaScript file ready to embed in your Google Maps page.

Add the resulted JS file in your html:

     <script type="text/javascript" src="bordersOverlay.js"></script>

then call these two functions in your JS code after initializing the GMap2 object:


A live example is shown here:


Given that there is a large number of polygon points, using all of them to render the borders incurrs a performance penalty on the browser. To address this I devised a simple "straight point reduction" technique that reduces the total number of polygon points and increases the performance when rendering the borders. See for a detailed explanation.


Currently the generator is limited to whole regions and not individual countries. It is not difficult to add this option if needed, the Ruby script uses a single SQL query for the border selection.

The overlay color is fixed to translucent black and not externalized.

The overlay works with GMap2 API. Ivesvdf has contributed with a generator for V3 here