Maps SDK برای iOS از سیستم مختصات زیر استفاده می کند:
مقادیر طول و عرض جغرافیایی، که به یک نقطه از جهان به طور منحصر به فرد اشاره می کنند. (گوگل از استاندارد سیستم ژئودتیک جهانی WGS84 استفاده می کند.)
مختصات جهان، که به یک نقطه روی نقشه به طور منحصر به فرد اشاره می کنند.
مختصات پیکسل، که به یک پیکسل خاص روی نقشه در یک سطح بزرگنمایی خاص اشاره می کنند.
مختصات کاشی، که به یک کاشی خاص روی نقشه در سطح بزرگنمایی خاص اشاره می کنند.
مختصات جهانی
هر زمان که API نیاز به ترجمه مکانی در جهان به مکانی روی نقشه داشته باشد، ابتدا مقادیر طول و عرض جغرافیایی را به مختصات جهانی ترجمه می کند. API از پروجکشن Mercator برای انجام این ترجمه استفاده می کند.
برای سهولت در محاسبه مختصات پیکسل (به زیر مراجعه کنید) فرض می کنیم نقشه در سطح زوم 0 یک کاشی منفرد با اندازه کاشی پایه است. سپس مختصات جهان را نسبت به مختصات پیکسل در سطح زوم 0 تعریف می کنیم، با استفاده از طرح ریزی برای تبدیل طول و عرض جغرافیایی به موقعیت پیکسل در این کاشی پایه. این مختصات جهانی یک مقدار ممیز شناور است که از مبدا طرح ریزی نقشه تا مکان خاص اندازه گیری می شود. توجه داشته باشید که از آنجایی که این مقدار یک مقدار ممیز شناور است، ممکن است بسیار دقیق تر از وضوح فعلی تصویر نقشه نشان داده شده باشد. به عبارت دیگر، یک مختصات جهانی مستقل از سطح زوم فعلی است.
مختصات جهان در نقشه های گوگل از مبدأ طرح مرکاتور (گوشه شمال غربی نقشه در 180 درجه طول جغرافیایی و تقریباً 85 درجه عرض جغرافیایی) اندازه گیری می شود و در جهت x به سمت شرق (راست) افزایش می یابد و در جهت y به سمت جنوب افزایش می یابد. (پایین). از آنجایی که کاشی اصلی Mercator Google Maps 256 x 256 پیکسل است، فضای مختصات جهان قابل استفاده {0-256}, {0-256} است.
توجه داشته باشید که یک برجستگی مرکاتور از نظر طولی دارای عرض محدود اما از نظر عرضی یک ارتفاع نامحدود است. ما تصاویر نقشه پایه را با استفاده از طرح مرکاتور در حدود +/- 85 درجه قطع کردیم تا نقشه حاصل را مربع شکل کنیم، که امکان منطق آسانتر را برای انتخاب کاشی فراهم میکند. توجه داشته باشید که اگر به عنوان مثال خیلی نزدیک به قطب ها رسم کنید، یک طرح ممکن است مختصات جهانی خارج از فضای مختصات قابل استفاده نقشه پایه ایجاد کند.
مختصات پیکسل
مختصات پیکسل به یک پیکسل خاص روی نقشه در یک سطح بزرگنمایی خاص اشاره دارد، در حالی که مختصات جهانی مکانهای مطلق را در یک طرح مشخص منعکس میکنند. مختصات پیکسل با استفاده از فرمول زیر محاسبه می شود:
pixelCoordinate = worldCoordinate * 2zoomLevel
از معادله بالا، توجه داشته باشید که هر سطح بزرگنمایی در حال افزایش در هر دو جهت x و y دو برابر بزرگتر است. بنابراین، هر سطح زوم بالاتر منجر به وضوح چهار برابر بیشتر از سطح قبلی می شود. به عنوان مثال، در سطح زوم 1، نقشه از 4 کاشی 256x256 پیکسل تشکیل شده است که در نتیجه یک فضای پیکسلی از 512x512 ایجاد می شود. در سطح زوم 19، هر پیکسل x و y روی نقشه را می توان با استفاده از مقداری بین 0 و 256 * 2 19 ارجاع داد.
از آنجایی که ما مختصات جهان را بر اساس اندازه کاشی نقشه قرار دادیم، قسمت صحیح مختصات پیکسلی تأثیری بر شناسایی پیکسل دقیق در آن مکان در سطح زوم فعلی دارد. توجه داشته باشید که برای سطح زوم 0، مختصات پیکسل با مختصات جهان برابر است.
ما اکنون راهی برای مشخص کردن دقیق هر مکان روی نقشه، در هر سطح بزرگنمایی داریم. Maps SDK برای iOS با توجه به مرکز سطح زوم نقشه (به عنوان LatLng ) و اندازه عنصر DOM حاوی یک درگاه دید ایجاد می کند و این کادر محدود را به مختصات پیکسلی ترجمه می کند. سپس API به طور منطقی تمام کاشی های نقشه را که در محدوده پیکسل های داده شده قرار دارند، تعیین می کند. هر یک از این کاشی های نقشه با استفاده از مختصات کاشی ارجاع داده می شوند که نمایش تصاویر نقشه را بسیار ساده می کند.
مختصات کاشی
API نمیتواند همه تصاویر نقشه را برای سطوح بزرگنمایی بالاتر به طور همزمان بارگیری کند. در عوض، API تصاویر را در هر سطح زوم به مجموعهای از کاشیهای نقشه تقسیم میکند، که بهطور منطقی به ترتیبی که برنامه درک میکند مرتب شدهاند. هنگامی که یک نقشه به یک مکان جدید یا به یک سطح بزرگنمایی جدید پیمایش میکند، API تعیین میکند که کدام کاشیها با استفاده از مختصات پیکسل مورد نیاز هستند و آن مقادیر را به مجموعهای از کاشیها برای بازیابی ترجمه میکند. این مختصات کاشی با استفاده از طرحی تخصیص داده می شوند که به طور منطقی تشخیص اینکه کدام کاشی حاوی تصاویر برای هر نقطه معین است را آسان می کند.
کاشیهای موجود در Google Maps از همان مبدأ شمارهگذاری شدهاند که برای پیکسلها. برای اجرای پیشبینی Mercator توسط Google، کاشی مبدا همیشه در گوشه شمال غربی نقشه قرار دارد، با مقادیر x از غرب به شرق و مقادیر y از شمال به جنوب افزایش مییابد. کاشی ها با استفاده از مختصات x,y از آن مبدا نمایه می شوند. به عنوان مثال، در سطح زوم 2، زمانی که زمین به 16 کاشی تقسیم می شود، هر کاشی را می توان با یک جفت x,y منحصر به فرد ارجاع داد:
توجه داشته باشید که با تقسیم مختصات پیکسل بر اندازه کاشی (256) و گرفتن قسمت های صحیح نتیجه، مختصات کاشی را در سطح زوم فعلی به عنوان محصول فرعی تولید می کنید.
مثال
مثال زیر مختصات شیکاگو، IL را نشان می دهد: مقادیر طول و عرض جغرافیایی، مختصات جهان، مختصات پیکسل و مختصات کاشی. از کنترل زوم برای مشاهده مقادیر مختصات در سطوح مختلف بزرگنمایی استفاده کنید.
تاریخ آخرین بهروزرسانی 2025-09-04 بهوقت ساعت هماهنگ جهانی.
[[["درک آسان","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-09-04 بهوقت ساعت هماهنگ جهانی."],[[["\u003cp\u003eThe Maps SDK for iOS utilizes four coordinate systems: latitude/longitude, world, pixel, and tile coordinates, to pinpoint locations on the map.\u003c/p\u003e\n"],["\u003cp\u003eWorld coordinates, derived from latitude/longitude using the Mercator projection, represent points on the map and are independent of zoom level.\u003c/p\u003e\n"],["\u003cp\u003ePixel coordinates denote specific pixels on the map at a given zoom level and are calculated by multiplying world coordinates by 2 raised to the power of the zoom level.\u003c/p\u003e\n"],["\u003cp\u003eTile coordinates are used to efficiently load map imagery by dividing the map into a grid of tiles, with each tile assigned a unique x,y coordinate based on its position.\u003c/p\u003e\n"],["\u003cp\u003eThe API utilizes these coordinate systems to translate between real-world locations and their corresponding representations on the map, enabling accurate display and navigation.\u003c/p\u003e\n"]]],["The Maps SDK for iOS utilizes latitude/longitude, world, pixel, and tile coordinate systems. World coordinates, based on the Mercator projection, convert latitude/longitude to map locations, independent of zoom. Pixel coordinates reference specific pixels at a zoom level, calculated by multiplying world coordinates by 2 to the power of the zoom level. Tile coordinates, derived from pixel coordinates, divide the map into tiles, enabling the API to retrieve and display only necessary imagery at various zoom levels. Each coordinate type is measured from the northwest corner.\n"],null,["Select platform: [Android](/maps/documentation/android-sdk/coordinates \"View this page for the Android platform docs.\") [iOS](/maps/documentation/ios-sdk/coordinates \"View this page for the iOS platform docs.\") [JavaScript](/maps/documentation/javascript/coordinates \"View this page for the JavaScript platform docs.\")\n\nThe Maps SDK for iOS uses the following coordinate systems:\n\n- Latitude and longitude values, which reference a point on the world uniquely. (Google uses the [World Geodetic\n System WGS84](https://en.wikipedia.org/wiki/World_Geodetic_System) standard.)\n- World coordinates, which reference a point on the map uniquely.\n- Pixel coordinates, which reference a specific pixel on the map at a specific zoom level.\n- Tile coordinates, which reference a specific tile on the map at a specific zoom level.\n\nWorld coordinates\n\nWhenever the API needs to translate a location in the world to a location on\na map, it first translates latitude and longitude values into a\n*world* coordinate. The API uses the\n[Mercator\nprojection](https://en.wikipedia.org/wiki/Mercator_projection) to perform this translation.\n\nFor convenience in the calculation of pixel coordinates (see below)\nwe assume a map at zoom level 0 is a single tile of the base tile size.\nWe then define world coordinates relative to pixel coordinates at zoom\nlevel 0, using the projection to convert latitudes and longitudes to\npixel positions on this base tile. This world coordinate is a floating\npoint value measured from the origin of the map projection to the\nspecific location. Note that since this value is a floating point value,\nit may be much more precise than the current resolution of the map image\nbeing shown. A world coordinate is independent of the current zoom level,\nin other words.\n\nWorld coordinates in Google Maps are measured from the Mercator\nprojection's origin (the northwest corner of the map at 180 degrees\nlongitude and approximately 85 degrees latitude) and increase in\nthe `x` direction towards the east (right) and increase in\nthe `y` direction towards the south (down). Because the\nbasic Mercator Google Maps tile is 256 x 256 pixels, the usable\nworld coordinate space is `{0-256}, {0-256}`.\n\nNote that a Mercator projection has a finite\nwidth longitudinally but an infinite height latitudinally. We cut off\nbase map imagery utilizing the Mercator projection at approximately\n+/- 85 degrees to make the resulting map shape square, which allows\neasier logic for tile selection. Note that a projection may produce\nworld coordinates outside the base map's usable coordinate space\nif you plot very near the poles, for example.\n\nPixel coordinates\n\n*Pixel coordinates* reference a specific pixel on the map at a\nspecific zoom level, whereas world coordinates reflect absolute locations on a\ngiven projection. Pixel coordinates are calculated using the following\nformula: \n\n```scdoc\npixelCoordinate = worldCoordinate * 2zoomLevel\n```\n\nFrom the above equation, note that each increasing zoom level\nis twice as large in both the `x` and `y`\ndirections. Therefore, each higher zoom level results in a resolution four\ntimes higher than the preceding level. For example, at zoom level 1,\nthe map consists of 4 256x256 pixels tiles, resulting in a pixel space\nfrom 512x512. At zoom level 19, each `x` and `y` pixel\non the map can be referenced using a value between\n0 and 256 \\* 2^19^.\n\nBecause we based world coordinates on the map's tile size, a\npixel coordinate's integer part has the effect of identifying the exact pixel\nat that location in the current zoom level. Note that for zoom level 0, the\npixel coordinates are equal to the world coordinates.\n\nWe now have a way to accurately denote each location on the map,\nat each zoom level. The Maps SDK for iOS constructs a viewport\ngiven the zoom level center of the map (as a `LatLng`) and the\nsize of the containing DOM element, and\ntranslates this bounding box into pixel coordinates. The API then determines\nlogically all map tiles which lie within the given pixel bounds. Each of\nthese map tiles are referenced using [tile coordinates](#tile-coordinates) which greatly simplify the displaying of map\nimagery.\n\nTile coordinates\n\nThe API cannot load all the map imagery at once for the higher zoom levels.\nInstead, the API breaks up the imagery at each zoom level\ninto a set of map tiles, which are logically arranged in an order which the\napplication understands. When a map scrolls to a new location, or to a new\nzoom level, the API determines which tiles are needed\nusing pixel coordinates, and translates those values into a set\nof tiles to retrieve. These tile coordinates are assigned using\na scheme which makes it logically easy to determine which tile contains\nthe imagery for any given point.\n\nTiles in Google Maps are numbered from the same origin as that\nfor pixels. For Google's implementation of the Mercator projection, the\norigin tile is always at the northwest corner\nof the map, with `x` values increasing from west to\neast and `y` values increasing from north to south. Tiles\nare indexed using `x,y` coordinates from that origin. For\nexample, at zoom level 2, when the earth is divided up into 16 tiles,\neach tile can be referenced by a unique `x,y` pair:\n\nNote that by dividing the pixel coordinates by the tile size (256) and\ntaking the integer parts of the result, you produce as a by-product\nthe tile coordinate at the current zoom level.\n\nExample\n\nThe following example displays coordinates for Chicago, IL:\nlatitude/longitude values, world coordinates, pixel coordinates, and tile\ncoordinates. Use the zoom control to see the coordinate values at various\nzoom levels.\n\nTo see how the coordinates were calculated,\n[view\nthe code](/maps/documentation/javascript/examples/map-coordinates)."]]