شناسه نقشه یک شناسه منحصر به فرد است که نمایانگر تنظیمات ظاهری و پیکربندی نقشه Google است که در Google Cloud ذخیره شده است. شما از شناسه های نقشه برای فعال کردن ویژگی ها یا مدیریت یا سبک دادن به نقشه ها در وب سایت ها و برنامه های خود استفاده می کنید. میتوانید برای هر پلتفرمی که نیاز دارید شناسههای نقشه ایجاد کنید - نقشههای جاوا اسکریپت، اندروید، iOS یا Static - در پروژه کنسول Google Cloud خود در صفحه مدیریت نقشه .
برای جزئیات بیشتر و ویژگیهایی که از شناسههای نقشه استفاده میکنند، به نمای کلی Map ID مراجعه کنید.
مجوزهای مورد نیاز
برای ایجاد یا مدیریت هر شناسه نقشه در پروژه خود، باید از یک اصلی با مجوزهای سطح نقش مناسب، ویرایشگر یا مالک، در صفحه IAM کنسول ابری برای پروژه استفاده کنید. برای جزئیات، به مرجع نقش های اساسی و از پیش تعریف شده IAM مراجعه کنید.
شناسه های نقشه را ایجاد کنید
با دنبال کردن مراحل زیر، شناسههای نقشه را در کنسول Cloud ایجاد کنید:
با مجوزهای لازم، به یک پروژه کنسول Cloud وارد شوید و آن را باز کنید.
در صفحه ایجاد شناسه نقشه جدید ، موارد زیر را انجام دهید:
برای نام ، به شناسه نقشه یک نام بدهید.
اختیاری : برای توضیحات ، توضیح دهید که شناسه نقشه برای چه مواردی استفاده می شود.
برای نوع نقشه ، پلتفرمی را که قصد دارید از شناسه نقشه در آن استفاده کنید، انتخاب کنید. اگر جاوا اسکریپت را انتخاب می کنید، نوع نقشه Raster (پیش فرض) یا Vector را نیز انتخاب کنید. برای اطلاعات بیشتر در مورد نقشه های برداری، نقشه های برداری را ببینید.
روی ذخیره کلیک کنید تا شناسه نقشه جدید شما نشان داده شود.
شناسه نقشه را به سبک نقشه مرتبط کنید
اگر از طراحی نقشه های مبتنی بر ابر استفاده می کنید، یک سبک نقشه را با شناسه نقشه خود مرتبط می کنید. برای جزئیات، به مرتبط کردن سبک خود با شناسه نقشه مراجعه کنید.
شناسه نقشه را به برنامه خود اضافه کنید
اندروید
شناسه نقشه خود را از طریق یک عنصر <fragment> در فایل طرحبندی فعالیت، با استفاده از کلاس MapView یا به صورت برنامهریزی با استفاده از کلاس GoogleMapOptions اضافه کنید.
به عنوان مثال، فرض کنید یک شناسه نقشه ایجاد کرده اید که به عنوان مقدار رشته ای به نام map_id در res/values/strings.xml ذخیره می شود:
برای نقشههایی که از طریق عنصر <fragment> در فایل طرحبندی فعالیت اضافه میشوند، همه قطعات نقشه که باید سبک سفارشی داشته باشند باید شناسه نقشه را در ویژگی map:mapId مشخص کنند:
در اندروید استودیو، برنامه خود را همانطور که به طور معمول انجام می دهید بسازید و اجرا کنید. سبک های سفارشی پیکربندی شده در مرحله اول برای همه نقشه ها با شناسه نقشه مشخص شده اعمال می شود.
iOS
برای نمونه سازی نقشه با استفاده از شناسه نقشه، موارد زیر را انجام دهید:
یک GMSMapID با رشته شناسه نقشه از کنسول Cloud ایجاد کنید.
یک GMSMapView ایجاد کنید که شناسه نقشه ای را که ایجاد کرده اید مشخص کنید.
اگر از شناسه نقشه خود استفاده میکنید، میتوانید شناسه نقشه خود را در کنسول Cloud طوری تنظیم کنید که در هر زمان خواستید سبک جدیدی داشته باشد و این سبک به طور خودکار در نمای نقشه شما و کاربران در عرض حدود شش ساعت منعکس میشود.
اگر میخواهید فوراً تغییرات را مشاهده کنید، میتوانید با خروج از برنامه، برنامه خود را ببندید و مجدداً راهاندازی کنید، برنامه را از لیست برنامههای اخیراً استفاده شده خارج کنید و سپس آن را دوباره باز کنید. سپس نقشه به روز شده قابل مشاهده خواهد بود.
جاوا اسکریپت
برای ایجاد نقشه با شناسه نقشه در کد برنامه:
اگر قبلاً نقشه خود را با کد JSON تعبیه شده سفارشی می کنید، ویژگی styles را از شی MapOptions خود حذف کنید. در غیر این صورت، این مرحله را رها کنید.
با استفاده از ویژگی mapId یک شناسه نقشه به نقشه اضافه کنید. به عنوان مثال:
برای افزودن شناسه نقشه به نقشه جدید یا موجود که از یکی از APIهای وب سرویس ما استفاده می کند، پارامتر URL map_id را اضافه کرده و آن را روی شناسه نقشه خود تنظیم کنید. این مثال اضافه کردن شناسه نقشه را با استفاده از Maps Static API به نقشه نشان میدهد.
اگر قبل از افزودن شناسه نقشه، در URL استاتیک Maps خود دارای امضای دیجیتالی هستید، پس از افزودن شناسه نقشه، باید امضای دیجیتالی جدیدی ایجاد کرده و اضافه کنید . هنگام ایجاد رمز امضای URL جدید، به یاد داشته باشید که امضای دیجیتال قبلی خود را از URL حذف کنید.
تاریخ آخرین بهروزرسانی 2025-08-29 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-08-29 بهوقت ساعت هماهنگ جهانی."],[[["\u003cp\u003eA map ID is a unique identifier that represents a single Google Map instance, used to manage, style, or enable features on maps across various platforms (JavaScript, Android, iOS, Static Maps).\u003c/p\u003e\n"],["\u003cp\u003eMap IDs are created within the Google Cloud console on the Map Management page, requiring Editor or Owner permissions.\u003c/p\u003e\n"],["\u003cp\u003eTo use a map ID, you need to integrate it into your application code based on the specific platform (JavaScript, Android, iOS, or Static Maps) you're working with, following the provided instructions.\u003c/p\u003e\n"],["\u003cp\u003eCloud-based map styling allows you to associate a style with your map ID, impacting its visual appearance on the map.\u003c/p\u003e\n"],["\u003cp\u003eMap IDs can be added to the Maps Static API by appending the 'map_id' URL parameter, and a new digital signature might be required for existing URLs.\u003c/p\u003e\n"]]],[],null,["# How to create map IDs\n\nSelect platform: [Android](/maps/documentation/android-sdk/map-ids/get-map-id \"View this page for the Android platform docs.\") [iOS](/maps/documentation/ios-sdk/map-ids/get-map-id \"View this page for the iOS platform docs.\") [JavaScript](/maps/documentation/javascript/map-ids/get-map-id \"View this page for the JavaScript platform docs.\") [Web Service](/maps/documentation/maps-static/map-ids/get-map-id \"View this page for the Web Service platform docs.\")\n\n\u003cbr /\u003e\n\n| **Paid feature:**\n| Features accessed by adding a [map ID](/maps/documentation/get-map-id) triggers a map\n| load charged against the Dynamic Maps SKU for Android and iOS. See\n| [Google Maps Billing](/maps/billing-and-pricing/sku-details#dynamic-maps-ess-sku) for more information.\n\nA map ID is a unique identifier that represents Google Map styling and configuration settings that are stored in Google Cloud. You use map IDs to enable features or manage or style maps on your websites and in your applications. You can create map IDs for each platform you need--JavaScript, Android, iOS, or Static maps--in your Google Cloud console project on the **Map Management** page.\n\nFor more details and features that use map IDs,\nsee [Map ID overview](/maps/documentation/javascript/map-ids/mapid-over).\n\nRequired permissions\n--------------------\n\nTo create or manage any map IDs in your project, you\nmust use a principal with the appropriate role-level permissions, Editor or\nOwner, on the Cloud console IAM page for the project. For\ndetails, see\n[IAM basic and predefined roles reference](https://cloud.google.com/iam/docs/understanding-roles#role_types).\n\nCreate map IDs\n--------------\n\nCreate map IDs in the Cloud console following\nthese steps:\n\n1. Sign in to and open a Cloud console project with the\n [required permissions](#permissions).\n\n2. In the Cloud console, go to the\n [Maps Management page](https://console.cloud.google.com/google/maps-apis/studio/maps).\n\n3. Click **Create map ID**.\n\n4. On the **Create new map ID** page, do the following:\n\n 1. For **Name**, give the map ID a name.\n 2. *Optional* : For **Description**, describe what the map ID is used for.\n 3. For **Map type** , select the platform on which you plan to use the map ID. If you choose JavaScript, also choose a **Raster** (the default) or **Vector** map type. For more information on vector maps, see [Vector Maps](/maps/documentation/javascript/vector-map).\n 4. Click **Save** to show your new map ID.\n\nAssociate a map ID to a map style\n---------------------------------\n\nIf you are using cloud-based maps styling, you associate a map style with your\nmap ID. For details, see [Associate your style to a map ID](../cloud-customization/map-styles-leg#associate-style-with-map-id).\n\nAdd the map ID to your app\n--------------------------\n\n### Android\n\nAdd your map ID through a `\u003cfragment\u003e` element in the\nactivity's layout file, by using the `MapView` class, or programmatically\nusing the `GoogleMapOptions` class.\n\nFor example, assume you created a map ID that is stored as a\nstring value named `map_id` in `res/values/strings.xml`: \n\n \u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\n \u003cresources\u003e\n \u003cstring name=\"map_id\"\u003e\u003cvar label=\"map_id\" translate=\"no\"\u003eMAP_ID\u003c/var\u003e\u003c/string\u003e\n \u003c/resources\u003e\n\nFor maps added through a `\u003cfragment\u003e` element in the activity's layout file,\nall map fragments that should have the custom style must specify the\nmap ID in the `map:mapId` attribute: \n\n \u003cfragment xmlns:map=\"http://schemas.android.com/apk/res-auto\"\n map:name=\"com.google.android.gms.maps.SupportMapFragment\"\n ...\n map:mapId=\"@string/map_id\" /\u003e\n\nYou can also use the `map:mapId` attribute of the `MapView` class to specify\na map ID: \n\n \u003ccom.google.android.gms.maps.MapView\n xmlns:map=\"http://schemas.android.com/apk/res-auto\"\n ....\n map:mapId=\"@string/map_id\" /\u003e\n\nTo specify a map ID programmatically, pass it to a\n`MapFragment` instance using the `GoogleMapOptions` class: \n\n### Java\n\n MapFragment mapFragment = MapFragment.newInstance(\n new GoogleMapOptions()\n .mapId(getResources().getString(R.string.map_id)));\n\n### Kotlin\n\n val mapFragment = MapFragment.newInstance(\n GoogleMapOptions()\n .mapId(resources.getString(R.string.map_id))\n )\n\nIn Android Studio, build and run your app as you normally would. Custom\nstyles configured in the first step are applied to all maps with\nthe specified map ID.\n\n### iOS\n\nTo instantiate a map using a map ID, do the following:\n\n1. Create a `GMSMapID` with the map ID string from Cloud console.\n2. Create a `GMSMapView` specifying the map ID you just created.\n\n### Swift\n\n let camera = GMSCameraPosition(latitude: 47.0169, longitude: -122.336471, zoom: 12)\n let mapID = GMSMapID(identifier: \"\u003cvar label=\"map_id\" translate=\"no\"\u003eMAP_ID\u003c/var\u003e\")\n let mapView = GMSMapView(frame: .zero, mapID: mapID, camera: camera)\n self.view = mapView\n\n### Objective-C\n\n GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:47.0169\n longitude:-122.336471\n zoom:12];\n GMSMapID *mapID = [GMSMapID mapIDWithIdentifier:@\"\u003cvar label=\"map_id\" translate=\"no\"\u003eMAP_ID\u003c/var\u003e\"];\n GMSMapView *mapView = [GMSMapView mapWithFrame:CGRectZero mapID:mapID camera:camera];\n self.view = mapView;\n\nIf you are using your own map ID, you can set your\nmap ID in the Cloud console to have a new style\nat any time, and that style will be reflected on your map view automatically\nfor you and users within about six hours.\n\nIf you want to see the changes immediately, you can close out and restart\nyour app by exiting the app, forcing a quit of the app from the recently-used\napps list, and then reopening it. The updated map will then be visible.\n\n### JavaScript\n\nTo create a map with a map ID in your application code:\n\n1. If you are already customizing your map with embedded JSON code, remove\n the\n [`styles` property](/maps/documentation/javascript/reference/map#MapOptions.styles)\n from your `MapOptions` object; otherwise, skip this step.\n\n2. Add a map ID to the map using the `mapId` property. For example:\n\n```javascript\nmap = new google.maps.Map(document.getElementById('map'), {\ncenter: {lat: -34.397, lng: 150.644},\nzoom: 8,\nmapId: '\u003cvar translate=\"no\"\u003eMAP_ID\u003c/var\u003e'\n});\n```\n\n### Maps Static\n\nTo add a map ID to a new or existing map that uses one of our\nweb-service APIs, append the `map_id` URL parameter and set it to your\nmap ID. This example shows adding a map ID to\na map using Maps Static API. \n\n \u003cimg src=\"https://maps.googleapis.com/maps/api/staticmap?center=Brooklyn+Bridge,New+York,NY&zoom=13&size=600x300&maptype=roadmap&markers=color:blue%7Clabel:S%7C40.702147,-74.015794&markers=color:green%7Clabel:G%7C40.711614,-74.012318&markers=color:red%7Clabel:C%7C40.718217,-73.998284&key=YOUR_API_KEY&map_id=\u003cvar label=\"map_id\" translate=\"no\"\u003eMAP_ID\u003c/var\u003e&signature=YOUR_SIGNATURE\" /\u003e\n\nIf you have a digital signature in your Maps Static URL before adding your map ID, you will need to [create\nand add a new digital signature](/maps/documentation/maps-static/digital-signature) after adding your map ID. When generating your new URL signing secret, remember to remove your previous digital signature from the URL."]]