Search for content

Quick Start - Geocoding API

With the Geocoding service you can find locations by converting street addresses into GPS-coordinates and vice versa. The Places service allows to search for millions of shops and prominent points of interest in various categories.

Using the Geocoding & Places API is simple. Follow the steps on this page to get started with geocoding. For an easy integration you can also use the clients for Java, C# and TypeScript on GitHub.

Please note the individual rate and request limits for each API. You can find all limits in our FAQ.

API Endpoint

To get you started we will use the following endpoint, which will find the position of a given text string.

https://api.myptv.com/geocoding/v1/locations/by-text

Request

For a simple GET call to geocode the location "aan't verlaat 33f", use an encoded input string for the attribute "searchText".

You can test this by entering the URL into your web browser (be sure to replace YOUR_API_KEY with your actual API key).

https://api.myptv.com/geocoding/v1/locations/by-text?searchText=aan%27t%20verlaat%2033f%20&apiKey=YOUR_API_KEY

Alternatively, you can choose one of the following options to send your request. You also have the option to send the API key in the request header.

cURL:

curl --location --request GET "https://api.myptv.com/geocoding/v1/locations/by-text?searchText=aan%27t%20verlaat%2033f%20" --header "ApiKey: YOUR_API_KEY"

PowerShell:

$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("ApiKey", "YOUR_API_KEY")
$response = Invoke-RestMethod "https://api.myptv.com/geocoding/v1/locations/by-text? \
searchText=aan''t verlaat 33f" -Method GET -Headers $headers
$response | ConvertTo-Jso

Get your free API Access Key

Response

Below, you find a possible result list for the input we gave with all address fields and geographic positions as well as the related scoring values.

{
  "locations": [
    {
      "referencePosition": {
        "latitude": 52.02085876464844,
        "longitude": 4.363800048828125
      },
      "roadAccessPosition": {
        "latitude": 52.020320892333984,
        "longitude": 4.364419937133789
      },
      "address": {
        "countryName": "Nederland",
        "state": "Zuid-Holland",
        "province": "",
        "postalCode": "2612 XZ",
        "city": "Delft",
        "district": "",
        "subdistrict": "",
        "street": "Aan 't Verlaat",
        "houseNumber": "33F"
      },
      "formattedAddress": "Aan 't Verlaat 33F, 2612 XZ Delft",
      "locationType": "EXACT_ADDRESS",
      "quality": {
        "totalScore": 100
      }
    }
  ]
}