اعلامیه: سبک نقشه پایه جدید به زودی به پلتفرم نقشه های گوگل می آید. این بهروزرسانی برای استایل نقشه شامل یک پالت رنگی پیشفرض جدید، پینهای مدرن شده و بهبودهایی در تجربهها و قابلیت استفاده از نقشه است. همه سبکهای نقشه بهطور خودکار در مارس 2025 بهروزرسانی میشوند. برای اطلاعات بیشتر در مورد در دسترس بودن و نحوه انتخاب زودتر، به سبک نقشه جدید برای پلتفرم Google Maps مراجعه کنید.
همپوشانی ها اشیایی روی نقشه هستند که به مختصات طول و عرض جغرافیایی گره خورده اند، بنابراین با کشیدن یا بزرگنمایی نقشه حرکت می کنند. اگر می خواهید یک تصویر را روی نقشه قرار دهید، می توانید از یک شی GroundOverlay استفاده کنید.
برای اطلاعات در مورد انواع دیگر همپوشانی، به طراحی روی نقشه مراجعه کنید.
یک روکش زمینی اضافه کنید
سازنده برای GroundOverlay یک URL از یک تصویر و LatLngBounds تصویر را به عنوان پارامتر مشخص می کند. تصویر بر روی نقشه ارائه می شود، محدود به محدوده های داده شده، و با استفاده از طرح ریزی نقشه مطابقت داده می شود.
TypeScript
// This example uses a GroundOverlay to place an image on the map// showing an antique map of Newark, NJ.lethistoricalOverlay;functioninitMap():void{constmap=newgoogle.maps.Map(document.getElementById("map")asHTMLElement,{zoom:13,center:{lat:40.74,lng:-74.18},});constimageBounds={north:40.773941,south:40.712216,east:-74.12544,west:-74.22655,};historicalOverlay=newgoogle.maps.GroundOverlay("https://storage.googleapis.com/geo-devrel-public-buckets/newark_nj_1922-661x516.jpeg",imageBounds);historicalOverlay.setMap(map);}declareglobal{interfaceWindow{initMap:()=>void;}}window.initMap=initMap;
// This example uses a GroundOverlay to place an image on the map// showing an antique map of Newark, NJ.lethistoricalOverlay;functioninitMap(){constmap=newgoogle.maps.Map(document.getElementById("map"),{zoom:13,center:{lat:40.74,lng:-74.18},});constimageBounds={north:40.773941,south:40.712216,east:-74.12544,west:-74.22655,};historicalOverlay=newgoogle.maps.GroundOverlay("https://storage.googleapis.com/geo-devrel-public-buckets/newark_nj_1922-661x516.jpeg",imageBounds,);historicalOverlay.setMap(map);}window.initMap=initMap;
برای حذف همپوشانی از نقشه، متد setMap()null فراخوانی کنید. توجه داشته باشید که فراخوانی این روش همپوشانی را حذف نمی کند. پوشش را از نقشه حذف می کند. اگر در عوض میخواهید همپوشانی را حذف کنید، باید آن را از نقشه حذف کنید و سپس خود همپوشانی را روی null قرار دهید.
تاریخ آخرین بهروزرسانی 2025-03-13 بهوقت ساعت هماهنگ جهانی.
[[["درک آسان","easyToUnderstand","thumb-up"],["مشکلم را برطرف کرد","solvedMyProblem","thumb-up"],["غیره","otherUp","thumb-up"]],[["اطلاعاتی که نیاز دارم وجود ندارد","missingTheInformationINeed","thumb-down"],["بیشازحد پیچیده/ مراحل بسیار زیاد","tooComplicatedTooManySteps","thumb-down"],["قدیمی","outOfDate","thumb-down"],["مشکل ترجمه","translationIssue","thumb-down"],["مشکل کد / نمونهها","samplesCodeIssue","thumb-down"],["غیره","otherDown","thumb-down"]],["تاریخ آخرین بهروزرسانی 2025-03-13 بهوقت ساعت هماهنگ جهانی."],[[["Ground overlays let you place images on a map tied to latitude/longitude coordinates."],["You can add a ground overlay using the `GroundOverlay` object, specifying the image URL and boundaries."],["To remove a ground overlay from the map, call `setMap(null)` on the overlay object."],["Removing an overlay from the map doesn't delete it; to delete it, set the overlay object to `null` after removing it from the map."]]],["Ground overlays, images tied to latitude/longitude coordinates, are added to a map using the `GroundOverlay` constructor, specifying an image URL and `LatLngBounds`. The `setMap()` method then renders the image. Removing an overlay involves calling `setMap(null)` on the overlay object, which detaches it from the map but doesn't delete it. To delete the overlay it needs to be set to null. Example code is provided in TypeScript and JavaScript.\n"]]