Maps

کلاس نقشه

google.maps . Map کلاس google.maps . Map

این کلاس MVCObject را گسترش می دهد.

با فراخوانی const {Map} = await google.maps.importLibrary("maps") دسترسی پیدا کنید. کتابخانه ها را در Maps JavaScript API ببینید.

Map
Map(mapDiv[, opts])
مولفه های:
  • mapDiv : HTMLElement نقشه برای پر کردن این عنصر رندر می شود.
  • opts : MapOptions optional
یک نقشه جدید در داخل ظرف HTML داده شده ایجاد می کند که معمولاً یک عنصر DIV است.
controls
نوع: Array < MVCArray < HTMLElement >>
کنترل های اضافی برای پیوست کردن به نقشه. برای افزودن یک کنترل به نقشه، <div> کنترل را به MVCArray مربوط به ControlPosition که باید در آن رندر شود، اضافه کنید.
data
نوع: Data
نمونه ای از Data که به نقشه متصل شده است. ویژگی هایی را به این شی Data اضافه کنید تا به راحتی آنها را در این نقشه نشان دهید.
mapTypes
رجیستری از نمونه های MapType با شناسه رشته.
overlayMapTypes
نوع: MVCArray < MapType optional >
انواع نقشه های اضافی برای همپوشانی. انواع نقشه های همپوشانی به ترتیبی که در آرایه overlayMapTypes ظاهر می شوند، در بالای نقشه پایه ای که به آن متصل شده اند، نمایش داده می شوند (همپوشانی هایی با مقادیر شاخص بالاتر در مقابل همپوشانی هایی با مقادیر شاخص کمتر نمایش داده می شوند).
fitBounds
fitBounds(bounds[, padding])
مولفه های:
  • bounds : LatLngBounds | LatLngBoundsLiteral Bounds برای نشان دادن.
  • padding : number| Padding optional Padding در پیکسل. محدوده ها در قسمتی از نقشه که پس از حذف padding باقی می ماند، متناسب خواهند بود. یک مقدار عددی در هر 4 طرف یک لایه را ایجاد می کند. برای ایجاد یک fitBounds در نتیجه getBounds، عدد 0 را در اینجا عرضه کنید.
ارزش بازگشتی: ندارد
ویوپورت را به گونه ای تنظیم می کند که محدوده های داده شده را داشته باشد.
توجه: هنگامی که نقشه روی display: none ، تنظیم شده است، تابع fitBounds اندازه نقشه را 0x0 می‌خواند و بنابراین کاری انجام نمی‌دهد. برای تغییر درگاه دید در حالی که نقشه پنهان است، نقشه را روی visibility: hidden قرار دهید، بنابراین مطمئن شوید که div نقشه اندازه واقعی دارد. برای نقشه های برداری، این روش شیب و سرفصل نقشه را روی مقادیر صفر پیش فرض تنظیم می کند. فراخوانی این روش ممکن است باعث ایجاد یک انیمیشن روان شود زیرا نقشه حرکت می کند و بزرگنمایی می کند تا با محدوده ها مطابقت داشته باشد. اینکه آیا این روش متحرک می شود یا نه به یک اکتشافی داخلی بستگی دارد.
getBounds
getBounds()
پارامترها: ندارد
مقدار بازگشتی: LatLngBounds |undefined مرزهای lat/lng نمای فعلی.
مرزهای lat/lng درگاه نمای فعلی را برمی‌گرداند. اگر بیش از یک نسخه از جهان قابل مشاهده باشد، محدوده در طول جغرافیایی از 180- تا 180 درجه متغیر است. اگر نقشه هنوز مقداردهی اولیه نشده باشد یا مرکز و بزرگنمایی تنظیم نشده باشد، نتیجه undefined است. برای نقشه‌های برداری با شیب یا عنوان غیر صفر، کرانهای lat/lng برگشتی نشان‌دهنده کوچک‌ترین کادر مرزی است که شامل ناحیه قابل مشاهده درگاه دید نقشه است. برای بدست آوردن ناحیه قابل مشاهده دقیق از نمای نقشه به MapCanvasProjection.getVisibleRegion مراجعه کنید.
getCenter
getCenter()
پارامترها: ندارد
مقدار بازگشتی: LatLng |undefined
موقعیت نمایش داده شده در مرکز نقشه را برمی گرداند. توجه داشته باشید که این شی LatLng پیچیده نشده است. برای اطلاعات بیشتر به LatLng مراجعه کنید. اگر مرکز یا مرزها تنظیم نشده باشد، نتیجه undefined است.
getClickableIcons
getClickableIcons()
پارامترها: ندارد
مقدار بازگشتی: boolean|undefined
قابلیت کلیک آیکون های نقشه را برمی گرداند. یک نماد نقشه نشان دهنده یک نقطه مورد علاقه است که به عنوان POI نیز شناخته می شود. اگر مقدار برگشتی true باشد، نمادها روی نقشه قابل کلیک هستند.
Beta getDatasetFeatureLayer
getDatasetFeatureLayer(datasetId)
مولفه های:
  • datasetId : string
مقدار بازگشتی: FeatureLayer
FeatureLayer را برای datasetId مشخص شده برمی گرداند. شناسه‌های مجموعه داده باید در Google Cloud Console پیکربندی شوند. اگر شناسه مجموعه داده با سبک نقشه نقشه مرتبط نباشد، یا اگر استایل مبتنی بر داده در دسترس نباشد (بدون شناسه نقشه، بدون کاشی‌های برداری، بدون لایه‌های ویژگی استایل مبتنی بر داده یا مجموعه داده‌هایی که در سبک نقشه پیکربندی شده‌اند)، این یک خطا، و FeatureLayer.isAvailable حاصل نادرست خواهد بود.
getDiv
getDiv()
پارامترها: ندارد
مقدار بازگشتی: HTMLElement mapDiv نقشه.
getFeatureLayer
getFeatureLayer(featureType)
مولفه های:
مقدار بازگشتی: FeatureLayer
FeatureLayer از FeatureType خاص را برمی‌گرداند. یک FeatureLayer باید در Google Cloud Console فعال باشد. اگر یک FeatureLayer از FeatureType مشخص شده در این نقشه وجود نداشته باشد، یا اگر استایل مبتنی بر داده در دسترس نباشد (بدون شناسه نقشه، بدون کاشی های برداری، و هیچ FeatureLayer در سبک نقشه فعال نشده باشد)، این یک خطا را ثبت می کند و نتیجه آن FeatureLayer.isAvailable نادرست خواهد بود.
getHeading
getHeading()
پارامترها: ندارد
مقدار بازگشتی: number|undefined
عنوان قطب نما نقشه را برمی گرداند. مقدار عنوان بر حسب درجه (در جهت عقربه های ساعت) از جهت اصلی شمال اندازه گیری می شود. اگر نقشه هنوز مقداردهی اولیه نشده باشد، نتیجه undefined است.
getMapCapabilities
getMapCapabilities()
پارامترها: ندارد
مقدار بازگشتی: MapCapabilities
بر اساس شناسه نقشه ارائه شده، تماس گیرنده را از قابلیت های موجود در نقشه مطلع می کند.
getMapTypeId
getMapTypeId()
پارامترها: ندارد
مقدار بازگشتی: MapTypeId |string|undefined
getProjection
getProjection()
پارامترها: ندارد
مقدار بازگشتی: Projection |undefined
Projection فعلی را برمی‌گرداند. اگر نقشه هنوز مقداردهی اولیه نشده باشد، نتیجه undefined است. به رویداد projection_changed گوش دهید و مقدار آن را بررسی کنید تا مطمئن شوید که undefined نیست.
getRenderingType
getRenderingType()
پارامترها: ندارد
مقدار بازگشتی: RenderingType
RenderingType فعلی نقشه را برمی‌گرداند.
getStreetView
getStreetView()
پارامترها: ندارد
مقدار بازگشتی: StreetViewPanorama پانورامای محدود به نقشه.
StreetViewPanorama پیش‌فرض متصل به نقشه را برمی‌گرداند، که ممکن است یک پانورامای پیش‌فرض تعبیه‌شده در نقشه باشد، یا مجموعه پانوراما با استفاده از setStreetView() . تغییرات در streetViewControl نقشه در نمایش چنین پانورامای محدودی منعکس خواهد شد.
getTilt
getTilt()
پارامترها: ندارد
مقدار بازگشتی: number|undefined
زاویه تابش فعلی نقشه را بر حسب درجه از صفحه دید به صفحه نقشه برمی‌گرداند. برای نقشه های شطرنجی، نتیجه برای تصاویری که مستقیماً از بالای سر گرفته شده اند 0 یا برای تصاویر 45 درجه 45 خواهد بود. این روش مقدار تنظیم شده توسط setTilt را بر نمی گرداند. برای جزئیات به setTilt مراجعه کنید.
getZoom
getZoom()
پارامترها: ندارد
مقدار بازگشتی: number|undefined
بزرگنمایی نقشه را برمی گرداند. اگر بزرگنمایی تنظیم نشده باشد، نتیجه undefined است.
moveCamera
moveCamera(cameraOptions)
مولفه های:
ارزش بازگشتی: ندارد
بلافاصله دوربین نقشه را روی گزینه های دوربین هدف قرار می دهد، بدون انیمیشن.
panBy
panBy(x, y)
مولفه های:
  • x : number پیکسل ها برای حرکت نقشه در جهت x.
  • y : number پیکسل ها برای حرکت نقشه در جهت y.
ارزش بازگشتی: ندارد
مرکز نقشه را با فاصله داده شده بر حسب پیکسل تغییر می دهد. اگر فاصله کمتر از عرض و ارتفاع نقشه باشد، انتقال به آرامی متحرک خواهد شد. توجه داشته باشید که سیستم مختصات نقشه از غرب به شرق (برای مقادیر x) و از شمال به جنوب (برای مقادیر y) افزایش می یابد.
panTo
panTo(latLng)
مولفه های:
  • latLng : LatLng | LatLngLiteral طول و عرض جغرافیایی مرکز جدید نقشه.
ارزش بازگشتی: ندارد
مرکز نقشه را به LatLng داده شده تغییر می دهد. اگر تغییر کمتر از عرض و ارتفاع نقشه باشد، انتقال به آرامی متحرک خواهد شد.
panToBounds
panToBounds(latLngBounds[, padding])
مولفه های:
  • latLngBounds : LatLngBounds | LatLngBoundsLiteral مرزهایی که باید نقشه را به آن حرکت دهید.
  • padding : number| Padding optional Padding در پیکسل. یک مقدار عددی در هر 4 طرف یک لایه را ایجاد می کند. مقدار پیش فرض 0 است.
ارزش بازگشتی: ندارد
نقشه را با حداقل مقدار لازم برای حاوی LatLngBounds داده شده حرکت می دهد. هیچ تضمینی نمی‌کند که کرانه‌ها در کجای نقشه قرار بگیرند، به جز اینکه نقشه تا حد امکان در داخل {currentMapSizeInPx} - {padding} نمایش داده می‌شود. برای هر دو نقشه شطرنجی و برداری، زوم، شیب و عنوان نقشه تغییر نخواهد کرد.
setCenter
setCenter(latlng)
مولفه های:
ارزش بازگشتی: ندارد
setClickableIcons
setClickableIcons(value)
مولفه های:
  • value : boolean
ارزش بازگشتی: ندارد
کنترل می کند که آیا نمادهای نقشه قابل کلیک هستند یا خیر. یک نماد نقشه نشان دهنده یک نقطه مورد علاقه است که به عنوان POI نیز شناخته می شود. برای غیرفعال کردن قابلیت کلیک کردن آیکون های نقشه، مقدار false را به این روش ارسال کنید.
setHeading
setHeading(heading)
مولفه های:
  • heading : number
ارزش بازگشتی: ندارد
سمت قطب نما را برای نقشه بر حسب درجه از جهت اصلی شمال اندازه گیری می کند. برای نقشه های شطرنجی، این روش فقط برای تصاویر هوایی کاربرد دارد.
setMapTypeId
setMapTypeId(mapTypeId)
مولفه های:
ارزش بازگشتی: ندارد
setOptions
setOptions(options)
مولفه های:
ارزش بازگشتی: ندارد
setStreetView
setStreetView(panorama)
مولفه های:
  • panorama : StreetViewPanorama optional پانوراما برای اتصال به نقشه.
ارزش بازگشتی: ندارد
یک StreetViewPanorama به نقشه متصل می کند. این پانوراما روی StreetViewPanorama پیش‌فرض لغو می‌شود و به نقشه اجازه می‌دهد به یک پانورامای خارجی خارج از نقشه متصل شود. تنظیم پانوراما بر روی null ، پانورامای تعبیه شده پیش فرض را به نقشه متصل می کند.
setTilt
setTilt(tilt)
مولفه های:
  • tilt : number
ارزش بازگشتی: ندارد
برای نقشه های برداری، زاویه تابش نقشه را تنظیم می کند. مقادیر مجاز بسته به سطح بزرگنمایی نقشه محدود می شوند. برای نقشه های شطرنجی، رفتار سوئیچینگ خودکار را برای زاویه برخورد نقشه کنترل می کند. تنها مقادیر مجاز 0 و 45 هستند. setTilt(0) باعث می شود که نقشه همیشه از نمای بالای 0 درجه صرف نظر از سطح زوم و درگاه دید استفاده کند. setTilt(45) باعث می شود هر زمان که تصویر 45 درجه برای سطح زوم فعلی و درگاه دید در دسترس باشد، زاویه شیب به طور خودکار به 45 تغییر کند، و هر زمان که تصویر 45 درجه در دسترس نباشد، به 0 برگردد (این رفتار پیش فرض است). تصاویر 45 درجه فقط برای انواع نقشه های satellite و hybrid ، در برخی مکان ها و در برخی از سطوح زوم در دسترس است. توجه: getTilt زاویه شیب فعلی را برمی گرداند، نه مقدار تنظیم شده توسط setTilt . از آنجایی که getTilt و setTilt به چیزهای مختلفی اشاره دارند، ویژگی tilt bind() نکنید. انجام این کار ممکن است اثرات غیر قابل پیش بینی داشته باشد.
setZoom
setZoom(zoom)
مولفه های:
  • zoom : number مقادیر بزرگنمایی بزرگتر با وضوح بالاتر مطابقت دارد.
ارزش بازگشتی: ندارد
بزرگنمایی نقشه را تنظیم می کند.
به ارث رسیده: addListener ، bindTo ، get ، notify ، set ، setValues ، unbind ، unbindAll
DEMO_MAP_ID شناسه نقشه که می تواند برای نمونه کدهایی که نیاز به شناسه نقشه دارند استفاده شود. این Map ID برای استفاده در برنامه‌های تولیدی در نظر گرفته نشده است و نمی‌تواند برای ویژگی‌هایی که نیاز به پیکربندی ابری دارند (مانند Cloud Styling) استفاده شود.
bounds_changed
function()
استدلال ها: هیچ
این رویداد زمانی فعال می شود که کران های درگاه دید تغییر کرده باشند.
center_changed
function()
استدلال ها: هیچ
این رویداد زمانی فعال می شود که ویژگی مرکز نقشه تغییر کند.
click
function(event)
استدلال ها:
این رویداد زمانی فعال می شود که کاربر روی نقشه کلیک کند. یک MapMouseEvent با ویژگی‌های مکان کلیک‌شده برگردانده می‌شود مگر اینکه روی نماد مکانی کلیک شده باشد، در این صورت یک IconMouseEvent با شناسه مکان برگردانده می‌شود. IconMouseEvent و MapMouseEvent یکسان هستند، با این تفاوت که IconMouseEvent دارای قسمت شناسه مکان است. هنگامی که شناسه مکان مهم نیست، همیشه می‌توان با رویداد به عنوان یک MapMouseEvent تلقی کرد. اگر روی یک نشانگر یا پنجره اطلاعات کلیک شود، رویداد کلیک فعال نمی شود.
contextmenu
function(event)
استدلال ها:
این رویداد زمانی فعال می‌شود که رویداد منوی متنی DOM روی کانتینر نقشه فعال شود.
dblclick
function(event)
استدلال ها:
این رویداد زمانی فعال می شود که کاربر روی نقشه دوبار کلیک کند. توجه داشته باشید که رویداد کلیک گاهی یک بار و گاهی دو بار درست قبل از این مورد فعال می شود.
drag
function()
استدلال ها: هیچ
این رویداد به طور مکرر اجرا می شود در حالی که کاربر نقشه را می کشد.
dragend
function()
استدلال ها: هیچ
این رویداد زمانی فعال می شود که کاربر کشیدن نقشه را متوقف کند.
dragstart
function()
استدلال ها: هیچ
این رویداد زمانی فعال می شود که کاربر شروع به کشیدن نقشه می کند.
heading_changed
function()
استدلال ها: هیچ
این رویداد زمانی فعال می شود که ویژگی عنوان نقشه تغییر کند.
idle
function()
استدلال ها: هیچ
این رویداد زمانی فعال می‌شود که نقشه پس از حرکت یا بزرگ‌نمایی غیرفعال شود.
isfractionalzoomenabled_changed
function()
استدلال ها: هیچ
این رویداد زمانی فعال می شود که ویژگی isFractionalZoomEnabled تغییر کند.
mapcapabilities_changed
function()
استدلال ها: هیچ
این رویداد زمانی فعال می شود که قابلیت های نقشه تغییر کند.
maptypeid_changed
function()
استدلال ها: هیچ
این رویداد زمانی فعال می شود که ویژگی mapTypeId تغییر کند.
mousemove
function(event)
استدلال ها:
این رویداد هر زمان که ماوس کاربر روی کانتینر نقشه حرکت کند فعال می شود.
mouseout
function(event)
استدلال ها:
این رویداد زمانی فعال می شود که ماوس کاربر از ظرف نقشه خارج می شود.
mouseover
function(event)
استدلال ها:
این رویداد زمانی فعال می شود که ماوس کاربر وارد کانتینر نقشه می شود.
projection_changed
function()
استدلال ها: هیچ
این رویداد زمانی فعال می شود که طرح ریزی تغییر کند.
renderingtype_changed
function()
استدلال ها: هیچ
این رویداد زمانی فعال می شود که نوع rendering تغییر کرده باشد.
tilesloaded
function()
استدلال ها: هیچ
این رویداد زمانی اجرا می‌شود که بارگذاری کاشی‌های قابل مشاهده به پایان برسد.
tilt_changed
function()
استدلال ها: هیچ
این رویداد زمانی فعال می شود که ویژگی شیب نقشه تغییر کند.
zoom_changed
function()
استدلال ها: هیچ
این رویداد زمانی فعال می شود که ویژگی بزرگنمایی نقشه تغییر کند.
rightclick
function(event)
استدلال ها:
این رویداد زمانی فعال می شود که کاربر روی نقشه کلیک راست کند.

