परतें
संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
प्लैटफ़ॉर्म चुनें:
Android
JavaScript
लेयर, मैप पर मौजूद ऐसे ऑब्जेक्ट होते हैं जिनमें एक या एक से ज़्यादा आइटम होते हैं. हालांकि, इनका इस्तेमाल एक यूनिट के तौर पर किया जाता है. आम तौर पर, लेयर उन ऑब्जेक्ट के कलेक्शन को दिखाती हैं जिन्हें मैप पर सबसे ऊपर जोड़ा जाता है, ताकि एक सामान्य असोसिएशन तय किया जा सके. Maps JavaScript API, लेयर में मौजूद ऑब्जेक्ट के प्रज़ेंटेशन को मैनेज करता है. इसके लिए, वह लेयर में मौजूद आइटम को एक ऑब्जेक्ट (आम तौर पर टाइल ओवरले) में रेंडर करता है और मैप के व्यूपोर्ट में बदलाव होने पर उन्हें दिखाता है. लेयर, मैप की प्रज़ेंटेशन लेयर में भी बदलाव कर सकती हैं. इसके लिए, वे लेयर के हिसाब से बुनियादी टाइल में थोड़ा बदलाव करती हैं. ध्यान दें कि डिज़ाइन के हिसाब से, ज़्यादातर लेयर को उनके अलग-अलग ऑब्जेक्ट के ज़रिए ऐक्सेस नहीं किया जा सकता. हालांकि, उन्हें सिर्फ़ यूनिट के तौर पर मैनेज किया जा सकता है.
लेयर के बारे में खास जानकारी
Maps JavaScript API में कई तरह की लेयर होती हैं:
- Google Maps डेटा
लेयर, मनमुताबिक भौगोलिक डेटा के लिए कंटेनर उपलब्ध कराती है.
डेटा लेयर का इस्तेमाल, अपने कस्टम डेटा को सेव करने या Google मैप पर GeoJSON डेटा दिखाने के लिए किया जा सकता है.
-
हीटमैप लेयर, हीटमैप विज़ुअलाइज़ेशन का इस्तेमाल करके भौगोलिक डेटा को रेंडर करती है.
-
केएमएल लेयर, केएमएल और GeoRSS एलिमेंट को Maps JavaScript API टाइल ओवरले में रेंडर करती है.
-
ट्रैफ़िक लेयर, मैप पर ट्रैफ़िक की स्थिति दिखाती है.
-
बस, मेट्रो वगैरह की लेयर, मैप पर आपके शहर के सार्वजनिक परिवहन नेटवर्क को दिखाती है.
-
साइकल चलाने की सुविधा वाली लेयर ऑब्जेक्ट, साइकल के रास्तों और/या साइकल के लिए खास ओवरले की लेयर को एक सामान्य लेयर में रेंडर करता है. यात्रा के साइकल मोड के लिए निर्देशों का अनुरोध करने पर, यह लेयर डिफ़ॉल्ट रूप से DirectionsRenderer में दिखती है.
परत जोड़ें
मैप में लेयर जोड़ने के लिए, आपको सिर्फ़ setMap()
को कॉल करना होगा. साथ ही, उस मैप ऑब्जेक्ट को पास करना होगा जिस पर लेयर दिखानी है. इसी तरह, किसी लेयर को छिपाने के लिए, setMap()
को कॉल करें और null
पास करें.
नीचे दिया गया स्निपेट, मैप को यूनाइटेड किंगडम के लंदन पर सेंटर करता है और बस, मेट्रो वगैरह की जानकारी देने वाली लेयर जोड़ता है.
var mapOptions = {
zoom: 13,
center: new google.maps.LatLng(51.5,-0.11)
}
var map = new google.maps.Map(document.getElementById("map"), mapOptions);
var transitLayer = new google.maps.TransitLayer();
transitLayer.setMap(map);
जब तक कुछ अलग से न बताया जाए, तब तक इस पेज की सामग्री को Creative Commons Attribution 4.0 License के तहत और कोड के नमूनों को Apache 2.0 License के तहत लाइसेंस मिला है. ज़्यादा जानकारी के लिए, Google Developers साइट नीतियां देखें. Oracle और/या इससे जुड़ी हुई कंपनियों का, Java एक रजिस्टर किया हुआ ट्रेडमार्क है.
आखिरी बार 2025-08-06 (UTC) को अपडेट किया गया.
[null,null,["आखिरी बार 2025-08-06 (UTC) को अपडेट किया गया."],[[["\u003cp\u003eLayers in Maps JavaScript API are objects consisting of multiple items that are treated as a single unit and often represent collections of objects on the map.\u003c/p\u003e\n"],["\u003cp\u003eThe API provides various layer types, including Data, Heatmap, KML, Traffic, Transit, and Bicycling layers, each serving a distinct purpose for displaying geospatial data.\u003c/p\u003e\n"],["\u003cp\u003eYou can easily add or hide a layer by calling the \u003ccode\u003esetMap()\u003c/code\u003e method, providing the map object or \u003ccode\u003enull\u003c/code\u003e respectively.\u003c/p\u003e\n"],["\u003cp\u003eThe example code demonstrates adding a Transit layer to a map centered on London.\u003c/p\u003e\n"]]],[],null,["Select platform: [Android](/maps/documentation/android-sdk/utility/multilayer \"View this page for the Android platform docs.\") [JavaScript](/maps/documentation/javascript/layers \"View this page for the JavaScript platform docs.\")\n\nLayers are objects on the map that consist of one or more separate items,\nbut are manipulated as a single unit. Layers generally reflect collections of\nobjects that you add on top of the map to designate a common association. The\nMaps JavaScript API manages the presentation of objects within layers\nby rendering their constituent items into one object (typically a tile overlay) and\ndisplaying them as the map's viewport changes. Layers may also alter the presentation\nlayer of the map itself, slightly altering the base tiles in a fashion\nconsistent with the layer. Note that most layers, by design, may not be\naccessed via their individual objects, but may only be manipulated as a\nunit.\n\nLayers Overview\n\nThe Maps JavaScript API has several types of layers:\n\n- The [**Google Maps Data\n layer**](/maps/documentation/javascript/datalayer) provides a container for arbitrary geospatial data. You can use the Data layer to store your custom data, or to display GeoJSON data on a Google map.\n- The [**Heatmap layer**](/maps/documentation/javascript/heatmaplayer) renders geographic data using a *Heatmap* visualization.\n- The [**KML layer**](/maps/documentation/javascript/kmllayer) renders KML and GeoRSS elements into a Maps JavaScript API tile overlay.\n- The [**Traffic layer**](/maps/documentation/javascript/trafficlayer#traffic_layer) displays traffic conditions on the map.\n- The [**Transit layer**](/maps/documentation/javascript/trafficlayer#transit_layer) displays the public transport network of your city on the map.\n- The [**Bicycling layer**](/maps/documentation/javascript/trafficlayer#bicycling_layer) object renders a layer of bike paths and/or bicycle-specific overlays into a common layer. This layer is returned by default within the **DirectionsRenderer** when requesting directions of travel mode **BICYCLING**.\n\nAdd a layer\n\nTo add a layer to a map, you only need to call `setMap()`,\npassing it the map object on which to display the layer. Similarly, to hide a\nlayer, call `setMap()`, passing `null`.\n\nThe below snippet centers the map on London, UK, and adds the [Transit\nlayer](/maps/documentation/javascript/trafficlayer#transit_layer). \n\n```javascript\nvar mapOptions = {\n zoom: 13,\n center: new google.maps.LatLng(51.5,-0.11)\n}\n\nvar map = new google.maps.Map(document.getElementById(\"map\"), mapOptions);\n\nvar transitLayer = new google.maps.TransitLayer();\ntransitLayer.setMap(map);\n```"]]