# Google maps and geocoding

To use Google Maps with Navixy On-premise, you have to obtain valid Google Maps API keys. This documentation page provides a step-by-step guide on how to create Google Maps API keys and configure them for use with the Navixy platform.

The guide will walk you through the process of setting up a Google Cloud Console account, creating a new project, generating the necessary API keys and applying them to your Navixy instance configuration. By following this guide, you will be able to easily integrate Google Maps with Navixy On-premise and take full advantage of the platform's advanced mapping features.

## Creating Google API keys

To create Google API keys for use with the Navixy platform, please follow the guide below. Please note that Google API keys are associated with your account and are subject to Google's API usage policy. For more information, please refer to the links below:

* [Google Maps APIs Terms of Service](https://developers.google.com/maps/terms)
* [Goole Maps FAQ](https://developers.google.com/maps/faq)

### Setting up account and project

1. Navigate to the [Google Cloud Console](https://console.cloud.google.com/projectselector2/apis/dashboard?supportedpurview=project) webpage and log in using your Google account credentials. If you do not have an account, you can create one.
2. API keys are created within a project. If you already have a project, you can choose it from the list. If you do not have any existing projects, click "Create project" to create a new one.
3. Name your project appropriately and click the "Create" button to create a new project

![](/files/DucQ2HOwvVNAd9yNH1pr)

![](/files/rj5Tg0Xtu4CVbtr3uEMh)

4. Ensure that your newly created project is selected and click “Enable APIs and Services”. You will be taken to Google API library.
5. Type the name of the API you need, select it and click “Enable”. In this case we are adding Maps Javascript API (used for google maps)
6. Repeat the process for APIs you need. Navixy utilizes a total of 5 APIs:

* Google Maps JavaScript API - Google maps in UI
* Google Maps Geocoding API - Geocoding
* Google Maps Geolocation API - LBS point processing
* Google Maps Directions API - Route creation
* Google Static Maps API - Static maps in email

![](/files/1P14ndOtbrYYhh6dMegt)

![](/files/yZL3VrjAFu44Ua1a3hGK)

![](/files/GDEQGNsB3uybp5q0coFI)

Ensure all enabled APIs are displayed in your dashboard:

![](/files/3CFEfHb3zsl9jMpFmAiw)

### Generating Google keys

To enable the full range of Navixy functionality, you will need a total of three API keys:

* Key #1 for displaying maps in the user interface
* Key #2 for accessing GIS services (geocoding, routing, and geolocation)
* Key #3 for displaying static Google Maps in email notifications

#### Generating Google key #1 for Maps in UI

1. Go to *Credentials* tab
2. Press *Create credentials* and select *API key*
3. Key will be displayed in a new window
4. Press *Restrict key* to make changes, you will be taken to a setup page
5. Name the key so would be easier to distinguish it from others
6. In *Application restrictions* select *HTTP referrer* and specify the domain you use for the platform. E.g [contoso.com/\*](http://contoso.com/*) [gps.contoso.com/\*](http://gps.contoso.com/*)
7. In *API restrictions* select *Restrict key* and choose Maps JavaScript API
8. Press *Save* to apply the changes

![](/files/rNJ2ObE359aXk7xnnatM)

![](/files/cidm7PLXuufHhLoD8YAa)

![](/files/IzCINg01bWttKs0i43LB)

![](/files/ABGaKgGlc01BvNPLZb9D)

![](/files/HwlIdFBdf707ubA3RgaO)

#### Generating Google Key #2 for Geocoding, Routing and Geolocation

1. Go to *Credentials* tab
2. Press *Create credentials* and select *API key*
3. Key will be displayed in a new window
4. Press *Restrict key* to make changes, you will be taken to a setup page
5. Name the key so would be easier to distinguish it from others
6. In *Application restrictions* select *IP adresses* and specify public IP of your server
7. In *API restrictions* select *Restrict key* and choose Maps Geocoding API, Maps Geolocation API, Maps Directions API
8. Press *Save* to apply the changes

![](/files/FShoPDHrmE6kI7SHKdCx)

![](/files/FLSKrfMP5Quu9Tqhq38H)

![](/files/FEawJazSTl5TE7CSxiTT)

![](/files/flwgMUhxlWW4YpO5hA73)

![](/files/sy0CtU0o4VeG6UO9zoEr)

#### **Generating Google Key #3 for Static maps in email notifications**

1. Go to *Credentials* tab
2. Press *Create credentials* and select *API key*
3. Key will be displayed in a new window
4. Press *Restrict key* to make changes, you will be taken to a setup page
5. Name the key so would be easier to distinguish it from others
6. In *Application restrictions* select *HTTP referrer* and specify the domain you use for the platform. E.g [contoso.com/\*](http://contoso.com/*) [gps.contoso.com/\*](http://gps.contoso.com/*)
7. In *API restrictions* select *Restrict key* and choose Maps Static API
8. Press *Save* to apply the changes

![](/files/0HhLa9FoBeW1OK0vCQqJ)

![](/files/kYCCDcOeO0OvaoBs2WMP)

![](/files/GRYhDLy70DBYFzQCJbl9)

![](/files/UgeEnl0O4R6UCDU9QW7n)

![](/files/k5Ve3LFxUqGfDI1b5A4l)

For the Google key #3 you will also need an *URL signing secret*. Please refer to the guide below to generate a URL signing secret for your Static maps key:

1. Go to the *Dashboard*
2. Scroll down to list of APIs and click on Maps Static API
3. You will be forwarded to a new page.
4. Click on *Credentials* menu
5. Check that Maps Static API is selected
6. Scroll down to URL signing secret to see your current one.

![](/files/Wwq2gBMr1WL2NwvgJJyq)

![](/files/dLvC3WUprbpgYZHsixSj)

## Applying Google Maps API keys

As described above, we recommend generating three Google Maps API keys and assign the following Google API services to them:

**Google Maps API key #1** – should be restricted by HTTP referrer, which is your user interface URL:

* Google Maps JavaScript API
* Google Street View Image API

**Google Maps API key #2** – should be restricted by server IP:

* Google Maps Geocoding API
* Google Maps Geolocation API
* Google Maps Directions API

**Google Maps API key #3** – should be restricted by HTTP referrer, which is your user interface URL:

* Google Static Maps API (you also need *URL signing secret* for this key)

All three keys will be stored in the database. They should be inserted into table **dealer\_service\_credentials** of **google** DB with the following query:

{% code overflow="wrap" %}

```
INSERT INTO dealer_service_credentials (dealer_id, service_type,credentials) VALUES (1, 'google', '{"maps_js_api_key":"FIRST_KEY_HERE","server_api_key":"SECOND_KEY_HERE","static_map_api_key":"THIRD_KEY_HERE", "static_map_crypto_key":"URL_SIGNING_SECRET_HERE"}';
```

{% endcode %}

If you don't want to use Google Maps for certain services, you can omit the keys that you don't need from the query. For example, use this query to apply the third key only:

{% code overflow="wrap" %}

```
INSERT INTO google.dealer_service_credentials (dealer_id, service_type, credentials) VALUES (1, "google", '{"static_map_api_key":"THIRD_KEY_HERE", "static_map_crypto_key":"URL_SIGNING_SECRET_HERE"}');
```

{% endcode %}

**Restart the services**

`restart-navixy`


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://navixy.com/docs/on-premise/on-premise/how-to-guide/configuration/maps-and-gis/google-maps-and-geocoding.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