رابط MapOptions

google.maps . MapOptions رابط google.maps . MapOptions

شی MapOptions برای تعریف ویژگی هایی که می توانند روی نقشه تنظیم شوند استفاده می شود.

backgroundColor optional
نوع: string optional
رنگ مورد استفاده برای پس زمینه نقشه div. این رنگ زمانی قابل مشاهده خواهد بود که کاشی‌ها هنوز هنگام حرکت کاربر بارگیری نشده باشند. این گزینه فقط زمانی قابل تنظیم است که نقشه اولیه باشد.
center optional
نوع: LatLng | LatLngLiteral optional
مرکز نقشه اولیه
clickableIcons optional
نوع: boolean optional
پیش فرض: true
در صورت false ، نمادهای نقشه قابل کلیک نیستند. یک نماد نقشه نشان دهنده یک نقطه مورد علاقه است که به عنوان POI نیز شناخته می شود.
controlSize optional
نوع: number optional
اندازه کنترل‌های ظاهر شده روی نقشه بر حسب پیکسل. این مقدار باید به طور مستقیم هنگام ایجاد نقشه ارائه شود، به روز رسانی این مقدار بعداً ممکن است کنترل ها را به حالت undefined برساند. فقط کنترل های ایجاد شده توسط خود Maps API را کنترل می کند. توسعه‌دهنده کنترل‌های سفارشی ایجاد کرده مقیاس نمی‌کند.
disableDefaultUI optional
نوع: boolean optional
همه دکمه های رابط کاربری پیش فرض را فعال/غیرفعال می کند. ممکن است به صورت جداگانه لغو شود. کنترل های صفحه کلید را که به طور جداگانه توسط گزینه MapOptions.keyboardShortcuts کنترل می شوند، غیرفعال نمی کند. کنترل‌های اشاره‌ای را که به طور جداگانه توسط گزینه MapOptions.gestureHandling کنترل می‌شوند، غیرفعال نمی‌کند.
disableDoubleClickZoom optional
نوع: boolean optional
زوم و مرکز را با دوبار کلیک فعال/غیرفعال می کند. به طور پیش فرض فعال است.

توجه : این ویژگی توصیه نمی شود. برای غیرفعال کردن بزرگنمایی روی دوبار کلیک، می توانید از ویژگی gestureHandling استفاده کنید و آن را روی "none" تنظیم کنید.

draggable optional
نوع: boolean optional
اگر false ، از کشیدن نقشه جلوگیری می کند. کشیدن به طور پیش فرض فعال است.
draggableCursor optional
نوع: string optional
نام یا نشانی اینترنتی مکان نما که هنگام حرکت ماوس روی نقشه قابل کشیدن نمایش داده می شود. این ویژگی از ویژگی css cursor برای تغییر آیکون استفاده می کند. همانند ویژگی css، باید حداقل یک مکان نما را مشخص کنید که URL نباشد. به عنوان مثال: draggableCursor: 'url( http://www.example.com/icon.png ), auto;' .
draggingCursor optional
نوع: string optional
نام یا نشانی اینترنتی مکان نما که هنگام کشیدن نقشه نمایش داده می شود. این ویژگی از ویژگی css cursor برای تغییر آیکون استفاده می کند. همانند ویژگی css، باید حداقل یک مکان نما را مشخص کنید که URL نباشد. برای مثال: draggingCursor: 'url( http://www.example.com/icon.png ), auto;' .
fullscreenControl optional
نوع: boolean optional
حالت فعال/غیرفعال کنترل تمام صفحه.
fullscreenControlOptions optional
نوع: FullscreenControlOptions optional
گزینه های نمایش برای کنترل تمام صفحه.
gestureHandling optional
نوع: string optional
این تنظیم نحوه مدیریت ژست‌ها را روی نقشه توسط API کنترل می‌کند. مقادیر مجاز:
  • "cooperative" : رویدادها و حرکات لمسی با یک انگشت را پیمایش کنید، صفحه را اسکرول کنید و نقشه را بزرگنمایی یا حرکت ندهید. حرکات لمسی دو انگشتی نقشه را حرکت داده و بزرگنمایی می کند. رویدادها را با کلید ctrl یا فشار دادن کلید ⌘ روی نقشه بزرگنمایی کنید.
    در این حالت نقشه با صفحه همکاری می کند .
  • "greedy" : تمام حرکات لمسی و پیمایش رویدادها روی نقشه حرکت می کنند یا بزرگنمایی می کنند.
  • "none" : نقشه را نمی توان با حرکات کاربر حرکت داد یا بزرگنمایی کرد.
  • "auto" : (پیش‌فرض) بسته به اینکه صفحه قابل پیمایش باشد یا در iframe، مدیریت اشاره یا مشارکتی یا حریصانه است.
heading optional
نوع: number optional
سمت برای تصاویر هوایی بر حسب درجه در جهت عقربه های ساعت از جهت اصلی شمال اندازه گیری شد. سرفصل‌ها به نزدیک‌ترین زاویه موجود که تصاویر در دسترس است، می‌چسبند.
isFractionalZoomEnabled optional
نوع: boolean optional
پیش فرض: true برای نقشه های برداری و false برای نقشه های شطرنجی
آیا نقشه باید به سطوح زوم کسری اجازه دهد یا خیر. به isfractionalzoomenabled_changed گوش دهید تا بدانید چه زمانی پیش‌فرض تنظیم شده است.
keyboardShortcuts optional
نوع: boolean optional
اگر false ، از کنترل نقشه توسط صفحه کلید جلوگیری می کند. میانبرهای صفحه کلید به طور پیش فرض فعال هستند.
mapId optional
نوع: string optional
شناسه نقشه نقشه این پارامتر را نمی توان پس از نمونه سازی نقشه تنظیم یا تغییر داد.
mapTypeControl optional
نوع: boolean optional
حالت اولیه فعال/غیرفعال کنترل نوع Map.
mapTypeControlOptions optional
نوع: MapTypeControlOptions optional
گزینه های نمایش اولیه برای کنترل نوع Map.
mapTypeId optional
نوع: MapTypeId |string optional
نقشه اولیه MapTypeId. پیش‌فرض ROADMAP .
maxZoom optional
نوع: number optional
حداکثر سطح بزرگنمایی که روی نقشه نمایش داده می شود. اگر حذف شود یا روی null تنظیم شود، به جای آن از حداکثر بزرگنمایی از نوع نقشه فعلی استفاده می شود. مقادیر بزرگنمایی معتبر اعدادی از صفر تا حداکثر سطح بزرگنمایی پشتیبانی شده هستند.
minZoom optional
نوع: number optional
حداقل سطح بزرگنمایی که روی نقشه نمایش داده می شود. اگر حذف شود یا روی null تنظیم شود، به جای آن از حداقل بزرگنمایی از نوع نقشه فعلی استفاده می شود. مقادیر بزرگنمایی معتبر اعدادی از صفر تا حداکثر سطح بزرگنمایی پشتیبانی شده هستند.
noClear optional
نوع: boolean optional
اگر true ، محتویات قسمت Map را پاک نکنید.
panControl optional
نوع: boolean optional
حالت فعال/غیرفعال کنترل Pan.

توجه: کنترل Pan در مجموعه کنترل‌های جدید معرفی‌شده در نسخه 3.22 API جاوا اسکریپت نقشه‌های Google موجود نیست. در حین استفاده از نسخه 3.22 و نسخه 3.23، می توانید از مجموعه کنترل های قبلی به جای کنترل های جدید استفاده کنید، بنابراین کنترل Pan را به عنوان بخشی از مجموعه کنترل قدیمی در دسترس قرار دهید. موارد جدید را در کنترل‌های نقشه نسخه 3.22 ببینید.

panControlOptions optional
نوع: PanControlOptions optional
گزینه های نمایش برای کنترل Pan.

توجه: کنترل Pan در مجموعه کنترل‌های جدید معرفی‌شده در نسخه 3.22 API جاوا اسکریپت نقشه‌های Google موجود نیست. در حین استفاده از نسخه 3.22 و نسخه 3.23، می توانید از مجموعه کنترل های قبلی به جای کنترل های جدید استفاده کنید، بنابراین کنترل Pan را به عنوان بخشی از مجموعه کنترل قدیمی در دسترس قرار دهید. موارد جدید را در کنترل‌های نقشه نسخه 3.22 ببینید.

restriction optional
نوع: MapRestriction optional
مرزی را تعیین می کند که محدوده نقشه را در دسترس کاربران محدود می کند. وقتی تنظیم شود، کاربر فقط می‌تواند در حالی که نمای دوربین در محدوده‌های مرزی باقی می‌ماند، حرکت کند و بزرگ‌نمایی کند.
rotateControl optional
نوع: boolean optional
حالت فعال/غیرفعال کنترل چرخش.
rotateControlOptions optional
نوع: RotateControlOptions optional
گزینه های نمایش برای کنترل چرخش.
scaleControl optional
نوع: boolean optional
حالت اولیه فعال/غیرفعال کنترل مقیاس.
scaleControlOptions optional
نوع: ScaleControlOptions optional
گزینه های نمایش اولیه برای کنترل مقیاس.
scrollwheel optional
نوع: boolean optional
اگر false ، زوم روی نقشه را با استفاده از چرخ پیمایش ماوس غیرفعال می کند. چرخ اسکرول به طور پیش فرض فعال است.

توجه : این ویژگی توصیه نمی شود. برای غیرفعال کردن بزرگنمایی با استفاده از چرخ اسکرول، می‌توانید از ویژگی gestureHandling استفاده کنید و آن را روی "cooperative" یا "none" تنظیم کنید.

streetView optional
نوع: StreetViewPanorama optional
یک StreetViewPanorama برای نمایش زمانی که آدمک نمای خیابان روی نقشه رها می شود. اگر پانوراما مشخص نشده باشد، هنگامی که آدمک رها شود، یک StreetViewPanorama پیش‌فرض در div نقشه نمایش داده می‌شود.
streetViewControl optional
نوع: boolean optional
حالت اولیه فعال/غیرفعال شده کنترل آدمک نمای خیابان. این کنترل بخشی از رابط کاربری پیش‌فرض است و هنگام نمایش یک نوع نقشه که پوشش خیابان نمای خیابان نباید روی آن ظاهر شود، باید روی false تنظیم شود (مثلاً یک نوع نقشه غیر زمینی).
streetViewControlOptions optional
نوع: StreetViewControlOptions optional
گزینه های نمایش اولیه برای کنترل آدمک نمای خیابان.
styles optional
نوع: Array < MapTypeStyle > optional
سبک هایی برای اعمال به هر یک از انواع نقشه های پیش فرض. توجه داشته باشید که برای حالت های satellite / hybrid و terrain ، این سبک ها فقط برای برچسب ها و هندسه اعمال می شوند.
tilt optional
نوع: number optional
برای نقشه های برداری، زاویه تابش نقشه را تنظیم می کند. مقادیر مجاز بسته به سطح بزرگنمایی نقشه محدود می شوند. برای نقشه های شطرنجی، رفتار سوئیچینگ خودکار را برای زاویه برخورد نقشه کنترل می کند. تنها مقادیر مجاز 0 و 45 هستند. مقدار 0 باعث می شود که نقشه همیشه از نمای بالای 0 درجه صرف نظر از سطح زوم و درگاه دید استفاده کند. مقدار 45 باعث می شود هر زمان که تصاویر 45 درجه برای سطح زوم فعلی و درگاه دید در دسترس باشد، زاویه شیب به طور خودکار به 45 تغییر کند و هر زمان که تصویر 45 درجه در دسترس نباشد به 0 برگردد (این رفتار پیش فرض است). تصاویر 45 درجه فقط برای انواع نقشه های satellite و hybrid ، در برخی مکان ها و در برخی از سطوح زوم در دسترس است. توجه: getTilt زاویه شیب فعلی را برمی گرداند، نه مقدار مشخص شده توسط این گزینه. از آنجایی که getTilt و این گزینه به چیزهای مختلفی اشاره دارد، ویژگی tilt bind() نکنید. انجام این کار ممکن است اثرات غیر قابل پیش بینی داشته باشد.
zoom optional
نوع: number optional
سطح بزرگنمایی نقشه اولیه. مقادیر بزرگنمایی معتبر اعدادی از صفر تا حداکثر سطح بزرگنمایی پشتیبانی شده هستند. مقادیر بزرگنمایی بزرگتر با وضوح بالاتر مطابقت دارد.
zoomControl optional
نوع: boolean optional
حالت فعال/غیرفعال کنترل زوم.
zoomControlOptions optional
نوع: ZoomControlOptions optional
گزینه های نمایش برای کنترل زوم.

کلاس MapElement

google.maps . MapElement کلاس google.maps . MapElement

MapElement یک زیر کلاس HTMLElement برای رندر کردن نقشه ها است. پس از بارگذاری کتابخانه maps ، می توان یک نقشه در HTML ایجاد کرد. مثلا:
<gmp-map center="37.4220656,-122.0840897" zoom="10" map-id="DEMO_MAP_ID"></gmp-map>

در داخل از Map استفاده می کند که با ویژگی innerMap قابل دسترسی است.

عنصر سفارشی:
<gmp-map center="lat,lng" map-id="string" zoom="number"></gmp-map>

این کلاس HTMLElement را گسترش می دهد.

این کلاس MapElementOptions را پیاده سازی می کند.

با فراخوانی const {MapElement} = await google.maps.importLibrary("maps") دسترسی پیدا کنید. کتابخانه ها را در Maps JavaScript API ببینید.

center
نوع: LatLng | LatLngLiteral optional
ویژگی HTML:
  • <gmp-map center="lat,lng"></gmp-map>
innerMap
نوع: Map
اشاره ای به Map که MapElement به صورت داخلی از آن استفاده می کند.
mapId
نوع: string optional
ویژگی HTML:
  • <gmp-map map-id="string"></gmp-map>
zoom
نوع: number optional
ویژگی HTML:
  • <gmp-map zoom="number"></gmp-map>
Beta addEventListener
addEventListener(type, listener[, options])
مولفه های:
  • type : string یک رشته حساس به حروف کوچک و بزرگ که نشان دهنده نوع رویداد برای گوش دادن است.
  • listener : EventListener | EventListenerObject شی ای که اعلان دریافت می کند. این باید یک تابع یا یک شی با متد handleEvent باشد
  • options : boolean| AddEventListenerOptions optional گزینه ها را ببینید. رویدادهای سفارشی فقط capture و passive پشتیبانی می کنند.
مقدار برگشتی: void
تابعی را تنظیم می کند که هر زمان که رویداد مشخص شده به هدف تحویل داده شود فراخوانی می شود. به addEventListener مراجعه کنید
Beta removeEventListener
removeEventListener(type, listener[, options])
مولفه های:
  • type : string رشته ای که نوع رویدادی را که برای حذف شنونده رویداد مشخص می کند.
  • listener : EventListener | EventListenerObject شنونده رویداد کنترل کننده رویداد برای حذف از هدف رویداد.
  • options : boolean| EventListenerOptions optional گزینه ها را ببینید
مقدار برگشتی: void
شنونده رویدادی که قبلاً با addEventListener ثبت شده بود را از هدف حذف می کند. removeEventListener را ببینید

رابط MapElementOptions

google.maps . MapElementOptions رابط google.maps . MapElementOptions

شی MapElementOptions برای تعریف ویژگی هایی که می توانند روی MapElement تنظیم شوند استفاده می شود.

center optional
نوع: LatLng | LatLngLiteral optional
مرکز نقشه اولیه
mapId optional
نوع: string optional
شناسه نقشه نقشه این پارامتر را نمی توان پس از نمونه سازی نقشه تنظیم یا تغییر داد.
zoom optional
نوع: number optional
سطح بزرگنمایی نقشه اولیه. مقادیر بزرگنمایی معتبر اعدادی از صفر تا حداکثر سطح بزرگنمایی پشتیبانی شده هستند. مقادیر بزرگنمایی بزرگتر با وضوح بالاتر مطابقت دارد.

رابط MapTypeStyle

