यहां दिए गए कोड के सैंपल में, addMarker
तरीके को कॉल करके, 3D मैप में एक बेसिक मार्कर जोड़ने का तरीका बताया गया है. इस कोड सैंपल का इस्तेमाल करने के लिए, सेटअप और अपने ऐप्लिकेशन में 3D मैप जोड़ना में दिए गए निर्देशों का पालन करें. इससे, Android Studio प्रोजेक्ट को बुनियादी 3D मैप के साथ सेट अप किया जा सकेगा. इसके बाद, MainActivity.kt फ़ाइल में यह कोड जोड़ें:
// Add importsimportcom.google.android.gms.maps3d.model.latLngAltitude...// Add to the onMap3DViewReady method, after the googleMap3D object has been initializedgoogleMap3D.setMapMode(Map3DMode.SATELLITE)googleMap3D.setCamera(camera{center=latLngAltitude{latitude=52.51974795longitude=13.40715553altitude=150.0}heading=252.7tilt=79.0range=1500.0})// Add a marker using absolute altitude positioninggoogleMap3D.addMarker(markerOptions{position=latLngAltitude{latitude=52.519605780912585longitude=13.406867190588198altitude=150.0}label="Absolute (150m)"altitudeMode=AltitudeMode.ABSOLUTEisExtruded=trueisDrawnWhenOccluded=truecollisionBehavior=CollisionBehavior.REQUIRED_AND_HIDES_OPTIONAL})
[[["समझने में आसान है","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-17 (UTC) को अपडेट किया गया."],[],[],null,["Select platform: [Android](/maps/documentation/maps-3d/android-sdk/add-a-marker \"View this page for the Android platform docs.\") [iOS](/maps/documentation/maps-3d/ios-sdk/add-a-marker \"View this page for the iOS platform docs.\") [JavaScript](/maps/documentation/javascript/3d/marker-add \"View this page for the JavaScript platform docs.\")\n\n\u003cbr /\u003e\n\n| This product or feature is Experimental (pre-GA). Pre-GA products and features might have limited support, and changes to pre-GA products and features might not be compatible with other pre-GA versions. Pre-GA Offerings are covered by the [Google\n| Maps Platform Service Specific Terms](https://cloud.google.com/maps-platform/terms/maps-service-terms). For more information, see the [launch stage descriptions](/maps/launch-stages).\n\nThe following code sample demonstrates how to add a basic marker to a 3D map by\ncaling the [`addMarker`](/maps/documentation/maps-3d/android-sdk/reference/com/google/android/gms/maps3d/GoogleMap3D#addMarker(com.google.android.gms.maps3d.model.MarkerOptions))\nmethod. To use this code sample, follow the instructions in\n[Setup](/maps/documentation/maps-3d/android-sdk/setup) and [Add a 3D map to your app](/maps/documentation/maps-3d/android-sdk/add-a-3d-map)\nto set up your Android Studio project with a basic 3D map. Then, add the\nfollowing code to the **`MainActivity.kt`** file: \n\n```kotlin\n// Add imports\nimport com.google.android.gms.maps3d.model.latLngAltitude\n\n...\n\n// Add to the onMap3DViewReady method, after the googleMap3D object has been initialized\ngoogleMap3D.setMapMode(Map3DMode.SATELLITE)\n\ngoogleMap3D.setCamera(\n camera {\n center = latLngAltitude {\n latitude = 52.51974795\n longitude = 13.40715553\n altitude = 150.0\n }\n heading = 252.7\n tilt = 79.0\n range = 1500.0\n }\n)\n\n// Add a marker using absolute altitude positioning\ngoogleMap3D.addMarker(markerOptions {\n position = latLngAltitude {\n latitude = 52.519605780912585\n longitude = 13.406867190588198\n altitude = 150.0\n }\n label = \"Absolute (150m)\"\n altitudeMode = AltitudeMode.ABSOLUTE\n isExtruded = true\n isDrawnWhenOccluded = true\n collisionBehavior = CollisionBehavior.REQUIRED_AND_HIDES_OPTIONAL\n})\n```\n| **Note:** For more information on working with markers, see:\n|\n| - [Configure marker altitude](/maps/documentation/maps-3d/android-sdk/configure-marker-altitude)\n| - [Configure marker collision behavior](/maps/documentation/maps-3d/android-sdk/configure-marker-collision-behavior)"]]