On Mar 24, 8:40 pm, stacef <[email protected]> wrote:
> I'm trying to figure out how to set some variables based on geocode
> accuracy and can't seem to find a solution.

The invalid address returns an aproximate match on the street, and it
has the fields:
<partial_match>true</partial_match>
<location_type>GEOMETRIC_CENTER</location_type>
http://maps.google.com/maps/api/geocode/xml?address=6600%20Valencia%20St,%20San%20Francisco&sensor=false

The valid address has the fields:
<type>street_number</type>
<location_type>ROOFTOP</location_type>
http://maps.google.com/maps/api/geocode/xml?address=400%20Valencia%20St,%20San%20Francisco&sensor=false


Aside from that, both results have a suggested viewport. Are those
geometry values not suitable for your purposes?
http://code.google.com/apis/maps/documentation/v3/services.html#Geocoding


--
Marcelo - http://maps.forum.nu
--




>  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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to