google.maps . MapTypeStyle رابط google.maps . MapTypeStyle

MapTypeStyle مجموعه ای از انتخابگرها و استایلرها است که نحوه استایل دهی نقشه را مشخص می کند. انتخاب‌کننده‌ها ویژگی‌های نقشه و/یا عناصری را که باید تحت تأثیر قرار گیرند مشخص می‌کنند و استایلرها مشخص می‌کنند که چگونه آن ویژگی‌ها و عناصر باید اصلاح شوند. برای جزئیات، به مرجع سبک مراجعه کنید.

stylers
نوع: Array < Object >
قوانین سبک برای اعمال به ویژگی ها و عناصر نقشه انتخاب شده. قوانین به ترتیبی که در این آرایه مشخص کرده اید اعمال می شوند. برای دستورالعمل‌های استفاده و مقادیر مجاز، به مرجع سبک مراجعه کنید.
elementType optional
نوع: string optional
عنصری که یک استایلر باید روی آن اعمال شود. یک عنصر جنبه بصری یک ویژگی روی نقشه است. مثال: یک برچسب، یک نماد، سکته مغزی یا پر شده روی هندسه و موارد دیگر. اختیاری. اگر elementType مشخص نشده باشد، مقدار 'all' در نظر گرفته می شود. برای جزئیات استفاده و مقادیر مجاز، به مرجع سبک مراجعه کنید.
featureType optional
نوع: string optional
ویژگی یا گروهی از ویژگی‌ها که یک استایلر باید روی آن اعمال شود. اختیاری. اگر featureType مشخص نشده باشد، مقدار 'all' در نظر گرفته می شود. برای جزئیات استفاده و مقادیر مجاز، به مرجع سبک مراجعه کنید.

رابط MapMouseEvent

google.maps . MapMouseEvent رابط google.maps . MapMouseEvent

این شی از رویدادهای مختلف ماوس بر روی نقشه و همپوشانی ها برگردانده می شود و شامل تمام فیلدهای نشان داده شده در زیر است.

domEvent
رویداد DOM بومی مربوطه. توسعه‌دهندگان نباید به تعریف و سازگار بودن ویژگی‌های target ، currentTarget ، relatedTarget و path متکی باشند. توسعه دهندگان همچنین نباید به ساختار DOM پیاده سازی داخلی Maps API تکیه کنند. به دلیل نگاشت رویداد داخلی، domEvent ممکن است معنای متفاوتی با MapMouseEvent داشته باشد (مثلاً یک «کلیک» MapMouseEvent ممکن است دارای یک domEvent از نوع KeyboardEvent باشد).
latLng optional
نوع: LatLng optional
طول و عرض جغرافیایی که هنگام وقوع رویداد زیر مکان نما قرار داشت.
stop
stop()
پارامترها: ندارد
مقدار برگشتی: void
از انتشار بیشتر این رویداد جلوگیری می کند.

رابط IconMouseEvent

google.maps . IconMouseEvent رابط google.maps . IconMouseEvent

این شی در یک رویداد زمانی ارسال می شود که کاربر روی نمادی روی نقشه کلیک می کند. شناسه مکان این مکان در عضو placeId ذخیره می شود. برای جلوگیری از نمایش پنجره اطلاعات پیش فرض، متد stop() را در این رویداد فراخوانی کنید تا از انتشار آن جلوگیری کنید. در راهنمای برنامه‌نویس Places API درباره شناسه‌های مکان بیشتر بیاموزید.

این رابط MapMouseEvent را گسترش می دهد.

placeId optional
نوع: string optional
شناسه مکانی مکانی که روی آن کلیک شده است. از این شناسه مکان می توان برای پرس و جوی اطلاعات بیشتر در مورد ویژگی روی آن استفاده کرد.

در راهنمای برنامه‌نویس Places API درباره شناسه‌های مکان بیشتر بیاموزید.

ارثی: domEvent ، latLng
موروثی: stop

ثابت های MapTypeId

google.maps . MapTypeId ثابت های google.maps . MapTypeId

شناسه های MapType های رایج. اینها را با مقدار یا با استفاده از نام ثابت مشخص کنید. به عنوان مثال، 'satellite' یا google.maps.MapTypeId.SATELLITE .

با فراخوانی const {MapTypeId} = await google.maps.importLibrary("maps") دسترسی پیدا کنید. کتابخانه ها را در Maps JavaScript API ببینید.

HYBRID این نوع نقشه یک لایه شفاف از خیابان های اصلی را در تصاویر ماهواره ای نشان می دهد.
ROADMAP این نوع نقشه یک نقشه خیابان معمولی را نمایش می دهد.
SATELLITE این نوع نقشه تصاویر ماهواره ای را نمایش می دهد.
TERRAIN این نوع نقشه نقشه هایی را با ویژگی های فیزیکی مانند زمین و پوشش گیاهی نمایش می دهد.

کلاس MapTypeRegistry

google.maps . MapTypeRegistry کلاس google.maps . MapTypeRegistry

یک رجیستری برای نمونه های MapType، کلید شده توسط MapType id.

این کلاس MVCObject را گسترش می دهد.

با فراخوانی const {MapTypeRegistry} = await google.maps.importLibrary("maps") دسترسی پیدا کنید. کتابخانه ها را در Maps JavaScript API ببینید.

MapTypeRegistry
MapTypeRegistry()
پارامترها: ندارد
MapTypeRegistry مجموعه ای از انواع نقشه های سفارشی را برای استفاده در نقشه در اختیار دارد. به عنوان مثال، API هنگام ارائه لیستی از انواع نقشه های موجود در کنترل ها، با این رجیستری مشورت می کند.
set
set(id, mapType)
مولفه های:
  • id : string شناسه MapType برای افزودن به رجیستری.
  • mapType : MapType |* شی MapType برای افزودن به رجیستری.
ارزش بازگشتی: ندارد
رجیستری را طوری تنظیم می کند که شناسه رشته پاس شده را با MapType تصویب شده مرتبط کند.
به ارث رسیده: addListener ، bindTo ، get ، notify ، setValues ، unbind ، unbindAll

رابط MapRestriction

google.maps . MapRestriction رابط google.maps . MapRestriction

محدودیتی که می تواند روی نقشه اعمال شود. نمای نقشه از این محدودیت ها تجاوز نخواهد کرد.

latLngBounds
هنگامی که تنظیم شود، کاربر فقط می تواند در محدوده های داده شده حرکت کند و بزرگنمایی کند. کرانها می توانند هم طول و هم عرض جغرافیایی را محدود کنند یا فقط می توانند عرض جغرافیایی را محدود کنند. برای محدوده‌های فقط عرض جغرافیایی، از طول‌های غربی و شرقی به ترتیب 180- و 180- استفاده کنید، به عنوان مثال، latLngBounds: {north: northLat, south: southLat, west: -180, east: 180} .
strictBounds optional
نوع: boolean optional
مرزها را می توان با تنظیم پرچم strictBounds روی true محدودتر کرد. این کار میزان زوم کردن کاربر را کاهش می‌دهد و اطمینان حاصل می‌کند که همه چیز خارج از محدوده‌های محدود پنهان می‌ماند. پیش‌فرض false است، به این معنی که کاربر می‌تواند تا زمانی که کل ناحیه محدود دیده شود، کوچک‌نمایی کند، احتمالاً شامل مناطق خارج از منطقه محدود نیز می‌شود.

کلاس TrafficLayer

google.maps . TrafficLayer کلاس google.maps . TrafficLayer

یک لایه ترافیکی

این کلاس MVCObject را گسترش می دهد.

با فراخوانی const {TrafficLayer} = await google.maps.importLibrary("maps") دسترسی پیدا کنید. کتابخانه ها را در Maps JavaScript API ببینید.

TrafficLayer
TrafficLayer([opts])
مولفه های:
لایه ای که ترافیک فعلی جاده را نمایش می دهد.
getMap
getMap()
پارامترها: ندارد
مقدار بازگشتی: Map
نقشه ای را که این لایه در آن نمایش داده می شود، برمی گرداند.
setMap
setMap(map)
مولفه های:
ارزش بازگشتی: ندارد
لایه را روی نقشه مشخص شده رندر می کند. اگر نقشه روی null تنظیم شود، لایه حذف خواهد شد.
setOptions
setOptions(options)
مولفه های:
ارزش بازگشتی: ندارد
به ارث رسیده: addListener ، bindTo ، get ، notify ، set ، setValues ، unbind ، unbindAll

رابط TrafficLayerOptions

google.maps . TrafficLayerOptions رابط google.maps . TrafficLayerOptions

شی TrafficLayerOptions برای تعریف ویژگی هایی که می توانند روی TrafficLayer تنظیم شوند استفاده می شود.

autoRefresh optional
نوع: boolean optional
پیش فرض: true
آیا لایه ترافیک با اطلاعات به روز شده به طور خودکار تازه می شود.
map optional
نوع: Map optional
نقشه ای که در آن لایه ترافیک نمایش داده می شود.

کلاس TransitLayer

google.maps . TransitLayer کلاس google.maps . TransitLayer

یک لایه ترانزیت

این کلاس MVCObject را گسترش می دهد.

با فراخوانی const {TransitLayer} = await google.maps.importLibrary("maps") دسترسی پیدا کنید. کتابخانه ها را در Maps JavaScript API ببینید.

TransitLayer
TransitLayer()
پارامترها: ندارد
لایه ای که خطوط حمل و نقل را نمایش می دهد.
getMap
getMap()
پارامترها: ندارد
مقدار بازگشتی: Map
نقشه ای را که این لایه در آن نمایش داده می شود، برمی گرداند.
setMap
setMap(map)
مولفه های:
ارزش بازگشتی: ندارد
لایه را روی نقشه مشخص شده رندر می کند. اگر نقشه روی null تنظیم شود، لایه حذف خواهد شد.
به ارث رسیده: addListener ، bindTo ، get ، notify ، set ، setValues ، unbind ، unbindAll

کلاس BicyclingLayer

google.maps . BicyclingLayer کلاس google.maps . BicyclingLayer

لایه ای که خطوط و مسیرهای دوچرخه را نشان می دهد.

این کلاس MVCObject را گسترش می دهد.

با فراخوانی const {BicyclingLayer} = await google.maps.importLibrary("maps") دسترسی پیدا کنید. کتابخانه ها را در Maps JavaScript API ببینید.

BicyclingLayer
BicyclingLayer()
پارامترها: ندارد
لایه ای که خطوط و مسیرهای دوچرخه را نمایش می دهد و جاده های بزرگ را کاهش می دهد.
getMap
getMap()
پارامترها: ندارد
مقدار بازگشتی: Map
نقشه ای را که این لایه در آن نمایش داده می شود، برمی گرداند.
setMap
setMap(map)
مولفه های:
ارزش بازگشتی: ندارد
لایه را روی نقشه مشخص شده رندر می کند. اگر نقشه روی null تنظیم شود، لایه حذف خواهد شد.
به ارث رسیده: addListener ، bindTo ، get ، notify ، set ، setValues ، unbind ، unbindAll

رابط CameraOptions

google.maps . CameraOptions رابط google.maps . CameraOptions

برای تنظیم گزینه های دوربین نقشه استفاده می شود.

center optional
نوع: LatLngLiteral | LatLng optional
heading optional
نوع: number optional
tilt optional
نوع: number optional
zoom optional
نوع: number optional

رابط VisibleRegion

google.maps . VisibleRegion رابط google.maps . VisibleRegion

شامل چهار نقطه است که چند ضلعی چهار وجهی را که ناحیه قابل مشاهده نقشه است، مشخص می کند. در نقشه برداری این چند ضلعی می تواند به جای مستطیل یک ذوزنقه باشد، زمانی که نقشه برداری دارای شیب باشد.

farLeft
نوع: LatLng
farRight
نوع: LatLng
latLngBounds
نوع: LatLngBounds
کوچکترین جعبه مرزی که شامل ناحیه قابل مشاهده است.
nearLeft
نوع: LatLng
nearRight
نوع: LatLng

RenderingType ثابت

google.maps . RenderingType ثابت

با فراخوانی const {RenderingType} = await google.maps.importLibrary("maps") دسترسی پیدا کنید. کتابخانه ها را در Maps JavaScript API ببینید.

RASTER نشان می دهد که نقشه یک نقشه شطرنجی است.
UNINITIALIZED نشان می دهد که هنوز مشخص نیست که نقشه برداری است یا شطرنجی، زیرا نقشه هنوز مقداردهی اولیه را به پایان نرسانده است.
VECTOR نشان می دهد که نقشه یک نقشه برداری است.

رابط MapCapabilities

google.maps . MapCapabilities

شی حاوی یک عکس فوری از چه قابلیت هایی در حال حاضر برای نقشه در دسترس است. توجه داشته باشید که این لزوماً به این معنی نیست که ماژول های مربوطه بارگیری یا مقداردهی اولیه شده اند، بلکه به این معنی است که نقشه فعلی مجوز استفاده از این API ها را دارد. برای مشاهده لیستی از قابلیت های احتمالی، خواص را ببینید.

isAdvancedMarkersAvailable optional
نوع: boolean optional
اگر درست باشد، این نقشه به درستی پیکربندی شده است تا امکان استفاده از نشانگرهای پیشرفته را فراهم کند. توجه داشته باشید که برای استفاده از نشانگرهای پیشرفته همچنان باید کتابخانه marker وارد کنید. برای اطلاعات بیشتر به https://goo.gle/gmp-isAdvancedMarkersAvailable مراجعه کنید.
isDataDrivenStylingAvailable optional
نوع: boolean optional
اگر درست باشد، این نقشه به درستی پیکربندی شده است تا امکان استفاده از استایل مبتنی بر داده را برای حداقل یک FeatureLayer فراهم کند. برای اطلاعات بیشتر به https://goo.gle/gmp-data-driven-styling و https://goo.gle/gmp-FeatureLayerIsAvailable مراجعه کنید.
،

کلاس نقشه

google.maps . Map کلاس google.maps . Map

این کلاس MVCObject را گسترش می دهد.

با فراخوانی const {Map} = await google.maps.importLibrary("maps") دسترسی پیدا کنید. کتابخانه ها را در Maps JavaScript API ببینید.

Map
Map(mapDiv[, opts])
مولفه های:
  • mapDiv : HTMLElement نقشه برای پر کردن این عنصر رندر می شود.
  • opts : MapOptions optional
یک نقشه جدید در داخل ظرف HTML داده شده ایجاد می کند که معمولاً یک عنصر DIV است.
controls
نوع: Array < MVCArray < HTMLElement >>
کنترل های اضافی برای پیوست کردن به نقشه. برای افزودن یک کنترل به نقشه، <div> کنترل را به MVCArray مربوط به ControlPosition که باید در آن رندر شود، اضافه کنید.
data
نوع: Data
نمونه ای از Data که به نقشه متصل شده است. ویژگی هایی را به این شی Data اضافه کنید تا به راحتی آنها را در این نقشه نشان دهید.
mapTypes
رجیستری از نمونه های MapType با شناسه رشته.
overlayMapTypes
نوع: MVCArray < MapType optional >
انواع نقشه های اضافی برای همپوشانی. انواع نقشه های همپوشانی به ترتیبی که در آرایه overlayMapTypes ظاهر می شوند، در بالای نقشه پایه ای که به آن متصل شده اند، نمایش داده می شوند (همپوشانی هایی با مقادیر شاخص بالاتر در مقابل همپوشانی هایی با مقادیر شاخص کمتر نمایش داده می شوند).
fitBounds
fitBounds(bounds[, padding])
مولفه های:
  • bounds : LatLngBounds | LatLngBoundsLiteral Bounds برای نشان دادن.
  • padding : number| Padding optional Padding در پیکسل. محدوده ها در قسمتی از نقشه که پس از حذف padding باقی می ماند، متناسب خواهند بود. یک مقدار عددی در هر 4 طرف یک لایه را ایجاد می کند. برای ایجاد یک fitBounds در نتیجه getBounds، عدد 0 را در اینجا عرضه کنید.
ارزش بازگشتی: ندارد
ویوپورت را به گونه ای تنظیم می کند که محدوده های داده شده را داشته باشد.
توجه: هنگامی که نقشه روی display: none ، تنظیم شده است، تابع fitBounds اندازه نقشه را 0x0 می‌خواند و بنابراین کاری انجام نمی‌دهد. برای تغییر درگاه دید در حالی که نقشه پنهان است، نقشه را روی visibility: hidden قرار دهید، بنابراین مطمئن شوید که div نقشه اندازه واقعی دارد. برای نقشه های برداری، این روش شیب و سرفصل نقشه را روی مقادیر صفر پیش فرض تنظیم می کند. فراخوانی این روش ممکن است باعث ایجاد یک انیمیشن روان شود زیرا نقشه حرکت می کند و بزرگنمایی می کند تا با محدوده ها مطابقت داشته باشد. اینکه آیا این روش متحرک می شود یا نه به یک اکتشافی داخلی بستگی دارد.
getBounds
getBounds()
پارامترها: ندارد
مقدار بازگشتی: LatLngBounds |undefined مرزهای lat/lng نمای فعلی.
مرزهای lat/lng درگاه نمای فعلی را برمی‌گرداند. If more than one copy of the world is visible, the bounds range in longitude from -180 to 180 degrees inclusive. If the map is not yet initialized or center and zoom have not been set then the result is undefined . For vector maps with non-zero tilt or heading, the returned lat/lng bounds represents the smallest bounding box that includes the visible region of the map's viewport. See MapCanvasProjection.getVisibleRegion for getting the exact visible region of the map's viewport.
getCenter
getCenter()
Parameters: None
Return Value: LatLng |undefined
Returns the position displayed at the center of the map. Note that this LatLng object is not wrapped. See LatLng for more information. If the center or bounds have not been set then the result is undefined .
getClickableIcons
getClickableIcons()
Parameters: None
Return Value: boolean|undefined
Returns the clickability of the map icons. A map icon represents a point of interest, also known as a POI. If the returned value is true , then the icons are clickable on the map.
Beta getDatasetFeatureLayer
getDatasetFeatureLayer(datasetId)
Parameters:
  • datasetId : string
