I am seeing some really odd behaviour on my Google Maps app. I am using Backbone:
initialize: ->
osmMapType = new google.maps.ImageMapType(
getTileUrl: (coord, zoom) ->
"http://tile.openstreetmap.org/#{zoom}/#{coord.x}/#{coord.y}.png"
tileSize: new google.maps.Size(256, 256)
isPng: true
alt: "OpenStreetMap layer"
name: "OSM"
maxZoom: 19
)
cloudMadeMapType = new google.maps.ImageMapType(
getTileUrl: (coord, zoom) ->
"http://b.tile.cloudmade.com/a97cc0871d97477b911c3f9155a93ee7/26250/256/#{zoom}/#{coord.x}/#{coord.y}.png"
tileSize: new google.maps.Size(256, 256)
isPng: true
alt: "CloudMade layer"
name: "CMade"
maxZoom: 13
)
lat = 51.503
lng = -0.113
latlng = new google.maps.LatLng(lat, lng)
options =
zoom: 10
center: latlng
mapTypeId: 'OSM'
@gMap = new google.maps.Map(document.getElementById("map"), options)
@gMap.mapTypes.set('OSM', osmMapType)
@gMap.mapTypes.set('CloudMade', cloudMadeMapType)
@gMap.setMapTypeId(google.maps.MapTypeId.TERRAIN)
I am loading the API as such:
<script src="https://maps.googleapis.com/maps/api/js?sensor=false" type="text/javascript"></script>
But for some reason... the google maps controls and overlays are "blurry":
blurry controls... http://vuknikolic.wordpress.com/2012/04/02/twitter-bootstrap-and-google-maps-v3/
and an infowindow...
I have looked over and over the code and can not see the error, there are no errors in console either.
@geocodezip was right, it was the css. Essentially Google Maps does not like the way BootStrap handels the max-width of images. So you need to put a little hack in your CSS...
#map img {
max-width: none;
}
http://vuknikolic.wordpress.com/2012/04/02/twitter-bootstrap-and-google-maps-v3/
There are no errors in your code. It is a problem with your css.
Just add this CSS in your map container (assuming it has id=gmap
):
#gmap img {
max-width: none;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With