Take the 2-minute tour ×

It's exactly the example code of the maps API documentation found here:

Google maps API documentation

I have set up an map and it is showing. Next step was showing the marker with geocoding.. But it's not working? Can anyone help me out?


<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?key=AIzaSyAS1COH5SeJCKhZ6i6nTi0Fx2qsdvWbAfA&sensor=false"></script>
<script type="text/javascript">

var loMap;
var loGeocoder;

    var loOptions = 
        center:     new google.maps.LatLng(51.9645, 5.1965),
        zoom:       6,
        mapTypeId:  google.maps.MapTypeId.ROADMAP

    loMap       = new google.maps.Map(document.getElementById('map'), loOptions);
    loGeocoder  = new google.maps.Geocoder();


function showMarkers()
    loGeocoder.geocode( { 'address': 'Den Bosch'}, function (results, status)  
        if(status == google.maps.GeocoderStatus.OK) 
            var marker = new google.maps.Marker(
                map:        loMap,
                position:   results[0].geometry.location

<div id="map" class="search_map" style="width: 220px; height: 240px"></div>
share|improve this question
What does it log to the console? –  Pavel Janicek Mar 7 '12 at 10:34
Ideally, you'd post a link to live code--we could easily troubleshoot then. Otherwise, please paste the entire code snippet (not preferrable, but better than the snippet you posted). –  andresf Mar 12 '12 at 3:25

2 Answers 2

An old question but as I recently hit the problem I thought I would share my solution. I found that something in the Javascript on the rest of my site was interfering with Google Maps. I was not getting any errors in Firebug or Chrome Console so I could not track down exactly what the conflict was.

I found that if I put the Google Map onto a blank ASPX page (i.e. no MasterPage with all of the Javascript and CSS from the rest of my site) that it worked fine.

The solution? I put the Google Map into an Iframe and now it works just fine. If you inspect the source of the Google Map example code, they use an Iframe too so there must be something to that.

share|improve this answer

you need to change the line new google.maps.LatLng(51.9645, 5.1965) to var place = new google.maps.LatLng(51.9645, 5.1965); and then use place as center in loOptions . same as in marker also it really works :) And import jquery as well at the start of page.

share|improve this answer
Why? You'll just place it in a variable? –  pascalvgemert Mar 7 '12 at 10:52
because it is throwing an error that new google.maps.LatLng(51.9645, 5.1965); is not an object –  Mayank Saxena Mar 7 '12 at 10:53
Never got that error. Changed it, but still no markers. Btw the setCenter worked from the start. –  pascalvgemert Mar 7 '12 at 12:39

Your Answer


