Malaysian Daerah Reverse Geocoding Web Service

← Back to Home

Base URL: https://rgeo.mypapit.net

Content-Type: application/x-www-form-urlencoded

Method: POST only


/reverse-geocode

Returns the top 5 nearest locations using KD-Tree spatial nearest neighbor search.

Request

POST /reverse-geocode

ParameterTypeRequiredDescription
latfloatYesLatitude in decimal
lonfloatYesLongitude in decimal
Example Request
curl -X POST https://rgeo.mypapit.net/reverse-geocode \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "lat=1.919&lon=102.92"
Example Response
{
"status": "success",
"result": [
    {
        "State": "Johor",
        "District": "Batu Pahat",
        "Town": "Batu Pahat",
        "Lat": 1.919,
        "Lon": 102.92
    },
    ...
]
}

/reverse-geohash

Returns approximate results using GeoHash lookup.

Request

POST /reverse-geohash

ParameterTypeRequiredDescription
latfloatYesLatitude in decimal
lonfloatYesLongitude in decimal
accuracyintNo1 = GeoHash 4-char (~39 km²), 2 = 5-char (~5 km², default)
Example
curl -X POST https://rgeo.mypapit.net/reverse-geohash \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "lat=1.919&lon=102.92&accuracy=2"

Coordinate Boundaries


Error Responses


Web Client Live Demo

Try the API with a web client demo here:
https://demo.mobilepit.com/mobile/detectlocation/

Docker Implementation

You can run the Daerah Reverse Geocoding API in your own machine using Docker. The image is available at:
https://hub.docker.com/r/mypapit/daerah-geocoder

Example Command
docker run -d -p 15000:15000 -v /usr/local/shared-data:/shared-data -v /var/log:/var/log mypapit/daerah-geocoder:latest

This will start the API service and bind it to port 15000 on your local machine.

Example Running on local machine with Docker
curl -X POST http://localhost:15000/reverse-geohash \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "lat=1.919&lon=102.92&accuracy=2"