Return Value: FeatureLayer
Returns the FeatureLayer for the specified datasetId . Dataset IDs must be configured in the Google Cloud Console. If the dataset ID is not associated with the map's map style, or if Data-driven styling is not available (no map ID, no vector tiles, no Data-Driven Styling feature layers or Datasets configured in the Map Style), this logs an error, and the resulting FeatureLayer.isAvailable will be false.
getDiv
getDiv()
Parameters: None
Return Value: HTMLElement The mapDiv of the map.
getFeatureLayer
getFeatureLayer(featureType)
Parameters:
Return Value: FeatureLayer
Returns the FeatureLayer of the specific FeatureType . A FeatureLayer must be enabled in the Google Cloud Console. If a FeatureLayer of the specified FeatureType does not exist on this map, or if Data-driven styling is not available (no map ID, no vector tiles, and no FeatureLayer enabled in the map style), this logs an error, and the resulting FeatureLayer.isAvailable will be false.
getHeading
getHeading()
Parameters: None
Return Value: number|undefined
Returns the compass heading of the map. The heading value is measured in degrees (clockwise) from cardinal direction North. If the map is not yet initialized then the result is undefined .
getMapCapabilities
getMapCapabilities()
Parameters: None
Return Value: MapCapabilities
Informs the caller of the current capabilities available to the map based on the Map ID that was provided.
getMapTypeId
getMapTypeId()
Parameters: None
Return Value: MapTypeId |string|undefined
getProjection
getProjection()
Parameters: None
Return Value: Projection |undefined
Returns the current Projection . If the map is not yet initialized then the result is undefined . Listen to the projection_changed event and check its value to ensure it is not undefined .
getRenderingType
getRenderingType()
Parameters: None
Return Value: RenderingType
Returns the current RenderingType of the map.
getStreetView
getStreetView()
Parameters: None
Return Value: StreetViewPanorama The panorama bound to the map.
Returns the default StreetViewPanorama bound to the map, which may be a default panorama embedded within the map, or the panorama set using setStreetView() . Changes to the map's streetViewControl will be reflected in the display of such a bound panorama.
getTilt
getTilt()
Parameters: None
Return Value: number|undefined
Returns the current angle of incidence of the map, in degrees from the viewport plane to the map plane. For raster maps, the result will be 0 for imagery taken directly overhead or 45 for 45° imagery. This method does not return the value set by setTilt . See setTilt for details.
getZoom
getZoom()
Parameters: None
Return Value: number|undefined
Returns the zoom of the map. If the zoom has not been set then the result is undefined .
moveCamera
moveCamera(cameraOptions)
Parameters:
ارزش بازگشتی: ندارد
Immediately sets the map's camera to the target camera options, without animation.
panBy
panBy(x, y)
Parameters:
  • x : number Number of pixels to move the map in the x direction.
  • y : number Number of pixels to move the map in the y direction.
ارزش بازگشتی: ندارد
Changes the center of the map by the given distance in pixels. If the distance is less than both the width and height of the map, the transition will be smoothly animated. Note that the map coordinate system increases from west to east (for x values) and north to south (for y values).
panTo
panTo(latLng)
Parameters:
ارزش بازگشتی: ندارد
Changes the center of the map to the given LatLng . If the change is less than both the width and height of the map, the transition will be smoothly animated.
panToBounds
panToBounds(latLngBounds[, padding])
Parameters:
  • latLngBounds : LatLngBounds | LatLngBoundsLiteral The bounds to pan the map to.
  • padding : number| Padding optional Padding in pixels. A number value will yield the same padding on all 4 sides. The default value is 0.
ارزش بازگشتی: ندارد
Pans the map by the minimum amount necessary to contain the given LatLngBounds . It makes no guarantee where on the map the bounds will be, except that the map will be panned to show as much of the bounds as possible inside {currentMapSizeInPx} - {padding} . For both raster and vector maps, the map's zoom, tilt, and heading will not be changed.
setCenter
setCenter(latlng)
Parameters:
ارزش بازگشتی: ندارد
setClickableIcons
setClickableIcons(value)
Parameters:
  • value : boolean
ارزش بازگشتی: ندارد
Controls whether the map icons are clickable or not. A map icon represents a point of interest, also known as a POI. To disable the clickability of map icons, pass a value of false to this method.
setHeading
setHeading(heading)
Parameters:
  • heading : number
ارزش بازگشتی: ندارد
Sets the compass heading for map measured in degrees from cardinal direction North. For raster maps, this method only applies to aerial imagery.
setMapTypeId
setMapTypeId(mapTypeId)
Parameters:
ارزش بازگشتی: ندارد
setOptions
setOptions(options)
Parameters:
ارزش بازگشتی: ندارد
setStreetView
setStreetView(panorama)
Parameters:
ارزش بازگشتی: ندارد
Binds a StreetViewPanorama to the map. This panorama overrides the default StreetViewPanorama , allowing the map to bind to an external panorama outside of the map. Setting the panorama to null binds the default embedded panorama back to the map.
setTilt
setTilt(tilt)
Parameters:
  • tilt : number
ارزش بازگشتی: ندارد
For vector maps, sets the angle of incidence of the map. The allowed values are restricted depending on the zoom level of the map. For raster maps, controls the automatic switching behavior for the angle of incidence of the map. The only allowed values are 0 and 45 . setTilt(0) causes the map to always use a 0° overhead view regardless of the zoom level and viewport. setTilt(45) causes the tilt angle to automatically switch to 45 whenever 45° imagery is available for the current zoom level and viewport, and switch back to 0 whenever 45° imagery is not available (this is the default behavior). 45° imagery is only available for satellite and hybrid map types, within some locations, and at some zoom levels. Note: getTilt returns the current tilt angle, not the value set by setTilt . Because getTilt and setTilt refer to different things, do not bind() the tilt property; doing so may yield unpredictable effects.
setZoom
setZoom(zoom)
Parameters:
  • zoom : number Larger zoom values correspond to a higher resolution.
ارزش بازگشتی: ندارد
Sets the zoom of the map.
به ارث رسیده: addListener ، bindTo ، get ، notify ، set ، setValues ، unbind ، unbindAll
DEMO_MAP_ID Map ID which can be used for code samples which require a Map ID. This Map ID is not intended for use in production applications and cannot be used for features which require cloud configuration (such as Cloud Styling).
bounds_changed
function()
Arguments: None
This event is fired when the viewport bounds have changed.
center_changed
function()
Arguments: None
This event is fired when the map center property changes.
click
function(event)
استدلال ها:
This event is fired when the user clicks on the map. A MapMouseEvent with properties for the clicked location is returned unless a place icon was clicked, in which case an IconMouseEvent with a place ID is returned. IconMouseEvent and MapMouseEvent are identical, except that IconMouseEvent has the place ID field. The event can always be treated as an MapMouseEvent when the place ID is not important. The click event is not fired if a marker or info window was clicked.
contextmenu
function(event)
استدلال ها:
This event is fired when the DOM contextmenu event is fired on the map container.
dblclick
function(event)
استدلال ها:
This event is fired when the user double-clicks on the map. Note that the click event will sometimes fire once and sometimes twice, right before this one.
drag
function()
Arguments: None
This event is repeatedly fired while the user drags the map.
dragend
function()
Arguments: None
This event is fired when the user stops dragging the map.
dragstart
function()
Arguments: None
This event is fired when the user starts dragging the map.
heading_changed
function()
Arguments: None
This event is fired when the map heading property changes.
idle
function()
Arguments: None
This event is fired when the map becomes idle after panning or zooming.
isfractionalzoomenabled_changed
function()
Arguments: None
This event is fired when the isFractionalZoomEnabled property has changed.
mapcapabilities_changed
function()
Arguments: None
This event is fired when the map capabilities change.
maptypeid_changed
function()
Arguments: None
This event is fired when the mapTypeId property changes.
mousemove
function(event)
استدلال ها:
This event is fired whenever the user's mouse moves over the map container.
mouseout
function(event)
استدلال ها:
This event is fired when the user's mouse exits the map container.
mouseover
function(event)
استدلال ها:
This event is fired when the user's mouse enters the map container.
projection_changed
function()
Arguments: None
This event is fired when the projection has changed.
renderingtype_changed
function()
Arguments: None
This event is fired when the renderingType has changed.
tilesloaded
function()
Arguments: None
This event is fired when the visible tiles have finished loading.
tilt_changed
function()
Arguments: None
This event is fired when the map tilt property changes.
zoom_changed
function()
Arguments: None
This event is fired when the map zoom property changes.
rightclick
function(event)
استدلال ها:
This event is fired when the user right-clicks on the map.

MapOptions interface

google.maps . MapOptions interface

MapOptions object used to define the properties that can be set on a Map.

backgroundColor optional
نوع: string optional
Color used for the background of the Map div. This color will be visible when tiles have not yet loaded as the user pans. This option can only be set when the map is initialized.
center optional
نوع: LatLng | LatLngLiteral optional
The initial Map center.
clickableIcons optional
نوع: boolean optional
Default: true
When false , map icons are not clickable. A map icon represents a point of interest, also known as a POI.
controlSize optional
Type: number optional
Size in pixels of the controls appearing on the map. This value must be supplied directly when creating the Map, updating this value later may bring the controls into an undefined state. Only governs the controls made by the Maps API itself. Does not scale developer created custom controls.
disableDefaultUI optional
نوع: boolean optional
Enables/disables all default UI buttons. May be overridden individually. Does not disable the keyboard controls, which are separately controlled by the MapOptions.keyboardShortcuts option. Does not disable gesture controls, which are separately controlled by the MapOptions.gestureHandling option.
disableDoubleClickZoom optional
نوع: boolean optional
Enables/disables zoom and center on double click. Enabled by default.

Note : This property is not recommended . To disable zooming on double click, you can use the gestureHandling property, and set it to "none" .

draggable optional
نوع: boolean optional
If false , prevents the map from being dragged. Dragging is enabled by default.
draggableCursor optional
نوع: string optional
The name or url of the cursor to display when mousing over a draggable map. This property uses the css cursor attribute to change the icon. As with the css property, you must specify at least one fallback cursor that is not a URL. For example: draggableCursor: 'url( http://www.example.com/icon.png ), auto;' .
draggingCursor optional
نوع: string optional
The name or url of the cursor to display when the map is being dragged. This property uses the css cursor attribute to change the icon. As with the css property, you must specify at least one fallback cursor that is not a URL. For example: draggingCursor: 'url( http://www.example.com/icon.png ), auto;' .
fullscreenControl optional
نوع: boolean optional
The enabled/disabled state of the Fullscreen control.
fullscreenControlOptions optional
Type: FullscreenControlOptions optional
The display options for the Fullscreen control.
gestureHandling optional
نوع: string optional
This setting controls how the API handles gestures on the map. Allowed values:
  • "cooperative" : Scroll events and one-finger touch gestures scroll the page, and do not zoom or pan the map. Two-finger touch gestures pan and zoom the map. Scroll events with a ctrl key or ⌘ key pressed zoom the map.
    In this mode the map cooperates with the page.
  • "greedy" : All touch gestures and scroll events pan or zoom the map.
  • "none" : The map cannot be panned or zoomed by user gestures.
  • "auto" : (default) Gesture handling is either cooperative or greedy, depending on whether the page is scrollable or in an iframe.
heading optional
Type: number optional
The heading for aerial imagery in degrees measured clockwise from cardinal direction North. Headings are snapped to the nearest available angle for which imagery is available.
isFractionalZoomEnabled optional
نوع: boolean optional
Default: true for vector maps and false for raster maps
Whether the map should allow fractional zoom levels. Listen to isfractionalzoomenabled_changed to know when the default has been set.
keyboardShortcuts optional
نوع: boolean optional
If false , prevents the map from being controlled by the keyboard. Keyboard shortcuts are enabled by default.
mapId optional
نوع: string optional
The Map ID of the map. This parameter cannot be set or changed after a map is instantiated.
mapTypeControl optional
نوع: boolean optional
The initial enabled/disabled state of the Map type control.
mapTypeControlOptions optional
Type: MapTypeControlOptions optional
The initial display options for the Map type control.
mapTypeId optional
Type: MapTypeId |string optional
The initial Map mapTypeId. Defaults to ROADMAP .
maxZoom optional
Type: number optional
The maximum zoom level which will be displayed on the map. If omitted, or set to null , the maximum zoom from the current map type is used instead. Valid zoom values are numbers from zero up to the supported maximum zoom level .
minZoom optional
Type: number optional
The minimum zoom level which will be displayed on the map. If omitted, or set to null , the minimum zoom from the current map type is used instead. Valid zoom values are numbers from zero up to the supported maximum zoom level .
noClear optional
نوع: boolean optional
If true , do not clear the contents of the Map div.
panControl optional
نوع: boolean optional
The enabled/disabled state of the Pan control.

Note: The Pan control is not available in the new set of controls introduced in v3.22 of the Google Maps JavaScript API. While using v3.22 and v3.23, you can choose to use the earlier set of controls rather than the new controls, thus making the Pan control available as part of the old control set. See What's New in the v3.22 Map Controls .

panControlOptions optional
Type: PanControlOptions optional
The display options for the Pan control.

Note: The Pan control is not available in the new set of controls introduced in v3.22 of the Google Maps JavaScript API. While using v3.22 and v3.23, you can choose to use the earlier set of controls rather than the new controls, thus making the Pan control available as part of the old control set. See What's New in the v3.22 Map Controls .

restriction optional
Type: MapRestriction optional
Defines a boundary that restricts the area of the map accessible to users. When set, a user can only pan and zoom while the camera view stays inside the limits of the boundary.
rotateControl optional
نوع: boolean optional
The enabled/disabled state of the Rotate control.
rotateControlOptions optional
Type: RotateControlOptions optional
The display options for the Rotate control.
scaleControl optional
نوع: boolean optional
The initial enabled/disabled state of the Scale control.
scaleControlOptions optional
Type: ScaleControlOptions optional
The initial display options for the Scale control.
scrollwheel optional
نوع: boolean optional
If false , disables zooming on the map using a mouse scroll wheel. The scrollwheel is enabled by default.

Note : This property is not recommended . To disable zooming using scrollwheel, you can use the gestureHandling property, and set it to either "cooperative" or "none" .

streetView optional
Type: StreetViewPanorama optional
A StreetViewPanorama to display when the Street View pegman is dropped on the map. If no panorama is specified, a default StreetViewPanorama will be displayed in the map's div when the pegman is dropped.
streetViewControl optional
نوع: boolean optional
The initial enabled/disabled state of the Street View Pegman control. This control is part of the default UI, and should be set to false when displaying a map type on which the Street View road overlay should not appear (eg a non-Earth map type).
streetViewControlOptions optional
Type: StreetViewControlOptions optional
The initial display options for the Street View Pegman control.
styles optional
Type: Array < MapTypeStyle > optional
Styles to apply to each of the default map types. Note that for satellite / hybrid and terrain modes, these styles will only apply to labels and geometry.
tilt optional
Type: number optional
For vector maps, sets the angle of incidence of the map. The allowed values are restricted depending on the zoom level of the map. For raster maps, controls the automatic switching behavior for the angle of incidence of the map. The only allowed values are 0 and 45 . The value 0 causes the map to always use a 0° overhead view regardless of the zoom level and viewport. The value 45 causes the tilt angle to automatically switch to 45 whenever 45° imagery is available for the current zoom level and viewport, and switch back to 0 whenever 45° imagery is not available (this is the default behavior). 45° imagery is only available for satellite and hybrid map types, within some locations, and at some zoom levels. Note: getTilt returns the current tilt angle, not the value specified by this option. Because getTilt and this option refer to different things, do not bind() the tilt property; doing so may yield unpredictable effects.
zoom optional
Type: number optional
The initial Map zoom level. Valid zoom values are numbers from zero up to the supported maximum zoom level . Larger zoom values correspond to a higher resolution.
zoomControl optional
نوع: boolean optional
The enabled/disabled state of the Zoom control.
zoomControlOptions optional
Type: ZoomControlOptions optional
The display options for the Zoom control.

MapElement class

google.maps . MapElement class

MapElement is an HTMLElement subclass for rendering maps. After loading the maps library, a map can be created in HTML. مثلا:
<gmp-map center="37.4220656,-122.0840897" zoom="10" map-id="DEMO_MAP_ID"></gmp-map>

Internally, it uses Map , which can be accessed with the innerMap property.

Custom element:
<gmp-map center="lat,lng" map-id="string" zoom="number"></gmp-map>

This class extends HTMLElement .

This class implements MapElementOptions .

Access by calling const {MapElement} = await google.maps.importLibrary("maps") . کتابخانه ها را در Maps JavaScript API ببینید.

