I'm trying to figure out how to set some variables based on geocode
accuracy and can't seem to find a solution.  I'm also new to the
Google Maps API.

For my situation, if the accuracy is high, I would like to return a
high zoom level and text to indicate 'here is what you're looking
for.'  And if the accuracy is low, return a low zoom setting and text
to indicate 'couldn't find what you wanted but here is something
close.'

I have a test site here: http://www.stacefelder.com/maptest

Entering "480 Valencia St, San Francisco"  - a valid address - returns
the map with a marker at that point and my desired zoom.  But entering
"4800 Valencia St, San Francisco" - an invalid address - currently
returns the map with the same zoom and a marker in the middle of the
length of Valencia St., making it appear to be the location of that
address. In this case I would prefer to set the zoom to a lower number
and somehow indicate that the marker is not at 4800 Valencia (or 480
Valencia, for that matter) because it doesn't exist and that the map
is for the next best match (in this case, just Valencia St).

Here is the script I'm currently using:
        <script type="text/javascript">
                var geocoder;
                var map;
                function initialize() {
                        geocoder = new google.maps.Geocoder();
                        geocoder.geocode( { 'address': address}, 
function(results, status)
{
                                if (status == google.maps.GeocoderStatus.OK) {
                                        
map.setCenter(results[0].geometry.location);
                                        var marker = new google.maps.Marker({
                                                map: map,
                                                position: 
results[0].geometry.location
                                        });
                                } else {
                                        alert("Geocode was not successful for 
the following reason: " +
status);
                                }
                        });
                        var myOptions = {
                                zoom: 16,
                                mapTypeId: google.maps.MapTypeId.ROADMAP
                        }
                        map = new 
google.maps.Map(document.getElementById("map_canvas"),
myOptions);
                }
        </script>

All thoughts and suggestions welcomed.
Thanks very much,
Stace


-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To post to this group, send email to google-maps-js-api...@googlegroups.com.
To unsubscribe from this group, send email to 
google-maps-js-api-v3+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to