เอกสาร MapScale

MapScale API

เอกสารอ้างอิงจาก contract สำหรับ auth, parameters, response codes และตัวอย่าง curl

Autocomplete

คำแนะนำสถานที่สำหรับกล่องค้นหาและตัวเลือกบนแผนที่ คิด usage ตาม session

GET/v1/autocomplete

เติมคำค้นหาสถานที่หรือที่อยู่

Autocomplete suggestions. Backed by Photon (v1) -> ES phonetic (v1.5). Billing SKU: autocomplete (per session, not per keystroke).

endpoint สาธารณะ3 response code6 parameter
ชื่อตำแหน่งชนิดจำเป็น
qquerystringใช่
langquerystringไม่
session_tokenquerystringไม่
bboxquerystringไม่
proximityquerystringไม่
typesquerystringไม่
200400404
curl
curl \
  -H "X-MapScale-Key: $MAPSCALE_API_KEY" \
  "https://api.mapscale.io/v1/autocomplete?q=13.7563&lang=example&session_token=example"
  • Geocoding

Geocoding

แปลงที่อยู่เป็นพิกัด แปลงพิกัดเป็นที่อยู่ ดู place detail และค้นหาเขตการปกครองไทย

GET/v1/admin-areas/reverse

ค้นหาเขตการปกครองไทยจากพิกัด

Point-in-polygon admin-area lookup over geography.* (PostGIS ST_Contains). Billing SKU: geocode.

endpoint สาธารณะ3 response code2 parameter
ชื่อตำแหน่งชนิดจำเป็น
pointquerystringใช่
langquerystringไม่
200400404
curl
curl \
  -H "X-MapScale-Key: $MAPSCALE_API_KEY" \
  "https://api.mapscale.io/v1/admin-areas/reverse?point=13.7563&lang=example"
  • Geocoding
GET/v1/geocode

แปลงชื่อสถานที่หรือที่อยู่เป็นพิกัด

Forward geocode. Backed by Photon /api. Billing SKU: geocode.

endpoint สาธารณะ3 response code6 parameter
ชื่อตำแหน่งชนิดจำเป็น
qquerystringใช่
langquerystringไม่
limitqueryintegerไม่
bboxquerystringไม่
proximityquerystringไม่
countryquerystringไม่
200400404
curl
curl \
  -H "X-MapScale-Key: $MAPSCALE_API_KEY" \
  "https://api.mapscale.io/v1/geocode?q=13.7563&lang=example&limit=example"
  • Geocoding
GET/v1/place/{id}

ดึงข้อมูลสถานที่จาก ID

Place details, by a photon:... id (from /v1/geocode or /v1/autocomplete) or a mapscale places.places uuid. Billing SKU: geocode (free if same session).

endpoint สาธารณะ3 response code2 parameter
ชื่อตำแหน่งชนิดจำเป็น
idpathstringใช่
langquerystringไม่
200400404
curl
curl \
  -H "X-MapScale-Key: $MAPSCALE_API_KEY" \
  "https://api.mapscale.io/v1/place/example-id?lang=example"
  • Geocoding
GET/v1/reverse

แปลงพิกัดเป็นที่อยู่

Reverse geocode. Backed by Photon /reverse, enriched with PostGIS admin-area names. Billing SKU: geocode.

endpoint สาธารณะ3 response code3 parameter
ชื่อตำแหน่งชนิดจำเป็น
pointquerystringใช่
langquerystringไม่
zoomqueryintegerไม่
200400404
curl
curl \
  -H "X-MapScale-Key: $MAPSCALE_API_KEY" \
  "https://api.mapscale.io/v1/reverse?point=13.7563&lang=example&zoom=example"
  • Geocoding

Routes

เส้นทางและ isochrone จากข้อมูล routing ที่ปรับให้เหมาะกับประเทศไทย

GET/v1/isochrone

สร้างพื้นที่ตามเวลาเดินทาง

Time/distance reachability polygons around a point. Backed by Valhalla /isochrone. Billing SKU: routing.

endpoint สาธารณะ3 response code3 parameter
ชื่อตำแหน่งชนิดจำเป็น
pointquerystringใช่
profilequerystringไม่
contoursquerystringใช่
200400502
curl
curl \
  -H "X-MapScale-Key: $MAPSCALE_API_KEY" \
  "https://api.mapscale.io/v1/isochrone?point=13.7563&profile=example&contours=100.5018"
  • Routing
GET/v1/route

คำนวณเส้นทางด้วย query parameters

Route between 2+ waypoints. Backed by Valhalla /route. Billing SKU: routing.

endpoint สาธารณะ3 response code4 parameter
ชื่อตำแหน่งชนิดจำเป็น
coordinatesquerystringใช่
profilequerystringไม่
alternativesquerybooleanไม่
langquerystringไม่
200400502
curl
curl \
  -H "X-MapScale-Key: $MAPSCALE_API_KEY" \
  "https://api.mapscale.io/v1/route?coordinates=13.7563&profile=example&alternatives=example"
  • Routing
POST/v1/route

คำนวณเส้นทางด้วย JSON body

Route between 2+ waypoints. Backed by Valhalla /route. Billing SKU: routing.

