Geocoding API v4 का इस्तेमाल शुरू करना

यूरोपियन इकनॉमिक एरिया (ईईए) के डेवलपर

Geocoding API v4 एक ऐसी सेवा है जो पतों और जगह के आईडी की जियोकोडिंग, रिवर्स जियोकोडिंग, और मंज़िल की जानकारी देती है.

जियोकोडिंग, पतों (जैसे, मोहल्ले का पता) को भौगोलिक निर्देशांकों (जैसे, अक्षांश और देशांतर) में बदलने की प्रोसेस है. इसका इस्तेमाल, मैप पर मार्कर लगाने या मैप को पोज़िशन करने के लिए किया जा सकता है.

रिवर्स जियोकोडिंग, भौगोलिक निर्देशांकों को ऐसे पते में बदलने की प्रोसेस है जिसे इंसान पढ़ सके.

किसी दिए गए जगह के आईडी का पता ढूंढने के लिए, Geocoding API का इस्तेमाल भी किया जा सकता है.

अनुरोध और जवाब का उदाहरण

Geocoding API को HTTP इंटरफ़ेस के ज़रिए ऐक्सेस किया जाता है. यहाँ जियोकोडिंग और रिवर्स जियोकोडिंग के अनुरोधों के उदाहरण दिए गए हैं.

जियोकोडिंग का अनुरोध और जवाब (अक्षांश/देशांतर की जानकारी ढूंढना)

यहां दिए गए उदाहरण में, "1600 Amphitheatre Parkway, Mountain View, CA" के अक्षांश और देशांतर का अनुरोध किया गया है. साथ ही, यह बताया गया है कि आउटपुट JSON फ़ॉर्मैट में होना चाहिए.

curl -H "X-Goog-Api-Key: YOUR_API_KEY" \
"https://geocode.googleapis.com/v4beta/geocode/address/1600+Amphitheatre+Parkway,+Mountain+View,+CA"

इसकी जांच करने के लिए, यूआरएल को अपने वेब ब्राउज़र में डालें. YOUR_API_KEY को अपनी एपीआई कुंजी से बदलना न भूलें. जवाब में पते का अक्षांश और देशांतर शामिल होता है.

डेवलपर गाइड देखें. इसमें आपको इनके बारे में ज़्यादा जानकारी मिलेगी: जियोकोडिंग के अनुरोध वाले यूआरएल बनाना, उपलब्ध पैरामीटर और जवाब को समझना.

यहां JSON में, जियोकोडिंग के जवाब का एक उदाहरण दिया गया है:

{
  "results": [
    {
      "place": "//places.googleapis.com/places/ChIJ2Z2idB66j4ARI43TG-9RoCQ",
      "placeId": "ChIJ2Z2idB66j4ARI43TG-9RoCQ",
      "location": {
        "latitude": 37.4438238,
        "longitude": -122.0869895
      },
      "granularity": "ROOFTOP",
      "viewport": {
        "low": {
          "latitude": 37.4424748197085,
          "longitude": -122.0883384802915
        },
        "high": {
          "latitude": 37.445172780291493,
          "longitude": -122.08564051970852
        }
      },
      "formattedAddress": "1600 Amphitheatre Pkwy, Mountain View, CA 94043, USA",
      "postalAddress": {
        "regionCode": "US",
        "languageCode": "en",
        "postalCode": "94043-1351",
        "administrativeArea": "CA",
        "locality": "Mountain View",
        "addressLines": [
          "1600 Amphitheatre Pkwy"
        ]
      },
      "addressComponents": [
        {
          "longText": "1600",
          "shortText": "1600",
          "types": [
            "street_number"
          ]
        },
        {
          "longText": "Amphitheatre Parkway",
          "shortText": "Amphitheatre Pkwy",
          "types": [
            "route"
          ],
          "languageCode": "en"
        },
        {
          "longText": "Mountain View",
          "shortText": "Mountain View",
          "types": [
            "locality",
            "political"
          ],
          "languageCode": "en"
        },
        {
          "longText": "Santa Clara County",
          "shortText": "Santa Clara County",
          "types": [
            "administrative_area_level_2",
            "political"
          ],
          "languageCode": "en"
        },
        {
          "longText": "California",
          "shortText": "CA",
          "types": [
            "administrative_area_level_1",
            "political"
          ],
          "languageCode": "en"
        },
        {
          "longText": "United States",
          "shortText": "US",
          "types": [
            "country",
            "political"
          ],
          "languageCode": "en"
        },
        {
          "longText": "94043",
          "shortText": "94043",
          "types": [
            "postal_code"
          ]
        },
        {
          "longText": "1351",
          "shortText": "1351",
          "types": [
            "postal_code_suffix"
          ]
        }
      ],
      "types": [
        "premise",
        "street_address"
      ]
    }
  ]
}

