Search for content

Quick Start - Geocoding OSM API [EXPERIMENTAL]

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

Using the Geocoding API is simple. Follow the steps on this page to get started with geocoding.

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-osm/v1/places/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-osm/v1/places/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-osm/v1/places/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-osm/v1/places/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.

{
  "places": [
    {
      "referencePosition": {
        "latitude": 52.0206272,
        "longitude": 4.3637008
      },
      "boundingBox": {
        "left": 4.3636508,
        "bottom": 52.0205772,
        "right": 4.3637508,
        "top": 52.0206772
      },
      "formattedAddress": "33F, Aan 't Verlaat, Bomenwijk, Vrijenban, Delft, Zuid-Holland, Nederland, 2612 XW, Nederland",
      "category": "place",
      "type": "house"
    }
  ]
}