แก้ปัญหา
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
เคล็ดลับในการแก้ปัญหาที่พบบ่อยมีดังนี้
เหตุใดรัศมีความแม่นยำจึงกว้างมาก
หากการตอบกลับตำแหน่งทางภูมิศาสตร์แสดงค่าสูงมากในช่องความแม่นยำ บริการอาจระบุตำแหน่งทางภูมิศาสตร์ตาม IP ของคำขอแทนที่จะเป็นจุด WiFi หรือเสาสัญญาณโทรศัพท์มือถือ การตอบกลับประเภทนี้อาจเกิดขึ้นหากบริการไม่รู้จักเสาสัญญาณโทรศัพท์มือถือหรือจุดเข้าถึง
หากต้องการยืนยันว่าบริการระบุตำแหน่งทางภูมิศาสตร์ของจุดเข้าถึงไม่ได้ ให้ตั้งค่า
considerIp
เป็น false ในคำขอ หากการตอบกลับเป็น 404 แสดงว่าคุณ
ยืนยันว่าไม่สามารถระบุตำแหน่งทางภูมิศาสตร์ของออบเจ็กต์ wifiAccessPoints และ cellTowers ได้
ฉันจะแก้ปัญหาข้อผิดพลาดในการตอบกลับได้อย่างไร
หากคำขอทำให้เกิดข้อผิดพลาด ระบบจะแสดงเนื้อหาการตอบกลับข้อผิดพลาดในรูปแบบมาตรฐาน
และตั้งรหัสสถานะ HTTP เป็นสถานะข้อผิดพลาด
การตอบกลับข้อผิดพลาดประกอบด้วยออบเจ็กต์ที่มีออบเจ็กต์ข้อผิดพลาดเดียวที่มีคีย์ต่อไปนี้
code
: รหัสนี้เหมือนกับสถานะ HTTP ของการตอบกลับ
message
: คำอธิบายสั้นๆ ของข้อผิดพลาด
errors
: รายการข้อผิดพลาดที่เกิดขึ้น ข้อผิดพลาดแต่ละรายการจะมีตัวระบุสำหรับ
ประเภทข้อผิดพลาด (สาเหตุ) และคำอธิบายสั้นๆ (ข้อความ)
เช่น การส่ง JSON ที่ไม่ถูกต้องจะแสดงข้อผิดพลาดต่อไปนี้
{
"error": {
"errors": [
{
"domain": "global",
"reason": "parseError",
"message": "Parse Error",
}
],
"code": 400,
"message": "Parse Error"
}
}
สำหรับการทดสอบเพิ่มเติม คุณสามารถรวบรวมข้อมูลจากอุปกรณ์ได้โดยใช้ SDK และ API ต่อไปนี้
คำอธิบายข้อผิดพลาด
ข้อผิดพลาดที่อาจเกิดขึ้นพร้อมคำอธิบายมีดังนี้
เหตุผล |
โดเมน |
รหัสสถานะ HTTP |
คำอธิบาย |
dailyLimitExceeded |
usageLimits |
403 |
คุณดำเนินการเกินขีดจำกัดต่อวันแล้ว |
keyInvalid |
usageLimits |
400 |
คีย์ API ของคุณใช้กับ Geolocation API ไม่ได้ โปรดตรวจสอบ
ว่าได้ใส่คีย์ทั้งหมดแล้ว และคุณได้ซื้อ API
หรือเปิดใช้การเรียกเก็บเงินและเปิดใช้งาน API
เพื่อรับโควต้าโดยไม่มีค่าใช้จ่าย |
userRateLimitExceeded |
usageLimits |
403 |
คุณมีจำนวนคำขอเกินขีดจำกัดที่กำหนดค่าไว้ใน Google Cloud Console
โดยปกติแล้วขีดจำกัดนี้จะตั้งค่าเป็นคำขอต่อวัน คำขอต่อ 100 วินาที
และคำขอต่อ 100 วินาทีต่อผู้ใช้ คุณควรกำหนดค่าขีดจำกัด
เพื่อป้องกันไม่ให้ผู้ใช้รายเดียวหรือกลุ่มเล็กๆ ใช้โควต้าประจำวันจนหมด
ในขณะที่ยังคงอนุญาตให้ผู้ใช้ทุกคนเข้าถึงได้อย่างสมเหตุสมผล
ดูการใช้งาน Capping API
เพื่อกำหนดค่าขีดจำกัดเหล่านี้
|
notFound |
geolocation |
404 |
คำขอถูกต้อง แต่ไม่มีผลลัพธ์ |
parseError |
global |
400 |
เนื้อหาคำขอไม่ใช่ JSON ที่ถูกต้อง ดูรายละเอียดเกี่ยวกับแต่ละฟิลด์ได้ที่ส่วนเนื้อหาคำขอ
|
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-08-31 UTC
[null,null,["อัปเดตล่าสุด 2025-08-31 UTC"],[[["\u003cp\u003eThe Geolocation API uses IP addresses, WiFi points, and cell towers to determine location, with large accuracy radius often indicating IP-based geolocation.\u003c/p\u003e\n"],["\u003cp\u003eTroubleshooting involves examining the error response, which includes an error code, message, and a list of errors with reasons and descriptions.\u003c/p\u003e\n"],["\u003cp\u003eYou can gather additional testing information from devices using the Android Location APIs, Places SDK for Android and iOS.\u003c/p\u003e\n"],["\u003cp\u003ePossible errors include exceeding daily or user request limits, using an invalid API key, and requests returning no results despite being valid.\u003c/p\u003e\n"]]],["If a large accuracy radius is shown, the service may be using the request IP instead of cell towers or WiFi. Test by setting `considerIp` to false; a 404 response confirms no access points were found. Error responses include a `code` (HTTP status), `message`, and an `errors` list with `reason` and `message`. Common errors include `dailyLimitExceeded` (403), `keyInvalid` (400), `userRateLimitExceeded` (403), `notFound` (404), and `parseError` (400) due to invalid JSON.\n"],null,["# Troubleshoot\n\nHere are some tips on troubleshooting common issues.\n\nWhy is the accuracy radius very large?\n--------------------------------------\n\nIf your Geolocation response shows a very high value in the accuracy field, the\nservice may be geolocating based on the request IP, instead of WiFi points or\ncell towers. These kinds of responses can happen if the service does not\nrecognize any cell towers or access points.\n\nTo confirm that the service could not geolocate your access points, set\n`considerIp` to false in your request. If the response is a 404, you've\nconfirmed that your wifiAccessPoints and cellTowers objects could not be geolocated.\n\nHow do I troubleshoot a response error?\n---------------------------------------\n\nIf your request generates an error, the system returns a standard format error\nresponse body and sets the HTTP status code to an error status.\n\nThe error response contains an object with a single error object with the\nfollowing keys:\n\n- `code`: This is the same as the HTTP status of the response.\n- `message`: A short description of the error.\n- `errors`: A list of errors that occurred. Each error contains an identifier for the type of error (the reason) and a short description (the message).\n\nFor example, sending invalid JSON returns the following error: \n\n {\n \"error\": {\n \"errors\": [\n {\n \"domain\": \"global\",\n \"reason\": \"parseError\",\n \"message\": \"Parse Error\",\n }\n ],\n \"code\": 400,\n \"message\": \"Parse Error\"\n }\n }\n\nGather testing information from devices\n---------------------------------------\n\nFor additional testing, you can gather information from your device using the\nfollowing SDKs and APIs:\n\n- **Android devices** : Go to [Places SDK for Android](/maps/documentation/places/android-sdk/current-place), and [Android\n Location APIs](https://developer.android.com/training/location/index.html).\n\n- **iOS devices** : Go to [Places SDK for iOS](/maps/documentation/places/ios-sdk/current-place).\n\nError descriptions\n------------------\n\nHere are the possible errors you might encounter with descriptions.\n\n| Reason | Domain | HTTP Status Code | Description |\n|-------------------------|---------------|------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `dailyLimitExceeded` | `usageLimits` | 403 | You have exceeded your [daily limit](/maps/documentation/geolocation/usage-and-billing#other-usage-limits). |\n| `keyInvalid` | `usageLimits` | 400 | Your API key is not valid for the Geolocation API. Be sure to include the entire key, and that you've either purchased the API or have [enabled billing and activated the API](/maps/documentation/geolocation/get-api-key) to obtain the quota at no charge. |\n| `userRateLimitExceeded` | `usageLimits` | 403 | You have exceeded the request limit that you configured in the Google Cloud console. This limit is typically set as requests per day, requests per 100 seconds, and requests per 100 seconds per user. You should configure your limit to prevent a single or small group of users from exhausting your daily quota, while still allowing reasonable access to all users. See [Capping API Usage](https://cloud.google.com/apis/docs/capping-api-usage) to configure these limits. |\n| `notFound` | `geolocation` | 404 | The request was valid, but no results were returned. |\n| `parseError` | `global` | 400 | The request body is not valid JSON. Refer to the [Request Body](/maps/documentation/geolocation/requests-geolocation#body) section for details on each field. |"]]