Duyuru: Yeni ana harita stili yakında Google Haritalar Platformu'nda kullanıma sunulacak. Harita stilinde yapılan bu güncelleme, yeni bir varsayılan renk paleti, modernleştirilmiş raptiyeler ve harita deneyimleri ile kullanılabilirlik açısından iyileştirmeler içeriyor. Tüm harita stilleri Mart 2025'te otomatik olarak güncellenecektir. Kullanılabilirlik ve özelliği daha erken etkinleştirme hakkında daha fazla bilgi için Google Haritalar Platformu için yeni harita stili başlıklı makaleyi inceleyin.
Yer paylaşımları, haritada enlem/boylam koordinatlarına bağlı olan nesnelerdir. Bu nedenle, haritayı sürüklediğinizde veya yakınlaştırdığınızda hareket ederler. Bir haritaya resim yerleştirmek istiyorsanız GroundOverlay nesnesini kullanabilirsiniz.
Diğer yer paylaşımı türleri hakkında bilgi edinmek için Haritada çizim yapma başlıklı makaleyi inceleyin.
Yer paylaşımı ekleme
GroundOverlay sınıfının kurucusu, bir resmin URL'sini ve LatLngBounds değerini parametre olarak belirtir. Görüntü, haritada oluşturulur, belirli sınırlarla kısıtlanır ve haritanın projeksiyonu kullanılarak uyumlu hale getirilir.
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;
Bir yer paylaşımını haritadan kaldırmak için null parametresini göndererek yer paylaşımının setMap() yöntemini çağırın. Bu yöntemin çağrılmasının yer paylaşımını silmediğini unutmayın. Yer paylaşımını haritada kaldırır. Bunun yerine yer paylaşımını silmek istiyorsanız haritadan kaldırmanız ve ardından yer paylaşımını null olarak ayarlamanız gerekir.
[[["Anlaması kolay","easyToUnderstand","thumb-up"],["Sorunumu çözdü","solvedMyProblem","thumb-up"],["Diğer","otherUp","thumb-up"]],[["İhtiyacım olan bilgiler yok","missingTheInformationINeed","thumb-down"],["Çok karmaşık / çok fazla adım var","tooComplicatedTooManySteps","thumb-down"],["Güncel değil","outOfDate","thumb-down"],["Çeviri sorunu","translationIssue","thumb-down"],["Örnek veya kod sorunu","samplesCodeIssue","thumb-down"],["Diğer","otherDown","thumb-down"]],["Son güncelleme tarihi: 2024-12-22 UTC."],[[["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"]]