center
نوع: LatLng | LatLngLiteral optional
HTML attribute:
  • <gmp-map center="lat,lng"></gmp-map>
innerMap
Type: Map
A reference to the Map that the MapElement uses internally.
mapId
نوع: string optional
HTML attribute:
  • <gmp-map map-id="string"></gmp-map>
zoom
Type: number optional
HTML attribute:
  • <gmp-map zoom="number"></gmp-map>
Beta addEventListener
addEventListener(type, listener[, options])
Parameters:
  • type : string A case-sensitive string representing the event type to listen for.
  • listener : EventListener | EventListenerObject The object that receives a notification. This must be a function or an object with the handleEvent method
  • options : boolean| AddEventListenerOptions optional See options . Custom events only support capture and passive .
Return Value: void
Sets up a function that will be called whenever the specified event is delivered to the target. See addEventListener
Beta removeEventListener
removeEventListener(type, listener[, options])
Parameters:
Return Value: void
Removes an event listener previously registered with addEventListener from the target. See removeEventListener

MapElementOptions interface

google.maps . MapElementOptions interface

MapElementOptions object used to define the properties that can be set on a MapElement.

center optional
نوع: LatLng | LatLngLiteral optional
The initial Map center.
mapId optional
نوع: string optional
The Map ID of the map. This parameter cannot be set or changed after a map is instantiated.
zoom optional
Type: number optional
The initial Map zoom level. Valid zoom values are numbers from zero up to the supported maximum zoom level . Larger zoom values correspond to a higher resolution.

MapTypeStyle interface

google.maps . MapTypeStyle interface

The MapTypeStyle is a collection of selectors and stylers that define how the map should be styled. Selectors specify the map features and/or elements that should be affected, and stylers specify how those features and elements should be modified. For details, see the style reference .

stylers
Type: Array < Object >
The style rules to apply to the selected map features and elements. The rules are applied in the order that you specify in this array. For guidelines on usage and allowed values, see the style reference .
elementType optional
نوع: string optional
The element to which a styler should be applied. An element is a visual aspect of a feature on the map. Example: a label, an icon, the stroke or fill applied to the geometry, and more. اختیاری. If elementType is not specified, the value is assumed to be 'all' . For details of usage and allowed values, see the style reference .
featureType optional
نوع: string optional
The feature, or group of features, to which a styler should be applied. اختیاری. If featureType is not specified, the value is assumed to be 'all' . For details of usage and allowed values, see the style reference .

MapMouseEvent interface

google.maps . MapMouseEvent interface

This object is returned from various mouse events on the map and overlays, and contains all the fields shown below.

domEvent
The corresponding native DOM event. Developers should not rely on target , currentTarget , relatedTarget and path properties being defined and consistent. Developers should not also rely on the DOM structure of the internal implementation of the Maps API. Due to internal event mapping, the domEvent may have different semantics from the MapMouseEvent (eg a MapMouseEvent "click" may have a domEvent of type KeyboardEvent ).
latLng optional
Type: LatLng optional
The latitude/longitude that was below the cursor when the event occurred.
stop
stop()
Parameters: None
Return Value: void
Prevents this event from propagating further.

IconMouseEvent interface

google.maps . IconMouseEvent interface

This object is sent in an event when a user clicks on an icon on the map. The place ID of this place is stored in the placeId member. To prevent the default info window from showing up, call the stop() method on this event to prevent it being propagated. Learn more about place IDs in the Places API developer guide.

This interface extends MapMouseEvent .

placeId optional
نوع: string optional
The place ID of the place that was clicked. This place ID can be used to query more information about the feature that was clicked.

Learn more about place IDs in the Places API developer guide.

Inherited: domEvent , latLng
Inherited: stop

MapTypeId constants

google.maps . MapTypeId constants

Identifiers for common MapTypes. Specify these by value, or by using the constant's name. For example, 'satellite' or google.maps.MapTypeId.SATELLITE .

Access by calling const {MapTypeId} = await google.maps.importLibrary("maps") . کتابخانه ها را در Maps JavaScript API ببینید.

HYBRID This map type displays a transparent layer of major streets on satellite images.
ROADMAP This map type displays a normal street map.
SATELLITE This map type displays satellite images.
TERRAIN This map type displays maps with physical features such as terrain and vegetation.

MapTypeRegistry class

google.maps . MapTypeRegistry class

A registry for MapType instances, keyed by MapType id.

این کلاس MVCObject را گسترش می دهد.

Access by calling const {MapTypeRegistry} = await google.maps.importLibrary("maps") . کتابخانه ها را در Maps JavaScript API ببینید.

MapTypeRegistry
MapTypeRegistry()
Parameters: None
The MapTypeRegistry holds the collection of custom map types available to the map for its use. The API consults this registry when providing the list of available map types within controls, for example.
set
set(id, mapType)
Parameters:
  • id : string Identifier of the MapType to add to the registry.
  • mapType : MapType |* MapType object to add to the registry.
ارزش بازگشتی: ندارد
Sets the registry to associate the passed string identifier with the passed MapType.
Inherited: addListener , bindTo , get , notify , setValues , unbind , unbindAll

MapRestriction interface

google.maps . MapRestriction interface

A restriction that can be applied to the Map. The map's viewport will not exceed these restrictions.

latLngBounds
When set, a user can only pan and zoom inside the given bounds. Bounds can restrict both longitude and latitude, or can restrict latitude only. For latitude-only bounds use west and east longitudes of -180 and 180, respectively, for example, latLngBounds: {north: northLat, south: southLat, west: -180, east: 180} .
strictBounds optional
نوع: boolean optional
Bounds can be made more restrictive by setting the strictBounds flag to true . This reduces how far a user can zoom out, ensuring that everything outside of the restricted bounds stays hidden. The default is false , meaning that a user can zoom out until the entire bounded area is in view, possibly including areas outside the bounded area.

TrafficLayer class

google.maps . TrafficLayer class

A traffic layer.

این کلاس MVCObject را گسترش می دهد.

Access by calling const {TrafficLayer} = await google.maps.importLibrary("maps") . کتابخانه ها را در Maps JavaScript API ببینید.

TrafficLayer
TrafficLayer([opts])
Parameters:
A layer that displays current road traffic.
getMap
getMap()
Parameters: None
Return Value: Map
Returns the map on which this layer is displayed.
setMap
setMap(map)
Parameters:
ارزش بازگشتی: ندارد
Renders the layer on the specified map. If map is set to null , the layer will be removed.
setOptions
setOptions(options)
Parameters:
ارزش بازگشتی: ندارد
به ارث رسیده: addListener ، bindTo ، get ، notify ، set ، setValues ، unbind ، unbindAll

TrafficLayerOptions interface

google.maps . TrafficLayerOptions interface

TrafficLayerOptions object used to define the properties that can be set on a TrafficLayer.

autoRefresh optional
نوع: boolean optional
Default: true
Whether the traffic layer refreshes with updated information automatically.
map optional
Type: Map optional
Map on which to display the traffic layer.

TransitLayer class

google.maps . TransitLayer class

A transit layer.

این کلاس MVCObject را گسترش می دهد.

Access by calling const {TransitLayer} = await google.maps.importLibrary("maps") . کتابخانه ها را در Maps JavaScript API ببینید.

TransitLayer
TransitLayer()
Parameters: None
A layer that displays transit lines.
getMap
getMap()
Parameters: None
Return Value: Map
Returns the map on which this layer is displayed.
setMap
setMap(map)
Parameters:
ارزش بازگشتی: ندارد
Renders the layer on the specified map. If map is set to null , the layer will be removed.
به ارث رسیده: addListener ، bindTo ، get ، notify ، set ، setValues ، unbind ، unbindAll

BicyclingLayer class

google.maps . BicyclingLayer class

A layer showing bike lanes and paths.

این کلاس MVCObject را گسترش می دهد.

Access by calling const {BicyclingLayer} = await google.maps.importLibrary("maps") . کتابخانه ها را در Maps JavaScript API ببینید.

BicyclingLayer
BicyclingLayer()
Parameters: None
A layer that displays bike lanes and paths and demotes large roads.
getMap
getMap()
Parameters: None
Return Value: Map
Returns the map on which this layer is displayed.
setMap
setMap(map)
Parameters:
ارزش بازگشتی: ندارد
Renders the layer on the specified map. If map is set to null , the layer will be removed.
به ارث رسیده: addListener ، bindTo ، get ، notify ، set ، setValues ، unbind ، unbindAll

CameraOptions interface

google.maps . CameraOptions interface

Used for setting the map's camera options.

center optional
Type: LatLngLiteral | LatLng optional
heading optional
Type: number optional
tilt optional
Type: number optional
zoom optional
Type: number optional

VisibleRegion interface

google.maps . VisibleRegion interface

Contains the four points defining the four-sided polygon that is the visible region of the map. On a vector map this polygon can be a trapezoid instead of a rectangle, when a vector map has tilt.

farLeft
Type: LatLng
farRight
Type: LatLng
latLngBounds
The smallest bounding box that includes the visible region.
nearLeft
Type: LatLng
nearRight
Type: LatLng

RenderingType constants

google.maps . RenderingType constants

Access by calling const {RenderingType} = await google.maps.importLibrary("maps") . کتابخانه ها را در Maps JavaScript API ببینید.

RASTER Indicates that the map is a raster map.
UNINITIALIZED Indicates that it is unknown yet whether the map is vector or raster, because the map has not finished initializing yet.
VECTOR Indicates that the map is a vector map.

MapCapabilities interface

google.maps . MapCapabilities interface

Object containing a snapshot of what capabilities are currently available for the Map. Note that this does not necessarily mean that relevant modules are loaded or initialized, but rather that the current map has permission to use these APIs. See the properties for a list of possible capabilities.

isAdvancedMarkersAvailable optional
نوع: boolean optional
If true, this map is configured properly to allow for the use of advanced markers. Note that you must still import the marker library in order to use advanced markers. See https://goo.gle/gmp-isAdvancedMarkersAvailable for more information.
isDataDrivenStylingAvailable optional
نوع: boolean optional
If true, this map is configured properly to allow for the use of data-driven styling for at least one FeatureLayer. See https://goo.gle/gmp-data-driven-styling and https://goo.gle/gmp-FeatureLayerIsAvailable for more information.
،

Map class

google.maps . Map class

این کلاس MVCObject را گسترش می دهد.

Access by calling const {Map} = await google.maps.importLibrary("maps") . کتابخانه ها را در Maps JavaScript API ببینید.

Map
Map(mapDiv[, opts])
Parameters:
Creates a new map inside of the given HTML container, which is typically a DIV element.
controls
Type: Array < MVCArray < HTMLElement >>
Additional controls to attach to the map. To add a control to the map, add the control's <div> to the MVCArray corresponding to the ControlPosition where it should be rendered.
data
Type: Data
An instance of Data , bound to the map. Add features to this Data object to conveniently display them on this map.
mapTypes
A registry of MapType instances by string ID.
overlayMapTypes
Type: MVCArray < MapType optional >
Additional map types to overlay. Overlay map types will display on top of the base map they are attached to, in the order in which they appear in the overlayMapTypes array (overlays with higher index values are displayed in front of overlays with lower index values).
fitBounds
fitBounds(bounds[, padding])
Parameters:
  • bounds : LatLngBounds | LatLngBoundsLiteral Bounds to show.
  • padding : number| Padding optional Padding in pixels. The bounds will be fit in the part of the map that remains after padding is removed. A number value will yield the same padding on all 4 sides. Supply 0 here to make a fitBounds idempotent on the result of getBounds.
ارزش بازگشتی: ندارد
Sets the viewport to contain the given bounds.
Note: When the map is set to display: none , the fitBounds function reads the map's size as 0x0, and therefore does not do anything. To change the viewport while the map is hidden, set the map to visibility: hidden , thereby ensuring the map div has an actual size. For vector maps, this method sets the map's tilt and heading to their default zero values. Calling this method may cause a smooth animation as the map pans and zooms to fit the bounds. Whether or not this method animates depends on an internal heuristic.
getBounds
getBounds()
Parameters: None
Return Value: LatLngBounds |undefined The lat/lng bounds of the current viewport.
Returns the lat/lng bounds of the current viewport. If more than one copy of the world is visible, the bounds range in longitude from -180 to 180 degrees inclusive. If the map is not yet initialized or center and zoom have not been set then the result is undefined . For vector maps with non-zero tilt or heading, the returned lat/lng bounds represents the smallest bounding box that includes the visible region of the map's viewport. See MapCanvasProjection.getVisibleRegion for getting the exact visible region of the map's viewport.
getCenter
getCenter()
Parameters: None
Return Value: LatLng |undefined
Returns the position displayed at the center of the map. Note that this LatLng object is not wrapped. See LatLng for more information. If the center or bounds have not been set then the result is undefined .
getClickableIcons
getClickableIcons()
Parameters: None
Return Value: boolean|undefined
Returns the clickability of the map icons. A map icon represents a point of interest, also known as a POI. If the returned value is true , then the icons are clickable on the map.
Beta getDatasetFeatureLayer
getDatasetFeatureLayer(datasetId)
Parameters:
  • datasetId : string
Return Value: FeatureLayer
Returns the FeatureLayer for the specified datasetId . Dataset IDs must be configured in the Google Cloud Console. If the dataset ID is not associated with the map's map style, or if Data-driven styling is not available (no map ID, no vector tiles, no Data-Driven Styling feature layers or Datasets configured in the Map Style), this logs an error, and the resulting FeatureLayer.isAvailable will be false.
getDiv
getDiv()
Parameters: None
Return Value: HTMLElement The mapDiv of the map.
getFeatureLayer
getFeatureLayer(featureType)
Parameters:
Return Value: FeatureLayer
Returns the FeatureLayer of the specific FeatureType . A FeatureLayer must be enabled in the Google Cloud Console. If a FeatureLayer of the specified FeatureType does not exist on this map, or if Data-driven styling is not available (no map ID, no vector tiles, and no FeatureLayer enabled in the map style), this logs an error, and the resulting FeatureLayer.isAvailable will be false.
getHeading
getHeading()
Parameters: None
Return Value: number|undefined
Returns the compass heading of the map. The heading value is measured in degrees (clockwise) from cardinal direction North. If the map is not yet initialized then the result is undefined .
getMapCapabilities
getMapCapabilities()
Parameters: None
Return Value: MapCapabilities
Informs the caller of the current capabilities available to the map based on the Map ID that was provided.
getMapTypeId
getMapTypeId()
Parameters: None
Return Value: MapTypeId |string|undefined
getProjection
getProjection()
Parameters: None
Return Value: Projection |undefined
Returns the current Projection . If the map is not yet initialized then the result is undefined . Listen to the projection_changed event and check its value to ensure it is not undefined .
getRenderingType
getRenderingType()
Parameters: None
Return Value: RenderingType
Returns the current RenderingType of the map.
getStreetView
getStreetView()
Parameters: None
Return Value: StreetViewPanorama The panorama bound to the map.
Returns the default StreetViewPanorama bound to the map, which may be a default panorama embedded within the map, or the panorama set using setStreetView() . Changes to the map's streetViewControl will be reflected in the display of such a bound panorama.
getTilt
getTilt()
Parameters: None
Return Value: number|undefined
Returns the current angle of incidence of the map, in degrees from the viewport plane to the map plane. For raster maps, the result will be 0 for imagery taken directly overhead or 45 for 45° imagery. This method does not return the value set by setTilt . See setTilt for details.
getZoom
getZoom()
Parameters: None
Return Value: number|undefined
Returns the zoom of the map. If the zoom has not been set then the result is undefined .
moveCamera
moveCamera(cameraOptions)
Parameters:
ارزش بازگشتی: ندارد
Immediately sets the map's camera to the target camera options, without animation.
panBy
panBy(x, y)
Parameters:
  • x : number Number of pixels to move the map in the x direction.
  • y : number Number of pixels to move the map in the y direction.
ارزش بازگشتی: ندارد
Changes the center of the map by the given distance in pixels. If the distance is less than both the width and height of the map, the transition will be smoothly animated. Note that the map coordinate system increases from west to east (for x values) and north to south (for y values).
panTo
panTo(latLng)
Parameters:
ارزش بازگشتی: ندارد
Changes the center of the map to the given LatLng . If the change is less than both the width and height of the map, the transition will be smoothly animated.
panToBounds
panToBounds(latLngBounds[, padding])
Parameters:
  • latLngBounds : LatLngBounds | LatLngBoundsLiteral The bounds to pan the map to.
  • padding : number| Padding optional Padding in pixels. A number value will yield the same padding on all 4 sides. The default value is 0.
ارزش بازگشتی: ندارد
Pans the map by the minimum amount necessary to contain the given LatLngBounds . It makes no guarantee where on the map the bounds will be, except that the map will be panned to show as much of the bounds as possible inside {currentMapSizeInPx} - {padding} . For both raster and vector maps, the map's zoom, tilt, and heading will not be changed.
setCenter
setCenter(latlng)
Parameters:
ارزش بازگشتی: ندارد
setClickableIcons
setClickableIcons(value)
Parameters:
  • value : boolean
ارزش بازگشتی: ندارد
Controls whether the map icons are clickable or not. A map icon represents a point of interest, also known as a POI. To disable the clickability of map icons, pass a value of false to this method.
setHeading
setHeading(heading)
Parameters:
  • heading : number