endpoint สาธารณะ3 response code0 parameter
Request bodyไม่บังคับ application/json
200400502
curl
curl \
  -X POST \
  -H "X-MapScale-Key: $MAPSCALE_API_KEY" \
  "https://api.mapscale.io/v1/route"
  • Routing

Matrix

ตารางเวลาเดินทางและระยะทางสำหรับ dispatch, ranking และตรวจ coverage

POST/v1/matrix

คำนวณ route matrix

Travel-time/distance matrix, capped at 25x25 in v1. Backed by Valhalla /sources_to_targets. Billing SKU: matrix (per element).

endpoint สาธารณะ3 response code0 parameter
Request bodyไม่บังคับ application/json
200400502
curl
curl \
  -X POST \
  -H "X-MapScale-Key: $MAPSCALE_API_KEY" \
  "https://api.mapscale.io/v1/matrix"
  • Routing

Tiles

Vector tiles สำหรับแผนที่แบบ interactive บน MapLibre

GET/tiles/v1/{tileset}/{z}/{x}/{yFile}

ดึง vector tile

endpoint สาธารณะ3 response code4 parameter
ชื่อตำแหน่งชนิดจำเป็น
tilesetpathstringใช่
zpathintegerไม่
xpathintegerไม่
yFilepathstringใช่
200404503
curl
curl \
  -H "X-MapScale-Key: $MAPSCALE_API_KEY" \
  "https://api.mapscale.io/tiles/v1/example-tileset/1/1/example.json"
  • Tiles

Static maps

ภาพแผนที่ที่ render จาก server สำหรับ preview, email และการแชร์

GET/v1/static/{lonLatZoom}/{sizeFile}

เรนเดอร์ภาพแผนที่แบบ static

endpoint สาธารณะ5 response code7 parameter
ชื่อตำแหน่งชนิดจำเป็น
lonLatZoompathstringใช่
sizeFilepathstringใช่
styleIdquerystringไม่
langquerystringไม่
accentquerystringไม่
markersquerystringไม่
pathquerystringไม่
200400404502503
curl
curl \
  -H "X-MapScale-Key: $MAPSCALE_API_KEY" \
  "https://api.mapscale.io/v1/static/example-lonLatZoom/example.json?styleId=example&lang=example&accent=example"
  • Static maps

Styles

เอกสาร MapLibre style ที่อ้างถึง tiles, glyphs และ sprites ของ MapScale

GET/styles/v1/{styleId}

ดึง MapLibre style

endpoint สาธารณะ1 response code4 parameter
ชื่อตำแหน่งชนิดจำเป็น
styleIdpathstringใช่
langquerystringไม่
accentquerystringไม่
hidequerystring[] | stringไม่
200
curl
curl \
  -H "X-MapScale-Key: $MAPSCALE_API_KEY" \
  "https://api.mapscale.io/styles/v1/example-styleId?lang=example&accent=example&hide=example"
  • Styles

Glyphs และ sprites

ชุดฟอนต์และ sprite assets ที่ MapLibre style ใช้งาน

GET/fonts/v1/{fontstack}/{rangeFile}

ดึงชุด glyph ของฟอนต์

endpoint สาธารณะ2 response code2 parameter
ชื่อตำแหน่งชนิดจำเป็น
fontstackpathstringใช่
rangeFilepathstringใช่
302503
curl
curl \
  -H "X-MapScale-Key: $MAPSCALE_API_KEY" \
  "https://api.mapscale.io/fonts/v1/example-fontstack/0-255.pbf"
  • ฟอนต์
GET/sprites/v1/{styleId}/{filename}

ดึงไฟล์ sprite ของแผนที่

endpoint สาธารณะ2 response code2 parameter
ชื่อตำแหน่งชนิดจำเป็น
styleIdpathstringใช่
filenamepathstringใช่
302503
curl
curl \
  -H "X-MapScale-Key: $MAPSCALE_API_KEY" \
  "https://api.mapscale.io/sprites/v1/example-styleId/example.json"
  • Sprites

Health และ contract

endpoint ตรวจสถานะและ OpenAPI document แบบ public

GET/v1/health

ตรวจสอบว่า service ยังทำงานอยู่

endpoint สาธารณะ1 response code0 parameter
200
curl
curl \
  -H "X-MapScale-Key: $MAPSCALE_API_KEY" \
  "https://api.mapscale.io/v1/health"
  • Health
GET/v1/status

ตรวจสอบสถานะ dependency

endpoint สาธารณะ1 response code0 parameter
200
curl
curl \
  -H "X-MapScale-Key: $MAPSCALE_API_KEY" \
  "https://api.mapscale.io/v1/status"
  • Health
POST/v1/trial-key

สร้าง publishable trial key แบบจำกัดการใช้งาน

Creates a trial account and a browser-safe `pk_test_*` key for client-side MapScale integration. The key is restricted to tiles, autocomplete and static maps.

endpoint สาธารณะ3 response code0 parameter
Request bodyจำเป็น application/json
201400429
curl
curl \
  -X POST \
  -H "X-MapScale-Key: $MAPSCALE_API_KEY" \
  "https://api.mapscale.io/v1/trial-key"
  • keys

On this page