סקירה כללית של משבצות דו-ממדיות
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
מפתחים באזור הכלכלי האירופי (EEA)
אריחי מפה הם פשוט חלוקה של העולם לרשת עם אינדקס. הוא מאפשר לכם לגשת לנתוני מפה ולנצל אותם בצורה יעילה ודינמית בכמה סולמות קרטוגרפיים. Map Tiles API מאפשר לכם לגשת לכמה מערכי נתונים גיאוגרפיים נושאיים, כולל מערכי נתונים שנאספו על ידי Google:
משבצות תמונה של מפת דרכים שמבוססות על נתונים טופוגרפיים וקטוריים עם סגנון קרטוגרפי של Google.
תמונות אורתופוטוגרפיות שצולמו על ידי מצלמות לוויין ומצלמות אוויריות, ומציגות תמונות של כדור הארץ מלמעלה (נקודת נאדיר).
מפות קווי מתאר עם הצללה.
כל ה-Map Tiles בדו-ממד הם בעלי הפניה גיאוגרפית ומיושרים זה לזה. הן נבחרות על סמך ההיקף הגיאוגרפי של אזור התצוגה ורמת הזום. רמות הזום נעות מאפס (כדי לראות את העולם כולו) עד 22 (כדי לראות רחובות ובלוקים).
עיצובים של מפות
אפשר לקבל משבצות מפה עבור ערכות הנושא הבאות של המפה.
עיצוב המפה
תיאור
Roadmap
כבישים, בניינים, נקודות עניין וגבולות פוליטיים
לוויין
תמונות שצולמו מהחלל
פני שטח
מפת קווי גובה שמוצגים בה מאפיינים טבעיים כמו צמחייה
הערה: משבצות של מפות יכולות לכלול שכבה אחת או יותר. לדוגמה, אפשר להוסיף שכבת מפת דרכים על גבי מפת לוויין. מידע נוסף מופיע במאמר בנושא שדות אופציונליים .
כדי לבקש משבצות של מפות מ-Map Tiles API, קודם צריך לבקש טוקן סשן . טוקן הסשן עוקב אחרי המצב הנוכחי של המפה ושל אזור התצוגה. כשמגדירים את טוקן הסשן, צריך להגדיר את הערך mapType
כך שיתאים לערכת הנושא של המפה שרוצים.
לאחר מכן, צריך לכלול את אסימון הסשן בכל בקשה ל-Map Tiles API.
בקשות מידע על אזור התצוגה
אזור התצוגה מגדיר את גודל התיבה שמקיפה את סצנת העולם. בקשות למידע על אזור התצוגה מחזירות פרטים על משבצות המפה שמרכיבות את אזור התצוגה הנוכחי. הסיבה לבקשת מידע על אזור התצוגה היא לוודא שלא תבקשו תמונות ברמות זום שלא קיימות.
לדוגמה, ברוב הערים יש תמונות ברמת זום 22, אבל לא באוקיינוס, כי התוצאה תהיה רק ריבועים כחולים ללא מאפיינים.
הערה: התגובה כוללת את הקרדיט שחובה להציג עם המפה, ואת רמת הזום המקסימלית – כך שתוכלו ליצור פס זום. מידע נוסף זמין במאמר בנושא המדיניות של Map Tiles API .
בקשת אזור התצוגה היא בקשת HTTPS GET בפורמט הבא.
curl "https://tile.googleapis.com/tile/v1/viewport ?session=YOUR_SESSION_TOKEN &key=YOUR_API_KEY &zoom=zoom &north=north &south=south &east=east &west=west "
הבקשה מכילה את השדות הבאים:
zoom
רמת הזום של אזור התצוגה.
north
, south
, east
, west
הנקודות הצפוניות, הדרומיות, המזרחיות והמערביות הכי רחוקות באזור התצוגה, בערכים של מעלות. הערכים של צפון ודרום צריכים להיות בטווח (-90,90), והערכים של מזרח ומערב צריכים להיות בטווח (-180, 180). כדי לציין גבולות שחוצים את קו התאריך הבינלאומי, אפשר להשתמש בערך חיובי למערב (לדוגמה, 170) ובערך שלילי למזרח (לדוגמה, -170). כל הפרמטרים הם חובה.
תשובות עם מידע על אזור התצוגה
התגובה של אזור התצוגה מציינת באילו אזורים יש תמונות ובאילו רמות זום. תשובה עם מידע על אזור התצוגה נראית כך.
{
"copyright" : "Map data ©2023" ,
"maxZoomRects" : [
{
"maxZoom" : 19 ,
"north" : 90 ,
"south" : -90 ,
"east" : 180 ,
"west" : -180
},
{
"maxZoom" : 9 ,
"north" : 90 ,
"south" : -90 ,
"east" : 180 ,
"west" : -180
},
{
"maxZoom" : 14 ,
"north" : 84.375 ,
"south" : -84.375 ,
"east" : 180 ,
"west" : -180
}, ...
]
}
הערה: בדוגמה הזו, המערך maxZoomRects
מכיל יותר אובייקטים ממה שמוצג.
גוף התשובה מכיל את השדות הבאים.
copyright
מכיל מחרוזת שיוך שחובה להציג במפה כשמציגים אריחים של מפת דרכים ושל תמונות לוויין. מידע נוסף זמין במאמר בנושא המדיניות של Map Tiles API .
maxZoomRect
מכיל מערך של מלבנים חוסמים שחופפים לאזור התצוגה הנוכחי. הוא מכיל גם את רמת הזום המקסימלית שזמינה בכל מלבן.
פונקציות של קואורדינטות של קטע במפה
ברוב שפות התכנות יש כלים (פונקציות פשוטות) להמרה של זוגות של קווי אורך ורוחב לקואורדינטות של משבצות ברמת זום ספציפית.
דוגמה לקוד JavaScript שממיר קודם מ-latLng
לנקודה, ואז מנקודה לקואורדינטות של משבצת.
var TILE_SIZE = 256 ;
function fromLatLngToPoint ( latLng ) {
var mercator = - Math . log ( Math . tan (( 0.25 + latLng . lat () / 360 ) * Math . PI ));
return {
x : TILE_SIZE * ( latLng . lng () / 360 + 0.5 ),
y : TILE_SIZE / 2 * ( 1 + mercator / Math . PI )
};
}
function fromLatLngToTileCoord ( latLng , zoom ) {
var point = fromLatLngToPoint ( latLng );
var scale = Math . pow ( 2 , zoom );
return {
x : Math . floor ( point . x * scale / TILE_SIZE ),
y : Math . floor ( point . y * scale / TILE_SIZE ),
z : zoom
};
}
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0 . לפרטים, ניתן לעיין במדיניות האתר Google Developers . Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-09-04 (שעון UTC).
[null,null,["עדכון אחרון: 2025-09-04 (שעון UTC)."],[[["\u003cp\u003eMap Tiles API allows access to various thematic geodatasets like roadmap, orthophotography, and hillshade, dividing the world into an indexed grid for efficient data utilization.\u003c/p\u003e\n"],["\u003cp\u003eMap tiles are available in roadmap, satellite, and terrain themes, and can be overlaid for richer visualizations.\u003c/p\u003e\n"],["\u003cp\u003eA session token is required for accessing Map Tiles API, which tracks the map state and desired theme.\u003c/p\u003e\n"],["\u003cp\u003eViewport information requests help determine available zoom levels and imagery for a specific area to avoid requesting non-existent data.\u003c/p\u003e\n"],["\u003cp\u003eTile coordinate functions can be used to convert latitude/longitude pairs into tile coordinates for specific zoom levels, enabling precise map tile retrieval.\u003c/p\u003e\n"]]],["Map Tiles API provides access to geodatasets, including roadmap, satellite, and terrain themes, divided into an indexed grid. Users request a session token and specify a map theme. Viewport information, obtained via HTTPS GET requests, determines the available imagery and zoom levels (0-22) within a defined area. Responses include copyright attribution and maximum zoom levels. Tile coordinate functions convert latitude/longitude to tile coordinates for specific zoom levels.\n"],null,["# 2D Tiles overview\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\nMap Tiles are simply the division of the world into an indexed\ngrid. It lets you access and utilize map data efficiently and dynamically\nat multiple cartographic scales. Map Tiles API gives you access to\nmultiple thematic geodatasets, including Google-curated:\n\n- Roadmap image tiles based on vector topographic data with Google's\n cartographic styling.\n\n- Orthophotography captured by both satellite and airborne cameras that deliver\n top down (nadir) imagery of the earth.\n\n- Hillshade contour maps.\n\n2D Map Tiles are all georeferenced and aligned to each other. They're selected\nbased on the geographic extent of the viewport and the zoom level. Zoom levels\nrange from zero (to view the world in its entirety) to 22 (to view streets and\nblocks).\n\nMap themes\n----------\n\nYou can get map tiles for the following map themes.\n\n| Map theme | Description |\n|-------------------------------------------------|----------------------------------------------------------------|\n| [Roadmap](/maps/documentation/tile/roadmap) | Roads, buildings, points of interest, and political boundaries |\n| [Satellite](/maps/documentation/tile/satellite) | Photographic imagery taken from space |\n| [Terrain](/maps/documentation/tile/terrain) | A contour map that shows natural features such as vegetation |\n\n| **Note:** Map tiles can consist of one or more layers. For example, a roadmap layer can be overlaid on top of a satellite map theme. For more information, see [Optional fields](/maps/documentation/tile/session_tokens#optional_fields).\n\nTo request map tiles from Map Tiles API, you must first request a\n[session token](/maps/documentation/tile/session_tokens). The session token\ntracks the current state of your map and viewport. When you set up your session\ntoken, you must set the `mapType` value to match the map theme that you want.\nThen, you must include the session token in each of your requests to\nMap Tiles API.\n\nViewport information requests\n-----------------------------\n\nThe viewport defines the size of the box that frames the world scene. Viewport\ninformation requests return details about the map tiles that make up your\ncurrent viewport. The reason that you request viewport information is to ensure\nthat you avoid requesting imagery at zoom levels that don't exist.\n\nFor example, most cities have imagery at zoom level 22, but not the ocean since\nit would just end up displaying featureless blue squares.\n| **Note:** Included in the response is the attribution that you must display with your map, and the maximum zoom level---so you can build a zoom slider. For more information, see the [Map Tiles API Policies](/maps/documentation/tile/policies#map-tiles-api).\n\nThe viewport request is an HTTPS GET request in the following form. \n\n```json\ncurl \"https://tile.googleapis.com/tile/v1/viewport?session=\u003cvar class=\"apiparam\" translate=\"no\"\u003eYOUR_SESSION_TOKEN\u003c/var\u003e&key=YOUR_API_KEY&zoom=\u003cvar class=\"apiparam\" translate=\"no\"\u003ezoom\u003c/var\u003e&north=\u003cvar class=\"apiparam\" translate=\"no\"\u003enorth\u003c/var\u003e&south=\u003cvar class=\"apiparam\" translate=\"no\"\u003esouth\u003c/var\u003e&east=\u003cvar class=\"apiparam\" translate=\"no\"\u003eeast\u003c/var\u003e&west=\u003cvar class=\"apiparam\" translate=\"no\"\u003ewest\u003c/var\u003e\"\n```\n\nThe request contains the following fields:\n\n`zoom`\n: The zoom level of the viewport.\n\n`north`, `south`, `east`, `west`\n: The furthest north, south, east, and west points in the viewport, expressed in\n degrees. North and south must be in the range (-90,90), east and west must be in\n the range (-180, 180). To express bounds crossing the antimeridian, west can be\n positive (for example, 170) and east can be negative (for example, -170). All\n parameters are required.\n\nViewport information responses\n------------------------------\n\nThe viewport response tells you which areas have imagery, and at which zoom\nlevels. A viewport information response has the following form. \n\n {\n \"copyright\": \"Map data ©2023\",\n \"maxZoomRects\": [\n {\n \"maxZoom\": 19,\n \"north\": 90,\n \"south\": -90,\n \"east\": 180,\n \"west\": -180\n },\n {\n \"maxZoom\": 9,\n \"north\": 90,\n \"south\": -90,\n \"east\": 180,\n \"west\": -180\n },\n {\n \"maxZoom\": 14,\n \"north\": 84.375,\n \"south\": -84.375,\n \"east\": 180,\n \"west\": -180\n }, ...\n ]\n }\n\n| **Note:** In this example, the `maxZoomRects` array contains more objects than is shown.\n\nThe response body contains the following fields.\n\n`copyright`\n: Contains an attribution string that you must display on your map when you\n display roadmap and satellite tiles. For more information, see the\n [Map Tiles API Policies](/maps/documentation/tile/policies#map-tiles-api).\n\n`maxZoomRect`\n: Contains an array of bounding rectangles that overlap with the current\n viewport. Also contains the maximum zoom level available within each rectangle.\n\nTile coordinate functions\n-------------------------\n\nTools (simple functions) are available in most programming languages to convert\nfrom latitude/longitude pairs to tile coordinates at a specific zoom level.\nConsider the following JavaScript code example that first converts from a\n`latLng` to a point, and then from a point to tile coordinates. \n\n var TILE_SIZE = 256;\n\n function fromLatLngToPoint(latLng) {\n var mercator = -Math.log(Math.tan((0.25 + latLng.lat() / 360) * Math.PI));\n return {\n x: TILE_SIZE * (latLng.lng() / 360 + 0.5),\n y: TILE_SIZE / 2 * (1 + mercator / Math.PI)\n };\n }\n\n function fromLatLngToTileCoord(latLng, zoom) {\n var point = fromLatLngToPoint(latLng);\n var scale = Math.pow(2, zoom);\n\n return {\n x: Math.floor(point.x * scale / TILE_SIZE),\n y: Math.floor(point.y * scale / TILE_SIZE),\n z: zoom\n };\n }"]]