با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
توسعه دهندگان منطقه اقتصادی اروپا (EEA).
نشانه جلسه قطعه ای از داده (یک UUID ) است که در تماس های REST برای شناسایی یک جلسه - مجموعه ای از مبادلات پیام مرتبط استفاده می شود. باید در تمام درخواستهای مربوط به کاشیهای دوبعدی و تصاویر نمای خیابان، یک نشانه جلسه اضافه کنید. شما آن را به عنوان مقدار پارامتر session اضافه شده به همه URL های درخواستی اضافه می کنید.
در Map Tiles API، یک نشانه جلسه، مجموعه تعریف شده ای از گزینه های نمایش را نشان می دهد. این بدان معنی است که شما مجبور نیستید مجموعه ای از گزینه های نمایش را با هر درخواست کاشی ارسال کنید. شما می توانید از یک نشانه جلسه در چندین مشتری استفاده کنید. یک نشانه جلسه در حال حاضر به مدت دو هفته از زمان صدور آن معتبر است، اما ممکن است تغییر کند. همیشه میتوانید با نگاه کردن به قسمت expiry در پیام پاسخ، زمان انقضای یک نشانه جلسه را بررسی کنید.
درخواست نشانه جلسه
برای درخواست یک نشانه جلسه، همانطور که در مثال زیر نشان داده شده است، یک درخواست HTTPS POST به نقطه پایانی createSession ارسال کنید. شما باید درخواست را با یک هدر Content-Type: application/json ارسال کنید.
نوع نقشه پایه این مقدار می تواند یکی از موارد زیر باشد:
roadmap
نقشههای استاندارد Google Maps، کاشیهای نقشه را نقاشی کردهاند.
satellite
تصاویر ماهواره ای.
terrain
تصاویر زمین. هنگام انتخاب terrain بهعنوان نوع نقشه، باید نوع لایه لایهنقشه layerRoadmap (که در قسمت فیلدهای اختیاری توضیح داده شده است) را نیز وارد کنید.
یک برچسب زبان IETF که زبان مورد استفاده برای نمایش اطلاعات روی کاشی ها را مشخص می کند. به عنوان مثال، en-US زبان انگلیسی را که در ایالات متحده صحبت می شود مشخص می کند.
region
یک شناسه منطقه مخزن داده محلی مشترک (دو حرف بزرگ) که نشان دهنده مکان فیزیکی کاربر است. به عنوان مثال، US .
فیلدهای اختیاری
imageFormat
فرمت فایل را برای بازگشت مشخص می کند. مقادیر معتبر یا jpeg یا png هستند. فایلهای JPEG از شفافیت پشتیبانی نمیکنند، بنابراین برای کاشیهای همپوشانی توصیه نمیشوند. اگر یک imageFormat مشخص نکنید، بهترین قالب برای کاشی به طور خودکار انتخاب می شود.
scale
اندازه عناصر نقشه (مانند برچسب های جاده) را افزایش می دهد، در حالی که اندازه کاشی و ناحیه پوشش کاشی پیش فرض را حفظ می کند. افزایش مقیاس همچنین تعداد برچسب های روی نقشه را کاهش می دهد که باعث کاهش شلوغی می شود. مقادیر زیر مقادیر scale معتبر هستند:
scaleFactor1x : پیش فرض.
scaleFactor2x : اندازه برچسب را دو برابر می کند و برچسب های جزئی ویژگی را حذف می کند.
scaleFactor4x : اندازه برچسب را چهار برابر می کند و برچسب های جزئی ویژگی را حذف می کند.
مثال های زیر تأثیر مقیاس بندی عناصر نقشه را نشان می دهد.
ضریب مقیاس 1x
ضریب مقیاس 2x
highDpi
مشخص می کند که آیا کاشی های با وضوح بالا بازگردانده شوند یا خیر. اگر ضریب مقیاس افزایش یابد، از highDpi برای افزایش اندازه کاشی استفاده می شود. به طور معمول، افزایش ضریب مقیاس، کاشی به دست آمده را به تصویری با همان اندازه بزرگ می کند که کیفیت را کاهش می دهد. با highDpi ، اندازه حاصل نیز افزایش می یابد و کیفیت حفظ می شود. DPI مخفف Dots per Inch است و High DPI به این معنی است که کاشی با استفاده از نقاط بیشتری در هر اینچ نسبت به حالت عادی رندر می شود. اگر true ، تعداد پیکسل ها در هر یک از ابعاد x و y در ضریب مقیاس (یعنی 2x یا 4x) ضرب می شود. منطقه پوشش کاشی بدون تغییر باقی می ماند. این پارامتر فقط با مقادیر scale 2x یا 4x کار می کند. روی کاشی های مقیاس 1x تاثیری ندارد.
ضریب مقیاس 1x
ضریب مقیاس 2x DPI بالا
layerTypes
آرایه ای از مقادیر که انواع لایه های اضافه شده به نقشه را مشخص می کند. مقادیر معتبر عبارتند از:
layerRoadmap
اگر terrain به عنوان نوع نقشه مشخص کنید، الزامی است. همچنین می توان به صورت اختیاری روی نوع نقشه satellite همپوشانی کرد. هیچ تاثیری روی کاشی های نقشه راه ندارد.
layerStreetview
خیابانها و مکانهای دارای نمای خیابان را با استفاده از خطوط آبی روی نقشه نشان میدهد.
layerTraffic
وضعیت ترافیک فعلی را نمایش می دهد.
styles
آرایه ای از اشیاء سبک JSON که ظاهر و سطح جزئیات ویژگی های نقشه مانند جاده ها، پارک ها و مناطق ساخته شده را مشخص می کند. استایلینگ برای سفارشی کردن نقشه پایه استاندارد گوگل استفاده می شود. پارامتر styles فقط در صورتی معتبر است که نوع نقشه roadmap باشد. برای نحو کامل سبک، به مرجع سبک مراجعه کنید.
overlay
یک مقدار بولی که مشخص میکند layerTypes باید بهعنوان یک پوشش جداگانه ارائه شوند یا با تصاویر پایه ترکیب شوند. وقتی true ، نقشه پایه نمایش داده نمی شود. اگر هیچ layerTypes تعریف نکرده اید، این مقدار نادیده گرفته می شود.
به عنوان مثال، درخواست یک نوع نقشه satellite با لایهای layerRoadmap ، و تنظیم overlay روی false ، منجر به کاشیهایی معادل نوع نقشه hybrid مورد استفاده در Maps JavaScript API (تصویر سمت چپ) میشود. همان نقشه ها و انواع لایه ها با overlay که روی true تنظیم شده اند، منجر به ایجاد یک کاشی شفاف با پوشش نقشه می شود که به طور مناسب برای پوشش تصاویر ماهواره ای (تصویر سمت راست) طراحی شده است.
overlay : نادرست
overlay : درست
JSON زیر نمونهای از بدنه درخواست معمولی است که شامل فیلدهای الزامی و اختیاری است.
این مثال پوششی را ارائه می دهد که برای ترکیب با تصاویر ماهواره ای مناسب است. مثال شامل نقشه راه و نمای خیابان است. نقشه به دست آمده با نام ها و داده ها به زبان انگلیسی، همانطور که در ایالات متحده صحبت می شود، ارائه می شود.
یک مقدار توکن جلسه که باید در تمام درخواستهای Map Tiles API خود بگنجانید.
expiry
رشته ای که شامل زمان (بر حسب ثانیه از دوره) است که در آن توکن منقضی می شود. یک نشانه جلسه به مدت دو هفته از زمان ایجاد آن معتبر است، اما این خط مشی ممکن است بدون اطلاع قبلی تغییر کند.
تاریخ آخرین بهروزرسانی 2025-09-03 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-09-03 بهوقت ساعت هماهنگ جهانی."],[[["\u003cp\u003eSession tokens, represented as UUIDs, are required for accessing 2D Tiles and Street View imagery through the Map Tiles API but not for 3D Tiles.\u003c/p\u003e\n"],["\u003cp\u003eThey define display options for a session, eliminating the need to send them with each tile request and can be used across multiple clients.\u003c/p\u003e\n"],["\u003cp\u003eTo obtain a session token, an HTTPS POST request is sent to the \u003ccode\u003ecreateSession\u003c/code\u003e endpoint with parameters defining the map type, language, region, and optional display settings.\u003c/p\u003e\n"],["\u003cp\u003eThe response includes the session token, its expiration time, and tile dimensions, with the token remaining valid for approximately two weeks.\u003c/p\u003e\n"]]],[],null,["# Use session tokens with Map Tiles API\n\n**European Economic Area (EEA) developers** If your billing address is in the European Economic Area, effective on 8 July 2025, the [Google\n| Maps Platform EEA Terms of Service](https://cloud.google.com/terms/maps-platform/eea) will apply to your use of the Services. [Learn more](/maps/comms/eea/faq). In addition, certain content from the Map Tiles API will no longer be returned. [Learn more](/maps/comms/eea/map-tiles).\n\nA session token is a piece of data (a\n[UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier))\nthat is used in REST calls to identify a\n[session](https://en.wikipedia.org/wiki/Session_(computer_science))---a\nseries of related message exchanges. You must include a session token in all\nrequests for 2D Tiles and Street View imagery.\nYou include it as the value of a `session` parameter appended to all request\nURLs.\n\nIn the Map Tiles API, a session token represents a defined set of\ndisplay options. It means you don't have to pass a set of display options with\neach tile request. You can use the same session token across multiple clients.\nA session token is currently valid for two weeks from its\nissue time, but this might change. You can always check the expiration time of a\nsession token by looking at the `expiry` field in the response message.\n| **Note:** You need to use session tokens for getting 2D Tiles and Street View Tiles, but not for getting 3D Tiles.\n\nSession token request\n---------------------\n\nTo request a session token, send an HTTPS POST request to the `createSession`\nendpoint, as shown in the following example. You must send the request with a\n`Content-Type: application/json` header. \n\n```json\ncurl -X POST -d '{\n \"mapType\": \"streetview\",\n \"language\": \"en-US\",\n \"region\": \"US\"\n}' \\\n-H 'Content-Type: application/json' \\\n\"https://tile.googleapis.com/v1/createSession?key=YOUR_API_KEY\"\n```\n\n### Required fields\n\n`mapType`\n\n: The type of base map. This value can be one of the following:\n\n `roadmap`\n : The standard Google Maps painted map tiles.\n\n `satellite`\n : Satellite imagery.\n\n `terrain`\n : Terrain imagery. When selecting `terrain` as the map type, you must also\n include the `layerRoadmap` layer type (described in the\n [Optional fields](/maps/documentation/tile/session_tokens#optional_fields)\n section).\n\n `streetview`\n : Street View panoramas. For more information, see\n [Street View Tiles](/maps/documentation/tile/streetview).\n\n`language`\n\n: An\n [IETF language tag](https://en.wikipedia.org/wiki/IETF_language_tag)\n that specifies the language used to display information on the tiles. For\n example, `en-US` specifies the English language as spoken in the United States.\n\n`region`\n\n: A\n [Common Locale Data Repository](https://cldr.unicode.org/)\n region identifier (two uppercase letters) that represents the physical location\n of the user. For example, `US`.\n\n### Optional fields\n\n`imageFormat`\n: Specifies the file format to return. Valid values are either `jpeg` or `png`.\n JPEG files don't support transparency, therefore they aren't recommended for\n overlay tiles. If you don't specify an `imageFormat`, then the best format for\n the tile is chosen automatically.\n\n`scale`\n\n: Scales-up the size of map elements (such as road labels), while retaining the\n tile size and coverage area of the default tile. Increasing the scale also\n reduces the number of labels on the map, which reduces clutter. The following\n values are valid `scale` values:\n\n - `scaleFactor1x`: The default.\n - `scaleFactor2x`: Doubles label size and removes minor feature labels.\n - `scaleFactor4x`: Quadruples label size and removes minor feature labels.\n\nThe following examples demonstrate the effect of scaling map elements.\n\n| Scale Factor 1x | Scale Factor 2x |\n|-----------------|-----------------|\n| | |\n\n`highDpi`\n: Specifies whether to return high-resolution tiles. If the scale-factor is\n increased, `highDpi` is used to increase the size of the tile. Normally,\n increasing the scale factor enlarges the resulting tile into an image of the\n same size, which lowers quality. With `highDpi`, the resulting size is also\n increased, preserving quality. DPI stands for Dots per Inch, and High DPI means\n the tile renders using more dots per inch than normal. If `true`, then the\n number of pixels in each of the x and y dimensions is multiplied by the scale\n factor (that is , 2x or 4x). The coverage area of the tile remains unchanged.\n This parameter works only with `scale` values of 2x or 4x. It has no effect on\n 1x scale tiles.\n\n| Scale Factor 1x | Scale Factor 2x High DPI |\n|-----------------|--------------------------|\n| | |\n\n`layerTypes`\n\n: An array of values that specifies the layer types added to the map. Valid\n values are:\n\n `layerRoadmap`\n : Required if you specify `terrain` as the map type. Can also be optionally\n overlaid on the `satellite` map type. Has no effect on roadmap tiles.\n\n `layerStreetview`\n : Shows Street View-enabled streets and locations using blue outlines on the\n map.\n\n `layerTraffic`\n : Displays current traffic conditions.\n\n`styles`\n\n: An array of JSON style objects that specify the appearance and detail level of\n map features such as roads, parks, and built-up areas. Styling is used to\n customize the standard Google base map. The `styles` parameter is valid only if\n the map type is `roadmap`. For the complete style syntax, see the\n [Style Reference](/maps/documentation/tile/style-reference).\n\n`overlay`\n\n: A boolean value that specifies whether `layerTypes` should be\n rendered as a separate overlay, or combined with the base imagery. When\n `true`, the base map isn't displayed. If you haven't defined any `layerTypes`,\n then this value is ignored.\n\nFor example, requesting a `satellite` map type with a `layerRoadmap` layer, and\n`overlay` set to `false` results in tiles equivalent to the `hybrid` map type\nused in the Maps JavaScript API (left image). The same\nmap and layer types with `overlay` set to `true` results in a transparent tile\nwith a map overlay, styled appropriately for overlaying over satellite imagery\n(right image).\n\n| `overlay`: false | `overlay`: true |\n|------------------|-----------------|\n| | |\n\nThe following JSON is an example of a typical request body that contains both\nrequired and optional fields. \n\n {\n \"mapType\": \"satellite\",\n \"language\": \"en-US\",\n \"region\": \"us\",\n \"layerTypes\": [ \"layerRoadmap\", \"layerStreetview\" ],\n \"overlay\": true,\n \"scale\": \"scaleFactor1x\",\n \"styles\": [\n {\n \"stylers\": [\n { \"hue\": \"#00ffe6\" },\n { \"saturation\": -20 }\n ]\n },{\n \"featureType\": \"road\",\n \"elementType\": \"geometry\",\n \"stylers\": [\n { \"lightness\": 100 },\n { \"visibility\": \"simplified\" }\n ]\n }\n ]\n }\n\nThis example provides an overlay that's suitable for combining with satellite\nimagery. The example contains both a roadmap and street view overlay. The\nresulting map is rendered with names and data in the English language, as it's\nspoken in the United States.\n\nSession token response\n----------------------\n\nThe following JSON is an example response body. \n\n {\n \"session\": \"IgAAAHGU9jnAU4KOAfwY3Bcd6eH_WxQsyocSBAdUnAr9pnvTTNXtF9c_27RBo94ytEXTDg\",\n \"expiry\": \"1361828036\",\n \"tileWidth\": 256,\n \"tileHeight\": 256,\n \"imageFormat\": \"png\"\n }\n\nThe following list contains definitions of the fields in the response body.\n\n`session`\n: A session token value that you must include in all of your Map Tiles API\n requests.\n\n`expiry`\n: A string that contains the time (in seconds since the epoch) at which the token\n expires. A session token is valid for two weeks from its creation\n time, but this policy might change without notice.\n\n`tileWidth`\n: The width of the tiles measured in pixels.\n\n`tileHeight`\n: The height of the tiles measured in pixels.\n\n`imageFormat`\n: The image format, which can be either `png` or `jpeg`."]]