Page 2 Page 3

Click any image to view a larger version

First Published 26 May 2022                         Last Updated 1 Dec 2022                                                        Difficulty level :   Moderate

Section Links (this page):
          Obtain API Key
          Create a Simple Map
          Annotating Your Maps
          DevCon Video
          Related items/apps
          Related articles/code
          Useful links

This is the first in a series of articles about annotating downloaded maps in Access

This article focuses on the use of Google maps with Access.

However, the approach can easily be adapted to use other online mapping services such as Bing, Open Street Maps etc

A significant part of the content in this article was presented to the online Access DevCon conference on Thur 28 Apr 2022.
The session was recorded by the conference organiser, Karl Donaubauer, and the video is now available below.

The full program for this event is available at: Access DevCon Vienna ( There were a total of 135 participants from 18 countries

The session was used to demonstrate ways of ‘annotating’ downloaded static Google Maps to personalise these for yourself or your clients.

The generated maps can be displayed using a web browser control (standard or ActiveX) or as a downloaded image.

1.   Obtain an API Key                                                                                                                   Return To Top

The first thing you need to do is get an API key to use the Google Mapping APIs you wish to employ.

To obtain your own free API key, go to:

The API key will be a long string starting with 'AIza' such as: AIzaSyAHXXMSyKgS00M314zzHr0gSg0upAX-q1hy

The above key is only given as an example. It isn’t currently valid and will not work
If you do try to use it, you will see this message:
    The Google Maps Platform server rejected your request. The provided API key is invalid.

Google now requires billing information to be provided when obtaining/using API keys.
The number of free downloads available per month is restricted though the limit is currently very generous.

The current pricing model is based on $200 USD free usage each month (28,500 free map loads per month).
Each downloaded map contributes towards that map loads total.
Usage above the free usage limit for each month will be charged to your credit/debit card as supplied when obtaining the API key.
However, for individual or small/medium business use, this is likely to work out free in practice

Despite regular usage, I have only been charged once in over 7 years of using Google Map APIs.
That charge was because I downloaded geolocation data for a huge number of UK postcodes in a short period.
I knew I would hit the limit and the charges were exactly as I had predicted.

Depending on your requirements, you will need to enable several map APIs.

The main APIs needed are likely to be:
    - Static Maps
    - Places
    - Geocoding
    - Geolocation

However, for certain types of maps, you may also wish to add other APIs such as:
    - Directions
    - Distance Matrix
    - Maps Elevation
    - Maps Embed
    - Maps Javascript     (NOTE: this no longer works with the MS web browser control currently based on Internet Explorer)
    - Roads
    - Street View
    - URL Shortener

When setting up the APIs to use with your app(s), you can choose to do either of the following:
    - Use the same API key for all APIs used with your project – simpler to code but more likely to hit free usage limit
    - Use a different API key for each API – slightly more complex to code but less likely to hit usage limit

2.   Creating a simple map                                                                                                             Return To Top

To create a map centred on a specified location, the location can be based on any of the following:
    - Zip code / Postcode e.g. SE1 7PB
    - Co-ordinates e.g. 51.5027667,-0.1215859 (lat/long)
    - Full/partial address e.g. London Eye ; 6 Hill Street, Clevedon, Somerset

You must also specify:
    - Size in pixels (horizontal/vertical) e.g. 800x400; 640x400; 480x320

    - Zoom (range 1-20) where 1 = whole earth & 20 = rooftop level

        Zoom = 1
        Zoom = 12
        Zoom = 17
        Zoom = 20

    - Map type (roadmap/terrain/satellite/hybrid)

        Hybrid     (roadmap & satellite combined)

    - Your Google Maps API key     (see above)

This information is then combined to create the Google Static Maps URL needed to generate the map.

For example, this URL creates the map shown below:


The first section is an instruction to use the Google Static Maps API
It is followed by a question mark to separate it from the rest of the URL

The remainder of the URL states that the map is centred on the London Eye which has a UK postcode = SE1 7PB, the zoom value = 15, the map size is 640 x 480 pixels and the map type is hybrid (satellite + roadmap combined). Each part is separated by the '&' operator

3.   Annotating your maps by adding map layers                                                                         Return To Top

Once you have generated standard Google static maps, the next step is to personalise the map for your clients
To do this, additional items (map layers) can optionally be added including the use of:

a)   Marker points e.g. to mark client locations or nearby places


The latter part of the URL is an instruction that a hybrid map is used and a red marker of normal size with label X should be placed at the map centre

b)   Lines joining 2 or more points e.g. to indicate routes between locations


This uses the Google route planning service to set a route between two UK postcodes BS25 5NB & BS22 8XX

c)   Circles around a location e.g. to show places of a specified type within a specified distance

?&border='0'&key= YourAPIKey

This uses the Google Places API to generate markers for up to 20 places of interest within a specified radius of the map centre.
Each place is given a unique label. Nearby places data is downloaded as a JSON file and stored in a 'temporary' table for retrieval.
The boundary circle is generated as a series of short red lines of weight (thickness) = 3.
To reduce the URL length, the points used for the circle are encoded

