Longdo Map REST API
Suggest
https://search.longdo.com/mapsearch/json/suggest
Request Method: GET/POST Format: application/x-www-form-urlencoded
string keyword: Suggest keyword
CSV area: Geocode of suggest area (Default: Any area)
int offset: Offset of the first result returned (Default: 0)
int limit: Number of results returned (Default: 10)
CSV dataset: Suggest dataset (Default: Default data)
string key: Longdo Map API Key
string callback: JSONP Callback function (Default: Response in JSON)

Response Format: JSON
Object meta: Metadata Object[] data: List of results Example
https://search.longdo.com/mapsearch/json/search
Request Method: GET/POST Format: application/x-www-form-urlencoded
string keyword: Search keyword
CSV area: Geocode of search area (Default: Any area)
number lon: Longitude of the center of result (Default: Silom)
number lat: Latitude of the center of result (Default: Silom)
string span: Span with unit in deg, m or km (Default: Anywhere)
CSV tag: Tag (Default: Any tag)
int offset: Offset of the first result returned (Default: 0)
int limit: Number of results returned (Default: 20)
CSV dataset: Search dataset (Default: Default data)
LocaleCode locale: Language in ISO 639-1 format (Default: th)
string key: Longdo Map API Key
string callback: JSONP Callback function (Default: Response in JSON)

Response Format: JSON
Object meta: Metadata Object[] data: List of results Example
Smart search
https://search.longdo.com/smartsearch/json/search
Request Method: GET/POST Format: application/x-www-form-urlencoded
Accept all parameters of Search API with these additions

ForceSmartSearchFlag forcesmartsearch: Flag to indicate whether to perform SmartSearch function (Default: Only when there are few results)
int forcelimit: Minimum numbers of result from the Search that will not trigger next step of SmartSearch unless the 'forcesmartsearch' is set to 1 (Default: 1)
ExtendedSearchFlag extendedsearch: Perform extended search functions from external services (extra fee might apply) (Default: No extended search)
int extendedlimit: If the 'extendedsearch' is set to 1, this parameter is a minimum of longdo smart search results before using extended search (Default: 3)
string extendedkey: Extended API Key
ExtendedType extendedtype: Extended search type (Default: findplacefromtext)
number exceedtime: Limit time. If exceed, do only raw search. 0 = not use exceed time (Default: 0)
number cache: If equal to 1, enable cache (Default: 0)

Response Format: JSON
Same as Search API with an additional value in each 'data' items Example
Geocoding
https://search.longdo.com/addresslookup/api/addr/geocoding
Request Method: GET/POST Format: application/x-www-form-urlencoded
string text: Address text for search location
string dataset: Additional dataset

Response Format: JSON
Object[] data: List of results string meta: Text input

LookupInfo
string name: Part name
int distance: String similarity distance
boolean prefix: Do the text input have prefix?

Example
Reverse geocoding
https://api.simplethai.net/map/services/address
Request Method: GET/POST Format: application/x-www-form-urlencoded
string id: Search with Longdo Map ID (Optional)
number lon: Search with longitude if id isn't provide (Optional)
number lat: Search with latitude if id isn't provide (Optional)
LocaleCode locale: Language in ISO 639-1 format (Default: th)
any noadmin: Don't include geocode/province/district/subdistrict in the response (Default: Include)
any nopostcode: Don't include postcode in the response (Default: Include)
any noelevation: Don't include elevation in the response (Default: Include)
any noroad: Don't include road in the response (Default: Include)
any noaoi: Don't include area of interest in the response (Default: Include)
any nowater: Don't include water body in the response (Default: Include)
string key: Longdo Map API Key
string callback: JSONP Callback function (Default: Response in JSON)

Response Format: JSON
string geocode: Thailand geocode
string country: Country
string province: Province or equivalent administrative division
string district: District or equivalent administrative division
string subdistrict: Subdistrict or equivalent administrative division
string moo: Village number, if avaliable
string moo_name: Village name, if avaliable
string house_num: House number, if avaliable
string postcode: Thailand postcode
string aoi: Area of interest, if avaliable
string water: Water body, if exist
number elevation: Elevation in meters, if avaliable
string road: Road name, if exist
number road_lon: Nearest position on road
number road_lat: Nearest position on road

On Error
string error: Error message