ارزش بازگشتی: ندارد
Sets the compass heading for map measured in degrees from cardinal direction North. For raster maps, this method only applies to aerial imagery.
setMapTypeId
setMapTypeId(mapTypeId)
Parameters:
ارزش بازگشتی: ندارد
setOptions
setOptions(options)
Parameters:
ارزش بازگشتی: ندارد
setStreetView
setStreetView(panorama)
Parameters:
ارزش بازگشتی: ندارد
Binds a StreetViewPanorama to the map. This panorama overrides the default StreetViewPanorama , allowing the map to bind to an external panorama outside of the map. Setting the panorama to null binds the default embedded panorama back to the map.
setTilt
setTilt(tilt)
Parameters:
  • tilt : number
ارزش بازگشتی: ندارد
For vector maps, sets the angle of incidence of the map. The allowed values are restricted depending on the zoom level of the map. For raster maps, controls the automatic switching behavior for the angle of incidence of the map. The only allowed values are 0 and 45 . setTilt(0) causes the map to always use a 0° overhead view regardless of the zoom level and viewport. setTilt(45) causes the tilt angle to automatically switch to 45 whenever 45° imagery is available for the current zoom level and viewport, and switch back to 0 whenever 45° imagery is not available (this is the default behavior). 45° imagery is only available for satellite and hybrid map types, within some locations, and at some zoom levels. Note: getTilt returns the current tilt angle, not the value set by setTilt . Because getTilt and setTilt refer to different things, do not bind() the tilt property; doing so may yield unpredictable effects.
setZoom
setZoom(zoom)
Parameters:
  • zoom : number Larger zoom values correspond to a higher resolution.
ارزش بازگشتی: ندارد
Sets the zoom of the map.
به ارث رسیده: addListener ، bindTo ، get ، notify ، set ، setValues ، unbind ، unbindAll
DEMO_MAP_ID Map ID which can be used for code samples which require a Map ID. This Map ID is not intended for use in production applications and cannot be used for features which require cloud configuration (such as Cloud Styling).
bounds_changed
function()
Arguments: None
This event is fired when the viewport bounds have changed.
center_changed
function()
Arguments: None
This event is fired when the map center property changes.
click
function(event)
استدلال ها:
This event is fired when the user clicks on the map. A MapMouseEvent with properties for the clicked location is returned unless a place icon was clicked, in which case an IconMouseEvent with a place ID is returned. IconMouseEvent and MapMouseEvent are identical, except that IconMouseEvent has the place ID field. The event can always be treated as an MapMouseEvent when the place ID is not important. The click event is not fired if a marker or info window was clicked.
contextmenu
function(event)
استدلال ها:
This event is fired when the DOM contextmenu event is fired on the map container.
dblclick
function(event)
استدلال ها:
This event is fired when the user double-clicks on the map. Note that the click event will sometimes fire once and sometimes twice, right before this one.
drag
function()
Arguments: None
This event is repeatedly fired while the user drags the map.
dragend
function()
Arguments: None
This event is fired when the user stops dragging the map.
dragstart
function()
Arguments: None
This event is fired when the user starts dragging the map.
heading_changed
function()
Arguments: None
This event is fired when the map heading property changes.
idle
function()
Arguments: None
This event is fired when the map becomes idle after panning or zooming.
isfractionalzoomenabled_changed
function()
Arguments: None
This event is fired when the isFractionalZoomEnabled property has changed.
mapcapabilities_changed
function()
Arguments: None
This event is fired when the map capabilities change.
maptypeid_changed
function()
Arguments: None
This event is fired when the mapTypeId property changes.
mousemove
function(event)
استدلال ها:
This event is fired whenever the user's mouse moves over the map container.
mouseout
function(event)
استدلال ها:
This event is fired when the user's mouse exits the map container.
mouseover
function(event)
استدلال ها:
This event is fired when the user's mouse enters the map container.
projection_changed
function()
Arguments: None
This event is fired when the projection has changed.
renderingtype_changed
function()
Arguments: None
This event is fired when the renderingType has changed.
tilesloaded
function()
Arguments: None
This event is fired when the visible tiles have finished loading.
tilt_changed
function()
Arguments: None
This event is fired when the map tilt property changes.
zoom_changed
function()
Arguments: None
This event is fired when the map zoom property changes.
rightclick
function(event)
استدلال ها:
This event is fired when the user right-clicks on the map.

MapOptions interface

google.maps . MapOptions interface

MapOptions object used to define the properties that can be set on a Map.

backgroundColor optional
نوع: string optional
Color used for the background of the Map div. This color will be visible when tiles have not yet loaded as the user pans. This option can only be set when the map is initialized.
center optional
نوع: LatLng | LatLngLiteral optional
The initial Map center.
clickableIcons optional
نوع: boolean optional
Default: true
When false , map icons are not clickable. A map icon represents a point of interest, also known as a POI.
controlSize optional
Type: number optional
Size in pixels of the controls appearing on the map. This value must be supplied directly when creating the Map, updating this value later may bring the controls into an undefined state. Only governs the controls made by the Maps API itself. Does not scale developer created custom controls.
disableDefaultUI optional
نوع: boolean optional
Enables/disables all default UI buttons. May be overridden individually. Does not disable the keyboard controls, which are separately controlled by the MapOptions.keyboardShortcuts option. Does not disable gesture controls, which are separately controlled by the MapOptions.gestureHandling option.
disableDoubleClickZoom optional
نوع: boolean optional
Enables/disables zoom and center on double click. Enabled by default.

Note : This property is not recommended . To disable zooming on double click, you can use the gestureHandling property, and set it to "none" .

draggable optional
نوع: boolean optional
If false , prevents the map from being dragged. Dragging is enabled by default.
draggableCursor optional
نوع: string optional
The name or url of the cursor to display when mousing over a draggable map. This property uses the css cursor attribute to change the icon. As with the css property, you must specify at least one fallback cursor that is not a URL. For example: draggableCursor: 'url( http://www.example.com/icon.png ), auto;' .
draggingCursor optional
نوع: string optional
The name or url of the cursor to display when the map is being dragged. This property uses the css cursor attribute to change the icon. As with the css property, you must specify at least one fallback cursor that is not a URL. For example: draggingCursor: 'url( http://www.example.com/icon.png ), auto;' .
fullscreenControl optional
نوع: boolean optional
The enabled/disabled state of the Fullscreen control.
fullscreenControlOptions optional
Type: FullscreenControlOptions optional
The display options for the Fullscreen control.
gestureHandling optional
نوع: string optional
This setting controls how the API handles gestures on the map. Allowed values:
  • "cooperative" : Scroll events and one-finger touch gestures scroll the page, and do not zoom or pan the map. Two-finger touch gestures pan and zoom the map. Scroll events with a ctrl key or ⌘ key pressed zoom the map.
    In this mode the map cooperates with the page.
  • "greedy" : All touch gestures and scroll events pan or zoom the map.
  • "none" : The map cannot be panned or zoomed by user gestures.
  • "auto" : (default) Gesture handling is either cooperative or greedy, depending on whether the page is scrollable or in an iframe.
heading optional
Type: number optional
The heading for aerial imagery in degrees measured clockwise from cardinal direction North. Headings are snapped to the nearest available angle for which imagery is available.
isFractionalZoomEnabled optional
نوع: boolean optional
Default: true for vector maps and false for raster maps
Whether the map should allow fractional zoom levels. Listen to isfractionalzoomenabled_changed to know when the default has been set.
keyboardShortcuts optional
نوع: boolean optional
If false , prevents the map from being controlled by the keyboard. Keyboard shortcuts are enabled by default.
mapId optional
نوع: string optional
The Map ID of the map. This parameter cannot be set or changed after a map is instantiated.
mapTypeControl optional
نوع: boolean optional
The initial enabled/disabled state of the Map type control.
mapTypeControlOptions optional
Type: MapTypeControlOptions optional
The initial display options for the Map type control.
mapTypeId optional
Type: MapTypeId |string optional
The initial Map mapTypeId. Defaults to ROADMAP .
maxZoom optional
Type: number optional
The maximum zoom level which will be displayed on the map. If omitted, or set to null , the maximum zoom from the current map type is used instead. Valid zoom values are numbers from zero up to the supported maximum zoom level .
minZoom optional
Type: number optional
The minimum zoom level which will be displayed on the map. If omitted, or set to null , the minimum zoom from the current map type is used instead. Valid zoom values are numbers from zero up to the supported maximum zoom level .
noClear optional
نوع: boolean optional
If true , do not clear the contents of the Map div.
panControl optional
نوع: boolean optional
The enabled/disabled state of the Pan control.

Note: The Pan control is not available in the new set of controls introduced in v3.22 of the Google Maps JavaScript API. While using v3.22 and v3.23, you can choose to use the earlier set of controls rather than the new controls, thus making the Pan control available as part of the old control set. See What's New in the v3.22 Map Controls .

panControlOptions optional
Type: PanControlOptions optional
The display options for the Pan control.

Note: The Pan control is not available in the new set of controls introduced in v3.22 of the Google Maps JavaScript API. While using v3.22 and v3.23, you can choose to use the earlier set of controls rather than the new controls, thus making the Pan control available as part of the old control set. See What's New in the v3.22 Map Controls .

restriction optional
Type: MapRestriction optional
Defines a boundary that restricts the area of the map accessible to users. When set, a user can only pan and zoom while the camera view stays inside the limits of the boundary.
rotateControl optional
نوع: boolean optional
The enabled/disabled state of the Rotate control.
rotateControlOptions optional
Type: RotateControlOptions optional
The display options for the Rotate control.
scaleControl optional
نوع: boolean optional
The initial enabled/disabled state of the Scale control.
scaleControlOptions optional
Type: ScaleControlOptions optional
The initial display options for the Scale control.
scrollwheel optional
نوع: boolean optional
If false , disables zooming on the map using a mouse scroll wheel. The scrollwheel is enabled by default.

Note : This property is not recommended . To disable zooming using scrollwheel, you can use the gestureHandling property, and set it to either "cooperative" or "none" .

streetView optional
Type: StreetViewPanorama optional
A StreetViewPanorama to display when the Street View pegman is dropped on the map. If no panorama is specified, a default StreetViewPanorama will be displayed in the map's div when the pegman is dropped.
streetViewControl optional
نوع: boolean optional
The initial enabled/disabled state of the Street View Pegman control. This control is part of the default UI, and should be set to false when displaying a map type on which the Street View road overlay should not appear (eg a non-Earth map type).
streetViewControlOptions optional
Type: StreetViewControlOptions optional
The initial display options for the Street View Pegman control.
styles optional
Type: Array < MapTypeStyle > optional
Styles to apply to each of the default map types. Note that for satellite / hybrid and terrain modes, these styles will only apply to labels and geometry.
tilt optional
Type: number optional
For vector maps, sets the angle of incidence of the map. The allowed values are restricted depending on the zoom level of the map. For raster maps, controls the automatic switching behavior for the angle of incidence of the map. The only allowed values are 0 and 45 . The value 0 causes the map to always use a 0° overhead view regardless of the zoom level and viewport. The value 45 causes the tilt angle to automatically switch to 45 whenever 45° imagery is available for the current zoom level and viewport, and switch back to 0 whenever 45° imagery is not available (this is the default behavior). 45° imagery is only available for satellite and hybrid map types, within some locations, and at some zoom levels. Note: getTilt returns the current tilt angle, not the value specified by this option. Because getTilt and this option refer to different things, do not bind() the tilt property; doing so may yield unpredictable effects.
zoom optional
Type: number optional
The initial Map zoom level. Valid zoom values are numbers from zero up to the supported maximum zoom level . Larger zoom values correspond to a higher resolution.
zoomControl optional
نوع: boolean optional
The enabled/disabled state of the Zoom control.
zoomControlOptions optional
Type: ZoomControlOptions optional
The display options for the Zoom control.

MapElement class

google.maps . MapElement class

MapElement is an HTMLElement subclass for rendering maps. After loading the maps library, a map can be created in HTML. مثلا:
<gmp-map center="37.4220656,-122.0840897" zoom="10" map-id="DEMO_MAP_ID"></gmp-map>

Internally, it uses Map , which can be accessed with the innerMap property.

Custom element:
<gmp-map center="lat,lng" map-id="string" zoom="number"></gmp-map>

This class extends HTMLElement .

This class implements MapElementOptions .

Access by calling const {MapElement} = await google.maps.importLibrary("maps") . کتابخانه ها را در Maps JavaScript API ببینید.

center
نوع: LatLng | LatLngLiteral optional
HTML attribute:
  • <gmp-map center="lat,lng"></gmp-map>
innerMap
Type: Map
A reference to the Map that the MapElement uses internally.
mapId
نوع: string optional
HTML attribute:
  • <gmp-map map-id="string"></gmp-map>
zoom
Type: number optional
HTML attribute:
  • <gmp-map zoom="number"></gmp-map>
Beta addEventListener
addEventListener(type, listener[, options])
Parameters:
  • type : string A case-sensitive string representing the event type to listen for.
  • listener : EventListener | EventListenerObject The object that receives a notification. This must be a function or an object with the handleEvent method
  • options : boolean| AddEventListenerOptions optional See options . Custom events only support capture and passive .
Return Value: void
Sets up a function that will be called whenever the specified event is delivered to the target. See addEventListener
Beta removeEventListener
removeEventListener(type, listener[, options])
Parameters:
Return Value: void
Removes an event listener previously registered with addEventListener from the target. See removeEventListener

MapElementOptions interface

google.maps . MapElementOptions interface

MapElementOptions object used to define the properties that can be set on a MapElement.

center optional
نوع: LatLng | LatLngLiteral optional
The initial Map center.
mapId optional
نوع: string optional
The Map ID of the map. This parameter cannot be set or changed after a map is instantiated.
zoom optional
Type: number optional
The initial Map zoom level. Valid zoom values are numbers from zero up to the supported maximum zoom level . Larger zoom values correspond to a higher resolution.

MapTypeStyle interface

google.maps . MapTypeStyle interface

The MapTypeStyle is a collection of selectors and stylers that define how the map should be styled. Selectors specify the map features and/or elements that should be affected, and stylers specify how those features and elements should be modified. For details, see the style reference .

stylers
Type: Array < Object >
The style rules to apply to the selected map features and elements. The rules are applied in the order that you specify in this array. For guidelines on usage and allowed values, see the style reference .
elementType optional
نوع: string optional
The element to which a styler should be applied. An element is a visual aspect of a feature on the map. Example: a label, an icon, the stroke or fill applied to the geometry, and more. اختیاری. If elementType is not specified, the value is assumed to be 'all' . For details of usage and allowed values, see the style reference .
featureType optional
نوع: string optional
The feature, or group of features, to which a styler should be applied. اختیاری. If featureType is not specified, the value is assumed to be 'all' . For details of usage and allowed values, see the style reference .

MapMouseEvent interface

google.maps . MapMouseEvent interface

This object is returned from various mouse events on the map and overlays, and contains all the fields shown below.

domEvent
The corresponding native DOM event. Developers should not rely on target , currentTarget , relatedTarget and path properties being defined and consistent. Developers should not also rely on the DOM structure of the internal implementation of the Maps API. Due to internal event mapping, the domEvent may have different semantics from the MapMouseEvent (eg a MapMouseEvent "click" may have a domEvent of type KeyboardEvent ).
latLng optional
Type: LatLng optional
The latitude/longitude that was below the cursor when the event occurred.
stop
stop()
Parameters: None
Return Value: void
Prevents this event from propagating further.

IconMouseEvent interface

google.maps . IconMouseEvent interface

This object is sent in an event when a user clicks on an icon on the map. The place ID of this place is stored in the placeId member. To prevent the default info window from showing up, call the stop() method on this event to prevent it being propagated. Learn more about place IDs in the Places API developer guide.

This interface extends MapMouseEvent .

placeId optional
نوع: string optional
The place ID of the place that was clicked. This place ID can be used to query more information about the feature that was clicked.

Learn more about place IDs in the Places API developer guide.

Inherited: domEvent , latLng
Inherited: stop

MapTypeId constants

google.maps . MapTypeId constants

Identifiers for common MapTypes. Specify these by value, or by using the constant's name. For example, 'satellite' or google.maps.MapTypeId.SATELLITE .

Access by calling const {MapTypeId} = await google.maps.importLibrary("maps") . کتابخانه ها را در Maps JavaScript API ببینید.

HYBRID This map type displays a transparent layer of major streets on satellite images.
ROADMAP This map type displays a normal street map.
SATELLITE This map type displays satellite images.
TERRAIN This map type displays maps with physical features such as terrain and vegetation.

MapTypeRegistry class

google.maps . MapTypeRegistry class

A registry for MapType instances, keyed by MapType id.

این کلاس MVCObject را گسترش می دهد.

Access by calling const {MapTypeRegistry} = await google.maps.importLibrary("maps") . کتابخانه ها را در Maps JavaScript API ببینید.

MapTypeRegistry
MapTypeRegistry()
Parameters: None
The MapTypeRegistry holds the collection of custom map types available to the map for its use. The API consults this registry when providing the list of available map types within controls, for example.
set
set(id, mapType)
Parameters:
  • id : string Identifier of the MapType to add to the registry.
  • mapType : MapType |* MapType object to add to the registry.
ارزش بازگشتی: ندارد
Sets the registry to associate the passed string identifier with the passed MapType.
Inherited: addListener , bindTo , get , notify , setValues , unbind , unbindAll

MapRestriction interface

google.maps . MapRestriction interface