d)   Boundary shapes e.g. to show postcode or regional boundaries


The latter part of the URL is an instruction to mark the boundary of the postcode district BS1 with a blue line and a pale yellow fill.
Seven red markers of normal size with labels numbered 1,2,3,4,5,6 & 9 denote the centre of each postocde sector BS1 1, BS1 2 etc

The boundary path data was obtained from a different source. It consists of a large number of coordinates for each section of the boundary.
A sample of the boundary path points is used for the map and these are then encoded to reduce the total length of the URL.
However, using only a sample of the boundary data results in less precision in the boundary path displayed.

e)   Feature styles e.g. show local & main roads in selected colours


The latter part of the URL is an instruction to mark the main roads in blue and the local roads in grey.
Other points of interest (POI) such as parks, schools and government buildings can be marked in a similar way.

For example, in the map shown below, parks are marked in green.


In each of the examples above, all 'annotations' are added as additional map layers using code as part of the URL used to generate the map.

Several layers can be combined to include additional information.

However, adding more features to the map increases the length of the URL.
Eventually you will hit the URL character limit using the current web browser control which is still based on the antiquated Internet Explorer 7 browser.

1. The limit is 2048 characters for the standard web browser control or 2083 characters using the ActiveX web browser.
2. A new web browser control based on Chromium Edge is currently under development and this is likely to have a much larger URL character limit.
3. Much longer URLs can be used if the generated map is saved as an image and displayed using an image control.
    Doing this bypasses the restrictions caused by the existing web browser controls
4. However, the maximum URL length will still be limited by the maximum length determined by Google.
    According to the Google documentation, the limit is 8192 characters i.e. 2^13. However, this information seems to be out of date.
    From widespread testing, the limit currently appears to be just over 16,000 characters (probably 2^14 = 16384)

The session at DevCon demonstrated how to manage issues caused by the 2048/2083 character URL limit in the web browser controls or the much higher limit using downloaded static map images.

Further details will be given in the remaining articles in this series including managing the total number of characters by:
a)   Encoding the co-ordinates
b)   Using a sample of the data
c)   Using a downloaded static map image

For example, the following is a hybrid map of Aberdeen city centre with zoom = 15.
It has an orange marker labelled A together with vertical and horizontal red lines centred at postcode AB10 1BA.
The map shows the postcode sector AB10 1 with a blue boundary line and a yellow fill.
Main roads are marked in blue and local roads in brown


Even with all of this detail, the total number of characters in the above URL is only just over 1200

However, by comparison the map below is of part of the Shetland Isles off the north coast of Scotland and has a much longer URL of around 4300 characters:

The map includes a green X marker at the map centre surrounded by an octagonal shape with a yellow boundary and yellow fill.
That is also surrounded by a larger circle with a red line and green fill.
Also just visible in the bottom left corner is a blue line which is a small part of the postcode area boundary path.
As the map shows an area with low population density, the postcode area is very large and the long boundary path needs a lot of characters even though both sampling and encoding of the data has been used.

invert_lightness:false&key= YourAPIKeyHere

This map cannot be generated using either a standard or an ActiveX web browser control in Access as it exceeds the 2083 character limit
However, it can be generated as a downloaded static map image

4.   Video from Access DevCon

I demonstrated this application at the virtual Access DevCon conference on 28th April 2022. With the kind permission of the conference organiser, Karl Donaubauer, the video of the presentation is now available on my You Tube channel at or you can click below:


5.   Related items / example apps                                                                                               Return To Top

The following apps use various geolocation features to generate maps. All are available elsewhere on this website:

a)   Get Geolocation from Photos   (FREE)

b)   Get Current Geolocation   (FREE)

c)   UK Postcode Address Lookup   (FREE)

d)   UK Postal Address Finder   (PAID)

6.   Related articles / code                                                                                                           Return To Top

a)   Encoded Map Path Co-ordinates

b)   Missing Trigonometric Functions

7.   Useful links                                                                                                                               Return To Top

The following links will also help you get started on creating your own maps in Access:

a)   Google Static Maps API Developers Guides

b)   Google Nearby Places API Developers Guide

c)   IE browser URL character limit
      Maximum URL length is 2,083 characters in Internet Explorer (
      What is the maximum length of a URL in different browsers? - Stack Overflow
      How long of a URL can Internet Explorer 9 take? - Stack Overflow

d)   Fix Google maps display issues in Access web browser control

8.   Summary                                                                                                                                   Return To Top

      The above article was the first in a series of articles planned for this website.

      UPDATED 1 Dec 2022 - fixed 2 incorrect links

      The second article will be used to explain how the large amounts of data involved with creating complex maps are managed using both encoding and sampling.

      The third article in this series will be used to put all this information together including showing how the URLs can be built up in code. An example app will be provided.

9.   Feedback                                                                                                                                 Return To Top

      Please use the contact form below to let me know whether you found this article useful or if you have any questions.

      Please also consider making a donation towards the costs of maintaining this website. Thank you

      Colin Riddington           Mendip Data Systems                 Last Updated 1 Dec 2022

Return to Access Articles Page 1 of 3 1 2 3 Return To Top