นั่นคือความช่วยเหลือจากตำแหน่ง APIs ต้องทำงานกับพิกัด ตัวอย่างเช่นที่ ค้นพบ endpoint จาก ที่นี่ Geocoding&ค้นหารูปแบบ api v7 ต้องการให้คุณผ่านหนึ่งของ at
, in:bbox
หรือ in:circle
พารามิเตอร์ทั้งหมดพวกเขาทำงานกับพิกัด
สิ่งที่คุณต้องทำคือเพื่อนแรกแปลงเป็นของคุณที่อยู่ของเพื่อจุดพิกัดด้วยโทรหา Geocode endpoint.
ตัวอย่างของ Geocoding ใช้ curl
curl --location --request GET 'https://geocode.search.hereapi.com/v1/geocode?limit=20&q=2609 University Ave, Austin, TX 78712&apiKey=YOUR_API_KEY'
ที่อยู่เหนือร้องขอที่จะคืนค่ากลับมาเป็นการตอบสนองตาม:
{
"items": [
{
"title": "2609 University Ave, Austin, TX 78712-1057, United States",
"id": "here:af:streetsection:ihOI0ch5OPr-Y1e1m65IRC:CgcIBCDKhfpLEAEaBDI2MDk",
"resultType": "houseNumber",
"houseNumberType": "PA",
"address": {
"label": "2609 University Ave, Austin, TX 78712-1057, United States",
"countryCode": "USA",
"countryName": "United States",
"stateCode": "TX",
"state": "Texas",
"county": "Travis",
"city": "Austin",
"district": "University of Texas - Austin",
"street": "University Ave",
"postalCode": "78712-1057",
"houseNumber": "2609"
},
"position": {
"lat": 30.29009,
"lng": -97.73891
},
"access": [
{
"lat": 30.29009,
"lng": -97.73906
}
],
"mapView": {
"west": -97.73995,
"south": 30.28919,
"east": -97.73787,
"north": 30.29099
},
"scoring": {
"queryScore": 1.0,
"fieldScore": {
"state": 1.0,
"city": 1.0,
"streets": [
1.0
],
"houseNumber": 1.0,
"postalCode": 1.0
}
}
}
]
}
ใช้พิกัดกลับมาที่ ตำแหน่ง ทรัพย์สินของการตอบสนองรายการจะหาจุดสนใจอยู่ที่ตำแหน่งที่อยู่