A restriction that can be applied to the Map. The map's viewport will not exceed these restrictions.

latLngBounds
When set, a user can only pan and zoom inside the given bounds. Bounds can restrict both longitude and latitude, or can restrict latitude only. For latitude-only bounds use west and east longitudes of -180 and 180, respectively, for example, latLngBounds: {north: northLat, south: southLat, west: -180, east: 180} .
strictBounds optional
نوع: boolean optional
Bounds can be made more restrictive by setting the strictBounds flag to true . This reduces how far a user can zoom out, ensuring that everything outside of the restricted bounds stays hidden. The default is false , meaning that a user can zoom out until the entire bounded area is in view, possibly including areas outside the bounded area.

TrafficLayer class

google.maps . TrafficLayer class

A traffic layer.

این کلاس MVCObject را گسترش می دهد.

Access by calling const {TrafficLayer} = await google.maps.importLibrary("maps") . کتابخانه ها را در Maps JavaScript API ببینید.

TrafficLayer
TrafficLayer([opts])
Parameters:
A layer that displays current road traffic.
getMap
getMap()
Parameters: None
Return Value: Map
Returns the map on which this layer is displayed.
setMap
setMap(map)
Parameters:
ارزش بازگشتی: ندارد
Renders the layer on the specified map. If map is set to null , the layer will be removed.
setOptions
setOptions(options)
Parameters:
ارزش بازگشتی: ندارد
به ارث رسیده: addListener ، bindTo ، get ، notify ، set ، setValues ، unbind ، unbindAll

TrafficLayerOptions interface

google.maps . TrafficLayerOptions interface

TrafficLayerOptions object used to define the properties that can be set on a TrafficLayer.

autoRefresh optional
نوع: boolean optional
Default: true
Whether the traffic layer refreshes with updated information automatically.
map optional
Type: Map optional
Map on which to display the traffic layer.

TransitLayer class

google.maps . TransitLayer class

A transit layer.

این کلاس MVCObject را گسترش می دهد.

Access by calling const {TransitLayer} = await google.maps.importLibrary("maps") . کتابخانه ها را در Maps JavaScript API ببینید.

TransitLayer
TransitLayer()
Parameters: None
A layer that displays transit lines.
getMap
getMap()
Parameters: None
Return Value: Map
Returns the map on which this layer is displayed.
setMap
setMap(map)
Parameters:
ارزش بازگشتی: ندارد
Renders the layer on the specified map. If map is set to null , the layer will be removed.
به ارث رسیده: addListener ، bindTo ، get ، notify ، set ، setValues ، unbind ، unbindAll

BicyclingLayer class

google.maps . BicyclingLayer class

A layer showing bike lanes and paths.

این کلاس MVCObject را گسترش می دهد.

Access by calling const {BicyclingLayer} = await google.maps.importLibrary("maps") . کتابخانه ها را در Maps JavaScript API ببینید.

BicyclingLayer
BicyclingLayer()
Parameters: None
A layer that displays bike lanes and paths and demotes large roads.
getMap
getMap()
Parameters: None
Return Value: Map
Returns the map on which this layer is displayed.
setMap
setMap(map)
Parameters:
ارزش بازگشتی: ندارد
Renders the layer on the specified map. If map is set to null , the layer will be removed.
به ارث رسیده: addListener ، bindTo ، get ، notify ، set ، setValues ، unbind ، unbindAll

CameraOptions interface

google.maps . CameraOptions interface

Used for setting the map's camera options.

center optional
Type: LatLngLiteral | LatLng optional
heading optional
Type: number optional
tilt optional
Type: number optional
zoom optional
Type: number optional

VisibleRegion interface

google.maps . VisibleRegion interface

Contains the four points defining the four-sided polygon that is the visible region of the map. On a vector map this polygon can be a trapezoid instead of a rectangle, when a vector map has tilt.

farLeft
Type: LatLng
farRight
Type: LatLng
latLngBounds
The smallest bounding box that includes the visible region.
nearLeft
Type: LatLng
nearRight
Type: LatLng

RenderingType constants

google.maps . RenderingType constants

Access by calling const {RenderingType} = await google.maps.importLibrary("maps") . کتابخانه ها را در Maps JavaScript API ببینید.

RASTER Indicates that the map is a raster map.
UNINITIALIZED Indicates that it is unknown yet whether the map is vector or raster, because the map has not finished initializing yet.
VECTOR Indicates that the map is a vector map.

MapCapabilities interface

google.maps . MapCapabilities interface

Object containing a snapshot of what capabilities are currently available for the Map. Note that this does not necessarily mean that relevant modules are loaded or initialized, but rather that the current map has permission to use these APIs. See the properties for a list of possible capabilities.

isAdvancedMarkersAvailable optional
نوع: boolean optional
If true, this map is configured properly to allow for the use of advanced markers. Note that you must still import the marker library in order to use advanced markers. See https://goo.gle/gmp-isAdvancedMarkersAvailable for more information.
isDataDrivenStylingAvailable optional
نوع: boolean optional
If true, this map is configured properly to allow for the use of data-driven styling for at least one FeatureLayer. See https://goo.gle/gmp-data-driven-styling and https://goo.gle/gmp-FeatureLayerIsAvailable for more information.
،

Map class

google.maps . Map class

این کلاس MVCObject را گسترش می دهد.

Access by calling const {Map} = await google.maps.importLibrary("maps") . کتابخانه ها را در Maps JavaScript API ببینید.

Map
Map(mapDiv[, opts])
Parameters:
Creates a new map inside of the given HTML container, which is typically a DIV element.
controls
Type: Array < MVCArray < HTMLElement >>
Additional controls to attach to the map. To add a control to the map, add the control's <div> to the MVCArray corresponding to the ControlPosition where it should be rendered.
data
Type: Data
An instance of Data , bound to the map. Add features to this Data object to conveniently display them on this map.
mapTypes
A registry of MapType instances by string ID.
overlayMapTypes
Type: MVCArray < MapType optional >
Additional map types to overlay. Overlay map types will display on top of the base map they are attached to, in the order in which they appear in the overlayMapTypes array (overlays with higher index values are displayed in front of overlays with lower index values).
fitBounds
fitBounds(bounds[, padding])
Parameters:
  • bounds : LatLngBounds | LatLngBoundsLiteral Bounds to show.
  • padding : number| Padding optional Padding in pixels. The bounds will be fit in the part of the map that remains after padding is removed. A number value will yield the same padding on all 4 sides. Supply 0 here to make a fitBounds idempotent on the result of getBounds.
ارزش بازگشتی: ندارد
Sets the viewport to contain the given bounds.
Note: When the map is set to display: none , the fitBounds function reads the map's size as 0x0, and therefore does not do anything. To change the viewport while the map is hidden, set the map to visibility: hidden , thereby ensuring the map div has an actual size. For vector maps, this method sets the map's tilt and heading to their default zero values. Calling this method may cause a smooth animation as the map pans and zooms to fit the bounds. Whether or not this method animates depends on an internal heuristic.
getBounds
getBounds()
Parameters: None
Return Value: LatLngBounds |undefined The lat/lng bounds of the current viewport.
Returns the lat/lng bounds of the current viewport. If more than one copy of the world is visible, the bounds range in longitude from -180 to 180 degrees inclusive. If the map is not yet initialized or center and zoom have not been set then the result is undefined . For vector maps with non-zero tilt or heading, the returned lat/lng bounds represents the smallest bounding box that includes the visible region of the map's viewport. See MapCanvasProjection.getVisibleRegion for getting the exact visible region of the map's viewport.
getCenter
getCenter()
Parameters: None
Return Value: LatLng |undefined
Returns the position displayed at the center of the map. Note that this LatLng object is not wrapped. See LatLng for more information. If the center or bounds have not been set then the result is undefined .
getClickableIcons
getClickableIcons()
Parameters: None
Return Value: boolean|undefined
Returns the clickability of the map icons. A map icon represents a point of interest, also known as a POI. If the returned value is true , then the icons are clickable on the map.
Beta getDatasetFeatureLayer
getDatasetFeatureLayer(datasetId)
Parameters:
  • datasetId : string
Return Value: FeatureLayer
Returns the FeatureLayer for the specified datasetId . Dataset IDs must be configured in the Google Cloud Console. If the dataset ID is not associated with the map's map style, or if Data-driven styling is not available (no map ID, no vector tiles, no Data-Driven Styling feature layers or Datasets configured in the Map Style), this logs an error, and the resulting FeatureLayer.isAvailable will be false.
getDiv
getDiv()
Parameters: None
Return Value: HTMLElement The mapDiv of the map.
getFeatureLayer
getFeatureLayer(featureType)
Parameters:
Return Value: FeatureLayer
Returns the FeatureLayer of the specific FeatureType . A FeatureLayer must be enabled in the Google Cloud Console. If a FeatureLayer of the specified FeatureType does not exist on this map, or if Data-driven styling is not available (no map ID, no vector tiles, and no FeatureLayer enabled in the map style), this logs an error, and the resulting FeatureLayer.isAvailable will be false.
getHeading
getHeading()
Parameters: None
Return Value: number|undefined
Returns the compass heading of the map. The heading value is measured in degrees (clockwise) from cardinal direction North. If the map is not yet initialized then the result is undefined .
getMapCapabilities
getMapCapabilities()
Parameters: None
Return Value: MapCapabilities
Informs the caller of the current capabilities available to the map based on the Map ID that was provided.
getMapTypeId
getMapTypeId()
Parameters: None
Return Value: MapTypeId |string|undefined
getProjection
getProjection()
Parameters: None
Return Value: Projection |undefined
Returns the current Projection . If the map is not yet initialized then the result is undefined . Listen to the projection_changed event and check its value to ensure it is not undefined .
getRenderingType
getRenderingType()
Parameters: None
Return Value: RenderingType
Returns the current RenderingType of the map.
getStreetView
getStreetView()
Parameters: None
Return Value: StreetViewPanorama The panorama bound to the map.
Returns the default StreetViewPanorama bound to the map, which may be a default panorama embedded within the map, or the panorama set using setStreetView() . Changes to the map's streetViewControl will be reflected in the display of such a bound panorama.
getTilt
getTilt()
Parameters: None
Return Value: number|undefined
Returns the current angle of incidence of the map, in degrees from the viewport plane to the map plane. For raster maps, the result will be 0 for imagery taken directly overhead or 45 for 45° imagery. This method does not return the value set by setTilt . See setTilt for details.
getZoom
getZoom()
Parameters: None
Return Value: number|undefined
Returns the zoom of the map. If the zoom has not been set then the result is undefined .
moveCamera
moveCamera(cameraOptions)
Parameters:
ارزش بازگشتی: ندارد
Immediately sets the map's camera to the target camera options, without animation.
panBy
panBy(x, y)
Parameters:
  • x : number Number of pixels to move the map in the x direction.
  • y : number Number of pixels to move the map in the y direction.
ارزش بازگشتی: ندارد
Changes the center of the map by the given distance in pixels. If the distance is less than both the width and height of the map, the transition will be smoothly animated. Note that the map coordinate system increases from west to east (for x values) and north to south (for y values).
panTo
panTo(latLng)
Parameters:
ارزش بازگشتی: ندارد
Changes the center of the map to the given LatLng . If the change is less than both the width and height of the map, the transition will be smoothly animated.
panToBounds
panToBounds(latLngBounds[, padding])
Parameters:
  • latLngBounds : LatLngBounds | LatLngBoundsLiteral The bounds to pan the map to.
  • padding : number| Padding optional Padding in pixels. A number value will yield the same padding on all 4 sides. The default value is 0.
ارزش بازگشتی: ندارد
Pans the map by the minimum amount necessary to contain the given LatLngBounds . It makes no guarantee where on the map the bounds will be, except that the map will be panned to show as much of the bounds as possible inside {currentMapSizeInPx} - {padding} . For both raster and vector maps, the map's zoom, tilt, and heading will not be changed.
setCenter
setCenter(latlng)
Parameters:
ارزش بازگشتی: ندارد
setClickableIcons
setClickableIcons(value)
Parameters:
  • value : boolean
ارزش بازگشتی: ندارد
Controls whether the map icons are clickable or not. A map icon represents a point of interest, also known as a POI. To disable the clickability of map icons, pass a value of false to this method.
setHeading
setHeading(heading)
Parameters:
  • heading : number
ارزش بازگشتی: ندارد
Sets the compass heading for map measured in degrees from cardinal direction North. For raster maps, this method only applies to aerial imagery.
setMapTypeId
setMapTypeId(mapTypeId)
Parameters:
ارزش بازگشتی: ندارد
setOptions
setOptions(options)
Parameters:
ارزش بازگشتی: ندارد
setStreetView
setStreetView(panorama)
Parameters:
ارزش بازگشتی: ندارد
Binds a StreetViewPanorama to the map. This panorama overrides the default StreetViewPanorama , allowing the map to bind to an external panorama outside of the map. Setting the panorama to null binds the default embedded panorama back to the map.
setTilt
setTilt(tilt)
Parameters:
  • tilt : number
ارزش بازگشتی: ندارد
For vector maps, sets the angle of incidence of the map. The allowed values are restricted depending on the zoom level of the map. For raster maps, controls the automatic switching behavior for the angle of incidence of the map. The only allowed values are 0 and 45 . setTilt(0) causes the map to always use a 0° overhead view regardless of the zoom level and viewport. setTilt(45) causes the tilt angle to automatically switch to 45 whenever 45° imagery is available for the current zoom level and viewport, and switch back to 0 whenever 45° imagery is not available (this is the default behavior). 45° imagery is only available for satellite and hybrid map types, within some locations, and at some zoom levels. Note: getTilt returns the current tilt angle, not the value set by setTilt . Because getTilt and setTilt refer to different things, do not bind() the tilt property; doing so may yield unpredictable effects.
setZoom
setZoom(zoom)
Parameters:
  • zoom : number Larger zoom values correspond to a higher resolution.
ارزش بازگشتی: ندارد
Sets the zoom of the map.
به ارث رسیده: addListener ، bindTo ، get ، notify ، set ، setValues ، unbind ، unbindAll
DEMO_MAP_ID Map ID which can be used for code samples which require a Map ID. This Map ID is not intended for use in production applications and cannot be used for features which require cloud configuration (such as Cloud Styling).
bounds_changed
function()
Arguments: None
This event is fired when the viewport bounds have changed.
center_changed
function()
Arguments: None
This event is fired when the map center property changes.
click
function(event)
استدلال ها:
This event is fired when the user clicks on the map. A MapMouseEvent with properties for the clicked location is returned unless a place icon was clicked, in which case an IconMouseEvent with a place ID is returned. IconMouseEvent and MapMouseEvent are identical, except that IconMouseEvent has the place ID field. The event can always be treated as an MapMouseEvent when the place ID is not important. The click event is not fired if a marker or info window was clicked.
contextmenu
function(event)
استدلال ها:
This event is fired when the DOM contextmenu event is fired on the map container.
dblclick
function(event)
استدلال ها:
This event is fired when the user double-clicks on the map. Note that the click event will sometimes fire once and sometimes twice, right before this one.
drag
function()
Arguments: None
This event is repeatedly fired while the user drags the map.
dragend
function()
Arguments: None
This event is fired when the user stops dragging the map.
dragstart
function()
Arguments: None
This event is fired when the user starts dragging the map.
heading_changed
function()
Arguments: None
This event is fired when the map heading property changes.
idle
function()
Arguments: None
This event is fired when the map becomes idle after panning or zooming.
isfractionalzoomenabled_changed
function()
Arguments: None
This event is fired when the isFractionalZoomEnabled property has changed.
mapcapabilities_changed
function()
Arguments: None
This event is fired when the map capabilities change.
maptypeid_changed
function()
Arguments: None
This event is fired when the mapTypeId property changes.
mousemove
function(event)
استدلال ها:
This event is fired whenever the user's mouse moves over the map container.
mouseout
function(event)
استدلال ها:
This event is fired when the user's mouse exits the map container.
mouseover
function(event)
استدلال ها:
This event is fired when the user's mouse enters the map container.
projection_changed
function()
Arguments: None
This event is fired when the projection has changed.
renderingtype_changed
function()
Arguments: None
This event is fired when the renderingType has changed.
tilesloaded
function()
Arguments: None
This event is fired when the visible tiles have finished loading.
tilt_changed
function()
Arguments: None
This event is fired when the map tilt property changes.
zoom_changed
function()
Arguments: None
This event is fired when the map zoom property changes.
rightclick
function(event)
استدلال ها:
This event is fired when the user right-clicks on the map.

MapOptions interface

google.maps . MapOptions interface

MapOptions object used to define the properties that can be set on a Map.

backgroundColor optional
نوع: string optional
Color used for the background of the Map div. This color will be visible when tiles have not yet loaded as the user pans. This option can only be set when the map is initialized.
center optional
نوع: LatLng | LatLngLiteral optional
The initial Map center.
clickableIcons optional
نوع: boolean optional
Default: true
When false , map icons are not clickable. A map icon represents a point of interest, also known as a POI.
controlSize optional
Type: number optional
Size in pixels of the controls appearing on the map. This value must be supplied directly when creating the Map, updating this value later may bring the controls into an undefined state. Only governs the controls made by the Maps API itself. Does not scale developer created custom controls.
disableDefaultUI optional
نوع: boolean optional
Enables/disables all default UI buttons. May be overridden individually. Does not disable the keyboard controls, which are separately controlled by the MapOptions.keyboardShortcuts option. Does not disable gesture controls, which are separately controlled by the MapOptions.gestureHandling option.
disableDoubleClickZoom optional
نوع: boolean optional
Enables/disables zoom and center on double click. Enabled by default.