रिवर्स जियोकोडिंग का अनुरोध और जवाब (पते की जानकारी ढूंढना)

नीचे दिए गए उदाहरण में, अमेरिका के न्यूयॉर्क शहर के ब्रुकलिन में मौजूद किसी अक्षांश/देशांतर के हिसाब से पते का अनुरोध किया गया है. इससे पता चलता है कि आउटपुट JSON फ़ॉर्मैट में होना चाहिए.

https://geocode.googleapis.com/v4beta/geocode/location/37.4225508,-122.0846338?key=YOUR_API_KEY

इसे आज़माने के लिए, अपने वेब ब्राउज़र में यूआरएल डालें. 'YOUR_API_KEY' को अपने असली एपीआई पासकोड से बदलना न भूलें. जवाब में अक्षांश और देशांतर के हिसाब से जगह की जानकारी देने वाला पता शामिल है, ताकि लोग उसे आसानी से समझ सकें.

डेवलपर गाइड देखें. इसमें आपको इनके बारे में ज़्यादा जानकारी मिलेगी: रिवर्स जियोकोडिंग के अनुरोध वाले यूआरएल बनाना, उपलब्ध पैरामीटर, और जवाब को समझना.

यहां JSON में, रिवर्स जियोकोडिंग के जवाब का एक उदाहरण दिया गया है:

{
  "results": [
    {
      "place": "//places.googleapis.com/places/ChIJHRNUiQK6j4ARJ__Hrbt6qsE",
      "placeId": "ChIJHRNUiQK6j4ARJ__Hrbt6qsE",
      "location": {
        "latitude": 37.4225657,
        "longitude": -122.08465439999999
      },
      "granularity": "ROOFTOP",
      "viewport": {
        "low": {
          "latitude": 37.421214719708509,
          "longitude": -122.08603273029148
        },
        "high": {
          "latitude": 37.423912680291508,
          "longitude": -122.0833347697085
        }
      },
      "bounds": {
        "low": {
          "latitude": 37.4225178,
          "longitude": -122.08484599999998
        },
        "high": {
          "latitude": 37.422609600000008,
          "longitude": -122.0845215
        }
      },
      "formattedAddress": "Google Building 40, 1600 Amphitheatre Pkwy, Mountain View, CA 94043, USA",
      "postalAddress": {
        "regionCode": "US",
        "languageCode": "en",
        "postalCode": "94043",
        "administrativeArea": "CA",
        "locality": "Mountain View",
        "addressLines": [
          "Google Building 40",
          "1600 Amphitheatre Pkwy"
        ]
      },
      "addressComponents": [
        {
          "longText": "Google Building 40",
          "shortText": "Google Building 40",
          "types": [
            "premise"
          ],
          "languageCode": "en"
        },
        {
          "longText": "1600",
          "shortText": "1600",
          "types": [
            "street_number"
          ]
        },
        {
          "longText": "Amphitheatre Parkway",
          "shortText": "Amphitheatre Pkwy",
          "types": [
            "route"
          ],
          "languageCode": "en"
        },
        {
          "longText": "Mountain View",
          "shortText": "Mountain View",
          "types": [
            "locality",
            "political"
          ],
          "languageCode": "en"
        },
        {
          "longText": "Santa Clara County",
          "shortText": "Santa Clara County",
          "types": [
            "administrative_area_level_2",
            "political"
          ],
          "languageCode": "en"
        },
        {
          "longText": "California",
          "shortText": "CA",
          "types": [
            "administrative_area_level_1",
            "political"
          ],
          "languageCode": "en"
        },
        {
          "longText": "United States",
          "shortText": "US",
          "types": [
            "country",
            "political"
          ],
          "languageCode": "en"
        },
        {
          "longText": "94043",
          "shortText": "94043",
          "types": [
            "postal_code"
          ]
        }
      ],
      "types": [
        "street_address",
        "subpremise"
      ]
    },
    ... Additional results truncated in this example[] ...
}

पुष्टि करना, कोटा, कीमत, और नीतियां

पुष्टि करना

Geocoding API का इस्तेमाल करने के लिए, आपको सबसे पहले एपीआई चालू करना होगा और पुष्टि करने के लिए सही क्रेडेंशियल पाने होंगे. ज़्यादा जानकारी के लिए, Google Maps Platform का इस्तेमाल शुरू करना लेख पढ़ें.

कोटा और कीमत

Geocoding API के लिए तय किए गए कोटे और कीमत के बारे में ज़्यादा जानने के लिए, इस्तेमाल और बिलिंग पेज देखें.

नीतियां

Geocoding API का इस्तेमाल, एपीआई की नीतियों के मुताबिक होना चाहिए.