Example
Batch reverse geocoding
https://api.simplethai.net/map/services/addresses
Request Method: GET/POST Format: application/x-www-form-urlencoded
number[] lon: Search with longitude, up to 100 coordinates (Optional)
number[] lat: Search with latitude, up to 100 coordinates (Optional)
string wkt: Search with well-known text if lon/lat isn't provide, show only admin in the response (Optional)
LocaleCode locale: Language in ISO 639-1 format (Default: th)
any noadmin: Don't include geocode/province/district/subdistrict in the response
any nopostcode: Don't include postcode in the response
any noelevation: Don't include elevation in the response
any noroad: Don't include road in the response
any noaoi: Don't include area of interest in the response
any nowater: Don't include water body in the response
string key: Longdo Map API Key
string callback: JSONP Callback function (Default: Response in JSON)

Response Format: JSON
Object[] List of results in Reverse geocoding API format

On Error
string error: Error message

Example
Geocode / Postcode
https://api.simplethai.net/POIService/json/address
Request Method: GET/POST Format: application/x-www-form-urlencoded
string geocode: Search with geocode (Optional)
string postcode: Search with postcode if geocode isn't provide (Optional)
LocaleCode locale: Language in ISO 639-1 format (Default: th)
string key: Longdo Map API Key
string callback: JSONP Callback function (Default: Response in JSON)

Response Format: JSON
With geocode
string geocode: Geocode
string province: Province
string district: District
string subdistrict: Subdistrict
number lat: Latitude
number lon: Longitude

With postcode
Object[] address: List of areas in this postcode, in 'With geocode' part format

On Error
null : Error occurred

Example
Nearby POI
https://api.simplethai.net/POIService/json/search
Request Method: GET/POST Format: application/x-www-form-urlencoded
CSV area: Geocode of search area (Default: Any area)
number lon: Longitude of the center of result (Default: Silom)
number lat: Latitude of the center of result (Default: Silom)
string span: Span with unit in deg, m or km (Default: Anywhere)
CSV tag: Tag (Default: Any tag)
int zoom: Importantness level of POI (Default: Any)
int offset: Offset of the first result returned (Default: 0)
int limit: Number of results returned (Default: 20)
CSV dataset: POI dataset (Default: Default data)
LocaleCode locale: Language in ISO 639-1 format (Default: th)
string key: Longdo Map API Key
string callback: JSONP Callback function (Default: Response in JSON)

Response Format: JSON
Same as Search API

Example
Calculate route
https://api.simplethai.net/RouteService/json/route/guide
Request Method: GET/POST Format: application/x-www-form-urlencoded
number flon: Longitude of the starting point
number flat: Latitude of the starting point
number tlon: Longitude of the destination
number tlat: Latitude of the destination
RouteMode mode: Search mode (Default: Avoid traffic)
RouteType type: Allow travel method (Default: All type)
LocaleCode locale: Language in ISO 639-1 format (Default: th)
RouteRestrict restrict: Vehicle restriction (Default: none)
Unix time time: Departure time, use with avoid traffic mode (Default: now, Past time is invalid)
int maxresult: Number of results (Default: 1, Max: 8)
string key: Longdo Map API Key
string callback: JSONP Callback function (Default: Response in JSON)

Response Format: JSON
Object meta: Metadata Object[] data: List of results
On Error
Object meta : Metadata Example
Get route path
https://api.simplethai.net/RouteService/json/route/path
Request Method: GET/POST Format: application/x-www-form-urlencoded
int id: Path ID from Calculate route API

Response Format: JSON
Object meta: Metadata Object[] data: List of results, same index as Calculate route API
On Error
Same as Calculate route API, return only 404

Example
Calculate route in GeoJSON
https://api.simplethai.net/RouteService/geojson/route
Request Method: GET/POST Format: application/x-www-form-urlencoded
Accept all parameters of Calculate route API

Response Format: GeoJSON
FeatureCollection FeatureCollection: List of roads Feature Feature: A road
On Error
Same as Calculate route API

