با مجموعهها، منظم بمانید ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
Geolocation API سرویسی است که درخواست HTTPS را با برج سلولی و نقاط دسترسی Wi-Fi که یک کلاینت تلفن همراه میتواند شناسایی کند، میپذیرد. مختصات طول و عرض جغرافیایی و شعاع نشان دهنده دقت نتیجه برای هر ورودی معتبر را برمی گرداند.
چرا از API جغرافیایی استفاده کنیم؟
از Geolocation API برای مکان یابی دستگاه های تلفن همراهی که ویژگی های موقعیت جغرافیایی بومی را ارائه نمی دهند، استفاده کنید.
کارهایی که می توانید با API جغرافیایی انجام دهید
با استفاده از Geolocation API، میتوانید از دادههای مکانی از برجهای سلولی و گرههای WiFi برای دریافت موقعیت مکانی دستگاهی که موقعیت جغرافیایی بومی یا GPS ندارد استفاده کنید.
نحوه عملکرد API مکان جغرافیایی
Geolocation API از فیلدهای داده دستگاه سلولی، دادههای برج سلولی و دادههای آرایه نقطه دسترسی WiFi برای برگرداندن مختصات طول و عرض جغرافیایی و شعاع دقت استفاده میکند. یک درخواست HTTPS POST را به همراه یک بدنه درخواست ساختار یافته JSON به نقطه پایانی خود می پذیرد. مثال زیر نشانی وب درخواست و یک نمونه بدنه درخواست را نشان می دهد:
هنگامی که یک کلید API دارید، می توانید با استفاده از cURL یا Postman شروع به آزمایش API مکان جغرافیایی کنید. برای جزئیات بیشتر به درخواستهای نمونه در راهنمای درخواستهای موقعیت جغرافیایی و پاسخ مراجعه کنید.
3
شناسه سلولی را از برج های رادیویی مختلف دریافت کنید
برای آماده شدن برای استفاده از داده های ارتفاع برای برنامه خود، پاسخ های داده های موقعیت جغرافیایی را کاوش کنید. برای جزئیات بیشتر به پاسخ های موقعیت جغرافیایی مراجعه کنید.
کتابخانه های مشتری موجود
این API را به زبان انتخابی خود از طریق یکی از کتابخانه های سرویس گیرنده زیر فراخوانی کنید:
Java Client، Python Client، Go Client و Node.js Client برای سرویسهای Google Maps، کتابخانههای مشتری پشتیبانی شده توسط جامعه هستند که تحت مجوز Apache 2.0 منبع باز هستند. آنها را از GitHub دانلود کنید، جایی که می توانید دستورالعمل های نصب و کد نمونه را پیدا کنید.
تاریخ آخرین بهروزرسانی 2025-08-09 بهوقت ساعت هماهنگ جهانی.
[[["درک آسان","easyToUnderstand","thumb-up"],["مشکلم را برطرف کرد","solvedMyProblem","thumb-up"],["غیره","otherUp","thumb-up"]],[["اطلاعاتی که نیاز دارم وجود ندارد","missingTheInformationINeed","thumb-down"],["بیشازحد پیچیده/ مراحل بسیار زیاد","tooComplicatedTooManySteps","thumb-down"],["قدیمی","outOfDate","thumb-down"],["مشکل ترجمه","translationIssue","thumb-down"],["مشکل کد / نمونهها","samplesCodeIssue","thumb-down"],["غیره","otherDown","thumb-down"]],["تاریخ آخرین بهروزرسانی 2025-08-09 بهوقت ساعت هماهنگ جهانی."],[[["\u003cp\u003eThe Geolocation API determines the latitude and longitude of a device using cell tower and WiFi access point data, returning results with an accuracy radius.\u003c/p\u003e\n"],["\u003cp\u003eThis API is primarily for devices lacking native geolocation features; devices with such features should leverage HTML5 geolocation or the Geocoding API.\u003c/p\u003e\n"],["\u003cp\u003eBy sending an HTTPS POST request with device data to the API endpoint, developers can retrieve location information for mobile devices.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can utilize various data resources like cell device fields, cell tower data, and WiFi access point data to pinpoint device locations.\u003c/p\u003e\n"],["\u003cp\u003eClient libraries are available in Java, Python, Go, and Node.js for seamless integration with the Geolocation API.\u003c/p\u003e\n"]]],[],null,["The Geolocation API is a service that accepts an HTTPS request with the\ncell tower and Wi-Fi access points that a mobile client can detect. It returns\nlatitude/longitude coordinates and a radius indicating the accuracy of the\nresult for each valid input.\n| **Note** : To get device location information using latitude and longitude coordinates, addresses, or Place IDs, go to the [Geocoding API](/maps/documentation/geocoding/overview).\n\nWhy use the Geolocation API\n\nUse the Geolocation API to locate mobile devices that do not provide native geolocation\nfeatures.\n| For web browsers and mobile devices that ***already provide geolocation capabilities*** , use the following instead:\n|\n| - **Browsers with HTML5 geolocation** : Use the Maps Javascript API. For more information, go to [Geolocation:\n| Displaying User or Device Position on Maps](/maps/documentation/javascript/geolocation).\n| - **Mobile devices geolocation** : Go to [Geocoding API](/maps/documentation/geocoding/overview).\n|\n| For more information on the W3C Geolocation standard, see\n| [W3C Geolocation standard](https://w3c.github.io/geolocation-api/).\n\nWhat you can do with the Geolocation API\n\nWith the Geolocation API, you can use geospatial data from cell towers\nand WiFi nodes to get the location of a device that does not have native geolocation or GPS.\n\nHow the Geolocation API works\n\nThe Geolocation API uses cellular device data fields, cell tower\ndata, and WiFi access point array data to return latitude/longitude coordinates and an accuracy\nradius. It accepts an HTTPS POST request to its endpoint along with a JSON structured request\nbody. The following example shows the request URL and an example request body:\n\n```json\ncurl -X POST \"https://www.googleapis.com/geolocation/v1/geolocate?key=\u003cvar translate=\"no\"\u003eYOUR_API_KEY\u003c/var\u003e\" \\\n-H \"Content-Type: application/json\" \\\n-d \\\n'{ \"homeMobileCountryCode\":310,\n \"homeMobileNetworkCode\":410,\n \"radioType\":\"gsm\",\n \"carrier\":\"Vodafone\",\n \"considerIp\":true\n}'\n```\nThe API can return data for a number of common cellular data fields as indicated below.\n\nResources\n\nThe following table summarizes the fields in the request body of the geolocation endpoint\ncall, along with the type of data provided from such queries.\n\n| Data resources | Data returned | Return format |\n|----------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------|---------------|\n| [Cell device data fields](/maps/documentation/geolocation/requests-geolocation#body) such as carrier, device, and network information. | Latitude/longitude coordinates and an accuracy radius | JSON |\n| [Cell tower data](/maps/documentation/geolocation/requests-geolocation#cell_tower_object), such as location area code and mobile country codes. | Latitude/longitude coordinates and an accuracy radius | JSON |\n| [WiFi access points data](/maps/documentation/geolocation/requests-geolocation#wifi_access_point_object), such as MAC address and signal strength. | Latitude/longitude coordinates and an accuracy radius | JSON |\n\nHow to use the Geolocation API\n\n|---|------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| 1 | **Get set up** | Start with [Set up your Google Cloud project](/maps/documentation/elevation/cloud-setup) and complete the setup instructions that follow. |\n| 2 | **Try a geolocation request** | Once you have an API key, you can start testing out the Geolocation API using cURL or Postman. See [Sample requests](/maps/documentation/geolocation/requests-geolocation#sample-requests) in the Geolocation requests and response guide for details. |\n| 3 | **Get the cellID from different radio towers** | See [Calculating cellID](/maps/documentation/geolocation/requests-geolocation#calculating_cell_id) and [Calculating newRadioCellID](/maps/documentation/geolocation/requests-geolocation#sample-requests) to get access to older and newer towers, respectively. |\n| 4 | **Understand response basics** | Explore the geolocation data responses to prepare to use elevation data for your app. See [Geolocation responses](/maps/documentation/geolocation/requests-geolocation#responses) for details. |\n\nAvailable client libraries\n\nCall this API in the language of\nyour choice through one of the following client libraries:\n\n- [Java\n Client for Google Maps Services](https://github.com/googlemaps/google-maps-services-java)\n- [Python\n Client for Google Maps Services](https://github.com/googlemaps/google-maps-services-python)\n- [Go Client\n for Google Maps Services](https://github.com/googlemaps/google-maps-services-go)\n- [Node.js\n Client for Google Maps Services](https://github.com/googlemaps/google-maps-services-js)\n\nThe Java Client, Python Client, Go Client and Node.js Client for Google Maps\nServices are community-supported client libraries, open sourced under the\n[Apache 2.0 License](http://www.apache.org/licenses/LICENSE-2.0).\nDownload them from GitHub, where you can also find installation instructions and sample code.\n\nWhat's next\n\n- **Get started with sample requests and responses** : Go to [Geolocation request and response](/maps/documentation/geolocation/requests-geolocation)\n- **Follow best practices** : Go to [Web Service Best Practices](/maps/documentation/geolocation/web-service-best-practices).\n- **Understand billing** : Go to [Usage and Billing](/maps/documentation/geolocation/usage-and-billing)."]]