שאלות נפוצות בנושא קידוד גיאוגרפי
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
כאן נענה על שאלות ספציפיות לגבי Geocoding API.
שאלות נפוצות על הפלטפורמה של מפות Google כדאי לעיין גם במאמר שיטות מומלצות ליצירת קואורדינטות של כתובות.
פתרון בעיות
פתרון בעיות
-
אני מקבל יותר שאילתות שמחזירות את הערך ZERO_RESULTS באמצעות המקודד הגיאוגרפי. מה הבעיה?
-
בשרת המיפוי הגיאוגרפי, שאילתות לא ברורות, חלקיות או בפורמט שגוי, כמו כתובות עם שגיאות כתיב או כתובות לא קיימות, עלולות להוביל לסטטוס ZERO_RESULTS.
אם לא ניתן למצוא את הכתובת, עדיף להשתמש ב-ZERO_RESULTS במקום בתוצאה חלקית (לדוגמה, החזרת השכונה בלבד במקום כתובת).
אם האפליקציה שלכם מטפלת בהזנת כתובות על ידי משתמשים, התכונה השלמה אוטומטית למקומות ב-Places API עשויה לספק תוצאות באיכות טובה יותר.
השלמה אוטומטית של מקומות מאפשרת למשתמשים לבחור מתוך קבוצה של תוצאות על סמך מה שהם הקלידו. כך הם יכולים לבחור בין תוצאות עם שמות דומים, ולשנות את השאילתה אם הם שגיבו בהקלדה של כתובת.
אם יש לכם אפליקציה שמטפלת בשאילתות לא ברורות או חלקיות, או בשאילתות שעשויות להכיל שגיאות, מומלץ להשתמש בתכונה השלמה אוטומטית למקומות ב-Places API במקום בשירות הקידוד הגיאוגרפית הקידמי שזמין ב-Geocoding API. פרטים נוספים זמינים במאמר
שיטות מומלצות לקידוד כתובות ובפוסט
קידוד כתובות בבלוג של Google Maps APIs.
-
אני צריך תשובות מהירות, והמקודד הגיאוגרפי איטי מדי לאפליקציה שלי. איך אפשר לקבל תשובות מהר יותר?
-
אנחנו ממליצים לאפליקציות שמגיבות להזנת משתמשים, ולכן רגישות מאוד לזמן אחזור, להשתמש בתכונה Place Autocomplete ב-Places API (זמינה גם ב-JavaScript, ב-Android או ב-iOS) במקום לבצע גיאוקודינג של כתובות.
השלמה אוטומטית למקומות עברה אופטימיזציה לשימוש אינטראקטיבי, ולכן זמן האחזור שלה נמוך מאוד.
קידוד כתובות ב-Geocoding API מותאם לשימוש עם כתובות מלאות, ברורות ועם פורמט תקין, כמו כתובות למשלוח שמוזנות בטפסים אונליין. לכן, זמן האחזור שלו ארוך יותר מזה של ההשלמה האוטומטית של מקומות. למקודד הגיאוגרפיה המקדים יש כיסוי רחב יותר ואיכות תוצאות טובה יותר, אבל זמן אחזור ארוך יותר.
-
איך אפשר לצמצם את זמן האחזור ב-Directions API (מדור קודם) וב-Distance Matrix API (מדור קודם)?
-
במקום כתובות, צריך להשתמש במזהי מקומות כדי לציין נקודות דרך, מוצא ויעד. מומלץ לקבל את מזהי המקומות באמצעות התכונה Place Autocomplete ב-Places API או באמצעות ספריית המקומות ב-Maps JavaScript API. כדאי לעיין גם במידע על האפשרות
placeIdOnly
, שבעזרתה אפשר לצמצם את העלות של ההשלמה האוטומטית למקומות.
כששולחים שאילתות ל-Directions API (ממשק הקודם) או ל-Distance Matrix API (ממשק הקודם) עם מחרוזת כתובת במקום מזהה מקום או קואורדינטות, הם משתמשים באותו קצה עורפי כמו Geocoding API כדי להמיר את הכתובת הזו למזהה מקום לפני חישוב המסלול. השלמה אוטומטית למקומות מהירה יותר ממיקוד כתובות. באפליקציות שמשתמשות ב-Directions API (ממשק API מדור קודם) או ב-Distance Matrix API (ממשק API מדור קודם) במצבים שבהם זמן האחזור קריטי, כמו תגובה להזנת משתמש, מומלץ להשתמש בהשלמה האוטומטית של מקומות כדי לקבל את מזהי המקומות התואמים לכתובות האלה, ולהעביר את מזהי המקומות ל-Directions API (ממשק API מדור קודם) או ל-Distance Matrix API (ממשק API מדור קודם).
הגישה הזו מקצרת באופן משמעותי את זמן האחזור. במסמכים שלנו מופיעה
דוגמה לשימוש בהשלמה האוטומטית למקומות עם מסלול הגעה.
-
איך מדווחים על באגים במקודד הגיאוגרפיות?
-
אם יש לכם
דיווחים על באגים או
בקשות להוספת תכונות לשירות המקודד הגיאוגרפי להעברה, אתם יכולים לשלוח אותם אלינו דרך
הכלי הציבורי למעקב אחר בעיות.
-
המקודד הגיאוגרפי לא מניב תוצאות טובות בתרחיש לדוגמה שלי. אילו סוגי עזרה זמינים?
-
אתם יכולים לעדכן אותנו באמצעות
כלי המעקב הציבורי אחרי בעיות, ולצרף כמה שאילתות ספציפיות כדי שנוכל לבדוק אם יש באגים או בעיות מערכתיות שגורמות לבעיות באיכות התוצאות, או אם יש שינויים שאפשר לבצע במדריך השיטות המומלצות כדי לעזור למפתחים להשיג תוצאות טובות יותר.
-
איך מקבלים את התוצאות הטובות ביותר מהמקודד הגיאוגרפי באמצעות סינון רכיבים?
-
במקודד הגיאוגרפיה,
סינון הרכיבים אוכף רק את ההגבלות postal_code
ו-country
. בדוגמאות הבאות מוסבר איך להשתמש בצורה הטובה ביותר בסינון רכיבים, בהתאם לתוצאות שאתם צריכים. בכתובות ה-URL לדוגמה של הבקשות, חשוב להחליף את 'YOUR_API_KEY' במפתח ה-API בפועל.
- כדי להגביל את המיקוד למדינה ספציפית, חשוב לציין את הגבלת המדינה באמצעות קוד מדינה לפי תקן ISO 3166-2.
לדוגמה:
components=country:CH|postal_code:8000
מחזירה את הערך '8000 Zürich, Switzerland'.
https://maps.googleapis.com/maps/api/geocode/json?components=country:CH%7Cpostal_code:8000&key=YOUR_API_KEY
- כדי להגביל שאילתות למדינה ספציפית, חשוב לציין את הגבלת המדינה באמצעות קוד מדינה לפי תקן ISO 3166-2. ייתכן ששמות של מדינות וקיצורים אחרים לא יניבו את אותן תוצאות כמו קודי המדינות.
דוגמאות:
- כתוצאה מהמיקוד הגיאוגרפי של
components=country:FRA|locality:gallus
, מוצגת קטגוריית המשנה Gallus בפרנקפורט אם מיין, גרמניה. הסיבה לכך היא שקוד המדינה של צרפת (FRA) בן 3 האותיות לא נתמך, ולכן התוצאות מכל מדינה מותרות, והתוצאה בפרנקפורט מתאימה יותר מכל תוצאה בצרפת.
https://maps.googleapis.com/maps/api/geocode/json?components=country:FRA%7Clocality:gallus&key=YOUR_API_KEY
- לא בטוח שממשק Geocoding API יחזיר כמה תוצאות לשאילתות לא ברורות. לשאילתות כאלה עדיף להשתמש בתכונה 'השלמה אוטומטית של מקומות'.
דוגמאות:
- מערכת הגיאוקוד של
components=country:US|locality:madrid
מחזירה את הערך "Madrid, NM 87010, USA", אבל לא אף אחת מהערים האחרות בארה"ב שנקראות Madrid.
https://maps.googleapis.com/maps/api/geocode/json?components=country:US%7Clocality:madrid&key=YOUR_API_KEY
- שימוש בהשלמה האוטומטית של מקומות עבור
input=madrid&components=country:us&types=(regions)
, וגם ציון חלון תצוגה באמצעות location
ו-radius
כדי
להטות את תוצאות המיקום, יוצר תגובה עם כמה ערים בארצות הברית שנקראות 'Madrid'.
https://maps.googleapis.com/maps/api/place/autocomplete/json?location=37.386052,-122.083851&radius=10000&input=madrid&components=country:us&types=(regions)&key=YOUR_API_KEY
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-08-31 (שעון UTC).
[null,null,["עדכון אחרון: 2025-08-31 (שעון UTC)."],[[["\u003cp\u003eThis FAQ addresses questions about the Geocoding API; for general Google Maps Platform questions, refer to the Google Maps Platform FAQ.\u003c/p\u003e\n"],["\u003cp\u003eFor applications with user input and latency sensitivity, Google recommends using Place Autocomplete instead of address geocoding for better results and speed.\u003c/p\u003e\n"],["\u003cp\u003eTo improve latency with the Directions or Distance Matrix APIs, use place IDs obtained from Place Autocomplete instead of addresses.\u003c/p\u003e\n"],["\u003cp\u003eYou can report bugs or request features for the Geocoding API through the public issue tracker.\u003c/p\u003e\n"],["\u003cp\u003eComponent filtering in the Geocoding API is primarily used to restrict results by country and postal code.\u003c/p\u003e\n"]]],[],null,["This FAQ covers questions specific to the Geocoding API.\nRefer to the [Google Maps Platform FAQ](/maps/faq) for questions\ncommon to all Google Maps Platform. See also\n[Best Practices When Geocoding Addresses](/maps/documentation/geocoding/best-practices).\n\nTroubleshooting\n\n- [I'm getting more queries that return ZERO_RESULTS with the geocoder. What's going on?](#trbl-zero-results)\n- [I need fast responses, and the geocoder is too slow for my application. What can\n I use for faster responses?](#trbl-slow)\n- [How can I mitigate the latency on the Directions API (Legacy) and\n Distance Matrix API (Legacy)?](#trbl-latency)\n- [How do I report bugs in the geocoder?](#trbl-report-bug)\n- [The geocoder isn't producing good results for my use case. What help is available?](#trbl-help)\n- [How do I get the best results with the geocoder using component filtering?](#trbl-component-filtering)\n\nTroubleshooting\n\n\nI'm getting more queries that return ZERO_RESULTS with the geocoder. What's going on?\n\n: In the geocoder, ambiguous, incomplete and badly formatted queries, such as\n misspelled or nonexistent addresses, are prone to produce ZERO_RESULTS.\n If the address cannot be found, ZERO_RESULTS is preferable to a partial\n result (for example returning only the suburb in lieu of an address).\n\n If your application deals with user input of addresses, the\n [Place Autocomplete](/maps/documentation/places/web-service/autocomplete) feature\n in the Places API may produce better quality results.\n Place Autocomplete allows users to select from a set of results based on what\n they've typed, which allows users to choose between similarly named results,\n and to adjust their query if they misspell an address.\n\n If you have an application dealing with ambiguous or incomplete queries or queries\n that may contain errors, we recommend you use the\n [Place Autocomplete](/maps/documentation/places/web-service/autocomplete) feature\n in the Places API rather than the forward geocoder\n available in the Geocoding API. For more details, see\n [Best Practices When Geocoding Addresses](/maps/documentation/geocoding/best-practices) and the\n [Address Geocoding in the Google Maps APIs blog post](https://mapsplatform.google.com/resources/blog/address-geocoding-in-google-maps-apis/).\n\n\nI need fast responses, and the geocoder is too slow for my application. What can\nI use for faster responses?\n\n: We recommend that applications that respond to user input, and therefore are highly\n latency-sensitive, use the [Place Autocomplete](/maps/documentation/places/web-service/autocomplete)\n feature in the Places API (also available in\n [JavaScript](/maps/documentation/javascript/places-autocomplete),\n [Android](/maps/documentation/places/android-sdk/autocomplete), or\n [iOS](/maps/documentation/places/ios-sdk/autocomplete)) rather than address geocoding.\n Place Autocomplete is optimized to be used interactively, and thus has very low latency.\n\n Address geocoding in the Geocoding API is optimized for use with\n complete, unambiguous, well formatted addresses, such as delivery addresses entered into\n online forms, and thus has higher latency than Place Autocomplete. The forward geocoder\n has greater coverage and better result quality, but with somewhat higher latency.\n\n\nHow can I mitigate the latency on the Directions API (Legacy) and\nDistance Matrix API (Legacy)?\n\n: Instead of addresses, use [place IDs](/maps/documentation/places/web-service/place-id) to\n specify waypoints, origin, and destination. Place IDs are best obtained from the\n [Place Autocomplete](/maps/documentation/places/web-service/autocomplete)\n feature in the Places API or the\n [Places library](/maps/documentation/javascript/places-autocomplete) in the\n Maps JavaScript API. See also the information on the\n [`placeIdOnly`](/maps/documentation/javascript/places-autocomplete#placeidonly) option, which can be used to reduce the cost of\n Place Autocomplete.\n\n When the Directions API (Legacy) or Distance Matrix API (Legacy)\n is queried with an address string rather than a place ID or latlng, they use the same\n backend as the Geocoding API to convert that address into a\n place ID prior to calculating directions. Place Autocomplete is faster than address\n geocoding. For applications that use the Directions API (Legacy) or\n Distance Matrix API (Legacy) in highly latency-sensitive situations, such as\n responding to user input, we recommended you use Place Autocomplete to get the place IDs\n corresponding to those addresses, and pass the place IDs to the\n Directions API (Legacy) or Distance Matrix API (Legacy).\n This approach reduces latency significantly. See our documentation for an\n [example of how to use Place Autocomplete with directions](/maps/documentation/javascript/examples/places-autocomplete-directions).\n\n\nHow do I report bugs in the geocoder?\n\n: If you have any\n [bug reports](https://issuetracker.google.com/savedsearches/558483) or\n [feature requests](https://issuetracker.google.com/issues/new?component=188871&template=788905) for the forward geocoder service, let us know using our public\n [issue tracker](https://issuetracker.google.com/issues/new?component=188871&template=788906).\n\n\nThe geocoder isn't producing good results for my use case. What help is available?\n\n: Let us know using our public\n [issue tracker](https://issuetracker.google.com/savedsearches/558483), sharing a few specific queries, so we can investigate to\n see if there are any bugs or systemic issues causing problems with result\n quality, or if there are any changes we can make to the\n [best practices guide](/maps/documentation/geocoding/best-practices)\n to help developers get better results.\n\n\nHow do I get the best results with the geocoder using component filtering?\n\n: In the geocoder, [component filtering](/maps/documentation/geocoding/overview#component-filtering) enforces only `postal_code` and\n `country` restrictions. The following examples illustrate how best to use component\n filtering, depending on the results you need. In the sample request URLs, be sure to\n replace \\`YOUR_API_KEY\\` with your actual API key.\n\n - To restrict postal codes to a specific country, be sure to specify the country restriction using an [ISO 3166-2 country code](https://en.wikipedia.org/wiki/ISO_3166-2). For example: `components=country:CH|postal_code:8000` returns \"8000 Zürich, Switzerland\". \n\n ```scdoc\n https://maps.googleapis.com/maps/api/geocode/json?components=country:CH%7Cpostal_code:8000&key=YOUR_API_KEY\n ```\n - To restrict queries to a specific country, be sure to specify the country restriction using an [ISO 3166-2 country code](https://en.wikipedia.org/wiki/ISO_3166-2). Country names and other abbreviations may not produce the same results as country codes.\n\n Examples:\n - Geocoding for `components=country:FRA|locality:gallus` returns the sublocality of Gallus in Frankfurt am Main, Germany. This is because the 3-letter country code for France (FRA) isn't supported, thus results in any country are allowed and the result in Frankfurt is a better fit than anything in France. \n\n ```scdoc\n https://maps.googleapis.com/maps/api/geocode/json?components=country:FRA%7Clocality:gallus&key=YOUR_API_KEY\n ```\n - Geocoding API won't necessarily return multiple results for ambiguous queries. Such queries are better answered by the Place Autocomplete. Examples:\n\n - Geocoding for `components=country:US|locality:madrid` returns \"Madrid, NM 87010, USA\" but none of the other cities in the USA named \"Madrid\". \n\n ```scdoc\n https://maps.googleapis.com/maps/api/geocode/json?components=country:US%7Clocality:madrid&key=YOUR_API_KEY\n ```\n - Using Place Autocomplete for `input=madrid&components=country:us&types=(regions)`, and also specifying a viewport using `location` and `radius` to [bias the location results](/maps/documentation/places/web-service/autocomplete#location_biasing), generates a response with several cities in the USA named \"Madrid\". \n\n ```carbon\n https://maps.googleapis.com/maps/api/place/autocomplete/json?location=37.386052,-122.083851&radius=10000&input=madrid&components=country:us&types=(regions)&key=YOUR_API_KEY\n ```"]]