Example
Calculate route matrix
https://api.simplethai.net/RouteService/json/route/matrix
Request Method: GET/POST Format: application/x-www-form-urlencoded
number[] flon: Longitude of each starting point, up to 25 coordinates
number[] flat: Latitude of each starting point, up to 25 coordinates
number[] tlon: Longitude of each destination, up to 25 coordinates
number[] tlat: Latitude of each destination, up to 25 coordinates
RouteMode mode: Search mode (Default: Avoid traffic)
RouteType type: Allow travel method (Default: All type)
LocaleCode locale: Language in ISO 639-1 format (Default: th)
RouteRestrict restrict: Vehicle restriction (Default: none)
Unix time time: Departure time, use with avoid traffic mode (Default: now, Past time is invalid)
string key: Longdo Map API Key
string callback: JSONP Callback function (Default: Response in JSON)

Response Format: JSON
Object meta: Metadata Object[][] data: 2D List of results for each starting points and destinations
On Error
Same as Calculate route API, return only 400

Example
Snap to road
https://api.simplethai.net/RouteService/json/route/snap
Request Method: GET/POST Format: application/x-www-form-urlencoded
string wkt: LineString Well-known text

Response Format: JSON
Location[] Snap points for each WKT coordinated

On Error
Same as Calculate route API, return only 400, 410

Example
Get close road
https://api.simplethai.net/RouteService/json/close/get
Request Method: GET
Response Format: JSON
Object[] List of results
Set close road
https://api.simplethai.net/RouteService/json/close/set
Authentication required
Request Method: GET/POST Format: application/x-www-form-urlencoded
string[] polygon: Well-known text of close areas
string[] time: CSV of alternating value between first and last hour of week of each closing period of each area (Default: Always close)

Response Format: JSON
bool result: Result

Example
Traffic speed
https://api.simplethai.net/RouteService/json/traffic/speed
Request Method: GET/POST Format: application/x-www-form-urlencoded
number lon: Longitude
number lat: Latitude
number range: Search range in degree (Default: 0.001, Max: 0.001 ~100m)
LocaleCode locale: Language in ISO 639-1 format or - for multi-language (Default: th)
Unix time time: Set to get predicted data (Default: now, Past time is invalid)
string key: Longdo Map API Key
string callback: JSONP Callback function (Default: Response in JSON)

Response Format: JSON
string road: Road name
string dir: Direction related to road geometry (forward / reverse)
number speed: Speed in m/s
string source: Source of data (real-time / predicted)
number lon: Nearest position on road
number lat: Nearest position on road
Object meta: Error code and message if no data found at the request location

On Error
Same as Calculate route API, return only 400 and 404

Example
Get span area
https://api.simplethai.net/RouteService/json/span/get
Request Method: GET/POST Format: application/x-www-form-urlencoded
number flon: Longitude of the starting point
number flat: Latitude of the starting point
string span: Span with unit in m (meters, up to 30000m) or s (second, up to 1800s)
SpanFlag flag: Result type (Default: All)
string key: Longdo Map API Key
string callback: JSONP Callback function (Default: Response in JSON)

Response Format: JSON
Location from: Starting point
Location[][] lines: Road lines
Location[] polygon: Boundary of span

On Error
Same as Calculate route API, return only 400, 410

Example
TSP (Travelling Salesman Problem) - Route Planner
https://api.longdo.com/route-tsp-v2
Request Method: POST Format: application/x-www-form-urlencoded
number[] lon: Longitude list
number[] lat: Latitude list
boolean cost: Cost (Default: false )
    true : time_step and distance_step details will be included
    false : Only the optimal path without additional information will be returned
boolean otsp: Is Open Loop TSP (Default: false )
    true : Return to start/first point
    false : Do not return to start/first point
RouteMode mode: Search mode (Default: Avoid traffic)
string key: Longdo Map API Key

Response Format: JSON

Status
string status: HTTP status code indicating the success or failure of the request
string message: Description of the status

Request Configuration
boolean otsp: Indicating whether the route is an Open Loop TSP (OTSP)
RouteMode mode: Route search mode, defaulting to 'c' (Avoid traffic)
Object body: Contains detailed information about the route

Route Details Step-by-Step Information
On Error
Return only status and message

Example
Area info
https://api.longdo.com/GeoServiceMS/json/areainfo
Request Method: GET/POST Format: application/x-www-form-urlencoded
GeoJSON polygon: Area

Response Format: JSON
int ms_building: Number of buildings

On Error
string error: Error message

Example
LocaleCode
ForceSmartSearchFlag
ExtendedSearchFlag
ExtendedType
SpanFlag
RouteMode
RouteType
RouteRestrict
TurnCode
TransitRouteMode
TransitRouteType
TransitRouteRestrict
TransitTurnCode