Note : This property is not recommended . To disable zooming on double click, you can use the gestureHandling property, and set it to "none" .

draggable optional
نوع: boolean optional
If false , prevents the map from being dragged. Dragging is enabled by default.
draggableCursor optional
نوع: string optional
The name or url of the cursor to display when mousing over a draggable map. This property uses the css cursor attribute to change the icon. As with the css property, you must specify at least one fallback cursor that is not a URL. For example: draggableCursor: 'url( http://www.example.com/icon.png ), auto;' .
draggingCursor optional
نوع: string optional
The name or url of the cursor to display when the map is being dragged. This property uses the css cursor attribute to change the icon. As with the css property, you must specify at least one fallback cursor that is not a URL. For example: draggingCursor: 'url( http://www.example.com/icon.png ), auto;' .
fullscreenControl optional
نوع: boolean optional
The enabled/disabled state of the Fullscreen control.
fullscreenControlOptions optional
Type: FullscreenControlOptions optional
The display options for the Fullscreen control.
gestureHandling optional
نوع: string optional
This setting controls how the API handles gestures on the map. Allowed values:
  • "cooperative" : Scroll events and one-finger touch gestures scroll the page, and do not zoom or pan the map. Two-finger touch gestures pan and zoom the map. Scroll events with a ctrl key or ⌘ key pressed zoom the map.
    In this mode the map cooperates with the page.
  • "greedy" : All touch gestures and scroll events pan or zoom the map.
  • "none" : The map cannot be panned or zoomed by user gestures.
  • "auto" : (default) Gesture handling is either cooperative or greedy, depending on whether the page is scrollable or in an iframe.
heading optional
Type: number optional
The heading for aerial imagery in degrees measured clockwise from cardinal direction North. Headings are snapped to the nearest available angle for which imagery is available.
isFractionalZoomEnabled optional
نوع: boolean optional
Default: true for vector maps and false for raster maps
Whether the map should allow fractional zoom levels. Listen to isfractionalzoomenabled_changed to know when the default has been set.
keyboardShortcuts optional
نوع: boolean optional
If false , prevents the map from being controlled by the keyboard. Keyboard shortcuts are enabled by default.
mapId optional
نوع: string optional
The Map ID of the map. This parameter cannot be set or changed after a map is instantiated.
mapTypeControl optional
نوع: boolean optional
The initial enabled/disabled state of the Map type control.
mapTypeControlOptions optional
Type: MapTypeControlOptions optional
The initial display options for the Map type control.
mapTypeId optional
Type: MapTypeId |string optional
The initial Map mapTypeId. Defaults to ROADMAP .
maxZoom optional
Type: number optional
The maximum zoom level which will be displayed on the map. If omitted, or set to null , the maximum zoom from the current map type is used instead. Valid zoom values are numbers from zero up to the supported maximum zoom level .
minZoom optional
Type: number optional
The minimum zoom level which will be displayed on the map. If omitted, or set to null , the minimum zoom from the current map type is used instead. Valid zoom values are numbers from zero up to the supported maximum zoom level .
noClear optional
نوع: boolean optional
If true , do not clear the contents of the Map div.
panControl optional
نوع: boolean optional
The enabled/disabled state of the Pan control.

Note: The Pan control is not available in the new set of controls introduced in v3.22 of the Google Maps JavaScript API. While using v3.22 and v3.23, you can choose to use the earlier set of controls rather than the new controls, thus making the Pan control available as part of the old control set. See What's New in the v3.22 Map Controls .

panControlOptions optional
Type: PanControlOptions optional
The display options for the Pan control.

Note: The Pan control is not available in the new set of controls introduced in v3.22 of the Google Maps JavaScript API. While using v3.22 and v3.23, you can choose to use the earlier set of controls rather than the new controls, thus making the Pan control available as part of the old control set. See What's New in the v3.22 Map Controls .

restriction optional
Type: MapRestriction optional
Defines a boundary that restricts the area of the map accessible to users. When set, a user can only pan and zoom while the camera view stays inside the limits of the boundary.
rotateControl optional
نوع: boolean optional
The enabled/disabled state of the Rotate control.
rotateControlOptions optional
Type: RotateControlOptions optional
The display options for the Rotate control.
scaleControl optional
نوع: boolean optional
The initial enabled/disabled state of the Scale control.
scaleControlOptions optional
Type: ScaleControlOptions optional
The initial display options for the Scale control.
scrollwheel optional
نوع: boolean optional
If false , disables zooming on the map using a mouse scroll wheel. The scrollwheel is enabled by default.

Note : This property is not recommended . To disable zooming using scrollwheel, you can use the gestureHandling property, and set it to either "cooperative" or "none" .

streetView optional
Type: StreetViewPanorama optional
A StreetViewPanorama to display when the Street View pegman is dropped on the map. If no panorama is specified, a default StreetViewPanorama will be displayed in the map's div when the pegman is dropped.
streetViewControl optional
نوع: boolean optional
The initial enabled/disabled state of the Street View Pegman control. This control is part of the default UI, and should be set to false when displaying a map type on which the Street View road overlay should not appear (eg a non-Earth map type).
streetViewControlOptions optional
Type: StreetViewControlOptions optional
The initial display options for the Street View Pegman control.
styles optional
Type: Array < MapTypeStyle > optional
Styles to apply to each of the default map types. Note that for satellite / hybrid and terrain modes, these styles will only apply to labels and geometry.
tilt optional
Type: number optional
For vector maps, sets the angle of incidence of the map. The allowed values are restricted depending on the zoom level of the map. For raster maps, controls the automatic switching behavior for the angle of incidence of the map. The only allowed values are 0 and 45 . The value 0 causes the map to always use a 0° overhead view regardless of the zoom level and viewport. The value 45 causes the tilt angle to automatically switch to 45 whenever 45° imagery is available for the current zoom level and viewport, and switch back to 0 whenever 45° imagery is not available (this is the default behavior). 45° imagery is only available for satellite and hybrid map types, within some locations, and at some zoom levels. Note: getTilt returns the current tilt angle, not the value specified by this option. Because getTilt and this option refer to different things, do not bind() the tilt property; doing so may yield unpredictable effects.
zoom optional
Type: number optional
The initial Map zoom level. Valid zoom values are numbers from zero up to the supported maximum zoom level . Larger zoom values correspond to a higher resolution.
zoomControl optional
نوع: boolean optional
The enabled/disabled state of the Zoom control.
zoomControlOptions optional
Type: ZoomControlOptions optional
The display options for the Zoom control.

MapElement class

google.maps . MapElement class

MapElement is an HTMLElement subclass for rendering maps. After loading the maps library, a map can be created in HTML. مثلا:
<gmp-map center="37.4220656,-122.0840897" zoom="10" map-id="DEMO_MAP_ID"></gmp-map>

Internally, it uses Map , which can be accessed with the innerMap property.

Custom element:
<gmp-map center="lat,lng" map-id="string" zoom="number"></gmp-map>

This class extends HTMLElement .

This class implements MapElementOptions .

Access by calling const {MapElement} = await google.maps.importLibrary("maps") . کتابخانه ها را در Maps JavaScript API ببینید.

center
نوع: LatLng | LatLngLiteral optional
HTML attribute:
  • <gmp-map center="lat,lng"></gmp-map>
innerMap
Type: Map
A reference to the Map that the MapElement uses internally.
mapId
نوع: string optional
HTML attribute:
  • <gmp-map map-id="string"></gmp-map>
zoom
Type: number optional
HTML attribute:
  • <gmp-map zoom="number"></gmp-map>
Beta addEventListener
addEventListener(type, listener[, options])
Parameters:
  • type : string A case-sensitive string representing the event type to listen for.
  • listener : EventListener | EventListenerObject The object that receives a notification. This must be a function or an object with the handleEvent method
  • options : boolean| AddEventListenerOptions optional See options . Custom events only support capture and passive .
Return Value: void
Sets up a function that will be called whenever the specified event is delivered to the target. See addEventListener
Beta removeEventListener
removeEventListener(type, listener[, options])
Parameters:
Return Value: void
Removes an event listener previously registered with addEventListener from the target. See removeEventListener

MapElementOptions interface

google.maps . MapElementOptions interface

MapElementOptions object used to define the properties that can be set on a MapElement.

center optional
نوع: LatLng | LatLngLiteral optional
The initial Map center.
mapId optional
نوع: string optional
The Map ID of the map. This parameter cannot be set or changed after a map is instantiated.
zoom optional
Type: number optional
The initial Map zoom level. Valid zoom values are numbers from zero up to the supported maximum zoom level . Larger zoom values correspond to a higher resolution.

MapTypeStyle interface

google.maps . MapTypeStyle interface

The MapTypeStyle is a collection of selectors and stylers that define how the map should be styled. Selectors specify the map features and/or elements that should be affected, and stylers specify how those features and elements should be modified. For details, see the style reference .

stylers
Type: Array < Object >
The style rules to apply to the selected map features and elements. The rules are applied in the order that you specify in this array. For guidelines on usage and allowed values, see the style reference .
elementType optional
نوع: string optional
The element to which a styler should be applied. An element is a visual aspect of a feature on the map. Example: a label, an icon, the stroke or fill applied to the geometry, and more. اختیاری. If elementType is not specified, the value is assumed to be 'all' . For details of usage and allowed values, see the style reference .
featureType optional
نوع: string optional
The feature, or group of features, to which a styler should be applied. اختیاری. If featureType is not specified, the value is assumed to be 'all' . For details of usage and allowed values, see the style reference .

MapMouseEvent interface

google.maps . MapMouseEvent interface

This object is returned from various mouse events on the map and overlays, and contains all the fields shown below.

domEvent
The corresponding native DOM event. Developers should not rely on target , currentTarget , relatedTarget and path properties being defined and consistent. Developers should not also rely on the DOM structure of the internal implementation of the Maps API. Due to internal event mapping, the domEvent may have different semantics from the MapMouseEvent (eg a MapMouseEvent "click" may have a domEvent of type KeyboardEvent ).
latLng optional
Type: LatLng optional
The latitude/longitude that was below the cursor when the event occurred.
stop
stop()
Parameters: None
Return Value: void
Prevents this event from propagating further.

IconMouseEvent interface

google.maps . IconMouseEvent interface

This object is sent in an event when a user clicks on an icon on the map. The place ID of this place is stored in the placeId member. To prevent the default info window from showing up, call the stop() method on this event to prevent it being propagated. Learn more about place IDs in the Places API developer guide.

This interface extends MapMouseEvent .

placeId optional
نوع: string optional
The place ID of the place that was clicked. This place ID can be used to query more information about the feature that was clicked.

Learn more about place IDs in the Places API developer guide.

Inherited: domEvent , latLng
Inherited: stop

MapTypeId constants

google.maps . MapTypeId constants

Identifiers for common MapTypes. Specify these by value, or by using the constant's name. For example, 'satellite' or google.maps.MapTypeId.SATELLITE .

Access by calling const {MapTypeId} = await google.maps.importLibrary("maps") . کتابخانه ها را در Maps JavaScript API ببینید.

HYBRID This map type displays a transparent layer of major streets on satellite images.
ROADMAP This map type displays a normal street map.
SATELLITE This map type displays satellite images.
TERRAIN This map type displays maps with physical features such as terrain and vegetation.

MapTypeRegistry class

google.maps . MapTypeRegistry class

A registry for MapType instances, keyed by MapType id.

این کلاس MVCObject را گسترش می دهد.

Access by calling const {MapTypeRegistry} = await google.maps.importLibrary("maps") . کتابخانه ها را در Maps JavaScript API ببینید.

MapTypeRegistry
MapTypeRegistry()
Parameters: None
The MapTypeRegistry holds the collection of custom map types available to the map for its use. The API consults this registry when providing the list of available map types within controls, for example.
set
set(id, mapType)
Parameters:
  • id : string Identifier of the MapType to add to the registry.
  • mapType : MapType |* MapType object to add to the registry.
ارزش بازگشتی: ندارد
Sets the registry to associate the passed string identifier with the passed MapType.
Inherited: addListener , bindTo , get , notify , setValues , unbind , unbindAll

MapRestriction interface

google.maps . MapRestriction interface

A restriction that can be applied to the Map. The map's viewport will not exceed these restrictions.

latLngBounds
When set, a user can only pan and zoom inside the given bounds. Bounds can restrict both longitude and latitude, or can restrict latitude only. For latitude-only bounds use west and east longitudes of -180 and 180, respectively, for example, latLngBounds: {north: northLat, south: southLat, west: -180, east: 180} .
strictBounds optional
نوع: boolean optional
Bounds can be made more restrictive by setting the strictBounds flag to true . This reduces how far a user can zoom out, ensuring that everything outside of the restricted bounds stays hidden. The default is false , meaning that a user can zoom out until the entire bounded area is in view, possibly including areas outside the bounded area.

TrafficLayer class

google.maps . TrafficLayer class

A traffic layer.

این کلاس MVCObject را گسترش می دهد.

Access by calling const {TrafficLayer} = await google.maps.importLibrary("maps") . کتابخانه ها را در Maps JavaScript API ببینید.

TrafficLayer
TrafficLayer([opts])
Parameters:
A layer that displays current road traffic.
getMap
getMap()
Parameters: None
Return Value: Map
Returns the map on which this layer is displayed.
setMap
setMap(map)
Parameters:
ارزش بازگشتی: ندارد
Renders the layer on the specified map. If map is set to null , the layer will be removed.
setOptions
setOptions(options)
Parameters:
ارزش بازگشتی: ندارد
به ارث رسیده: addListener ، bindTo ، get ، notify ، set ، setValues ، unbind ، unbindAll

TrafficLayerOptions interface

google.maps . TrafficLayerOptions interface

TrafficLayerOptions object used to define the properties that can be set on a TrafficLayer.

autoRefresh optional
نوع: boolean optional
Default: true
Whether the traffic layer refreshes with updated information automatically.
map optional
Type: Map optional
Map on which to display the traffic layer.

TransitLayer class

google.maps . TransitLayer class

A transit layer.

این کلاس MVCObject را گسترش می دهد.

Access by calling const {TransitLayer} = await google.maps.importLibrary("maps") . کتابخانه ها را در Maps JavaScript API ببینید.

TransitLayer
TransitLayer()
Parameters: None
A layer that displays transit lines.
getMap
getMap()
Parameters: None
Return Value: Map
Returns the map on which this layer is displayed.
setMap
setMap(map)
Parameters:
ارزش بازگشتی: ندارد
Renders the layer on the specified map. If map is set to null , the layer will be removed.
به ارث رسیده: addListener ، bindTo ، get ، notify ، set ، setValues ، unbind ، unbindAll

BicyclingLayer class

google.maps . BicyclingLayer class

A layer showing bike lanes and paths.

این کلاس MVCObject را گسترش می دهد.

Access by calling const {BicyclingLayer} = await google.maps.importLibrary("maps") . کتابخانه ها را در Maps JavaScript API ببینید.

BicyclingLayer
BicyclingLayer()
Parameters: None
A layer that displays bike lanes and paths and demotes large roads.
getMap
getMap()
Parameters: None
Return Value: Map
Returns the map on which this layer is displayed.
setMap
setMap(map)
Parameters:
ارزش بازگشتی: ندارد
Renders the layer on the specified map. If map is set to null , the layer will be removed.
به ارث رسیده: addListener ، bindTo ، get ، notify ، set ، setValues ، unbind ، unbindAll

CameraOptions interface

google.maps . CameraOptions interface

Used for setting the map's camera options.

center optional
Type: LatLngLiteral | LatLng optional
heading optional
Type: number optional
tilt optional
Type: number optional
zoom optional
Type: number optional

VisibleRegion interface

google.maps . VisibleRegion interface

Contains the four points defining the four-sided polygon that is the visible region of the map. On a vector map this polygon can be a trapezoid instead of a rectangle, when a vector map has tilt.

farLeft
Type: LatLng
farRight
Type: LatLng
latLngBounds
The smallest bounding box that includes the visible region.
nearLeft
Type: LatLng
nearRight
Type: LatLng

RenderingType constants

google.maps . RenderingType constants

Access by calling const {RenderingType} = await google.maps.importLibrary("maps") . کتابخانه ها را در Maps JavaScript API ببینید.

RASTER Indicates that the map is a raster map.
UNINITIALIZED Indicates that it is unknown yet whether the map is vector or raster, because the map has not finished initializing yet.
VECTOR Indicates that the map is a vector map.

MapCapabilities interface

google.maps . MapCapabilities interface

Object containing a snapshot of what capabilities are currently available for the Map. Note that this does not necessarily mean that relevant modules are loaded or initialized, but rather that the current map has permission to use these APIs. See the properties for a list of possible capabilities.

isAdvancedMarkersAvailable optional
نوع: boolean optional
If true, this map is configured properly to allow for the use of advanced markers. Note that you must still import the marker library in order to use advanced markers. See https://goo.gle/gmp-isAdvancedMarkersAvailable for more information.
isDataDrivenStylingAvailable optional
نوع: boolean optional
If true, this map is configured properly to allow for the use of data-driven styling for at least one FeatureLayer. See https://goo.gle/gmp-data-driven-styling and https://goo.gle/gmp-FeatureLayerIsAvailable for more information.