Closed (fixed)
Project:
Geocoder
Version:
7.x-1.x-dev
Component:
Code
Priority:
Major
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
29 Sep 2011 at 22:00 UTC
Updated:
24 Mar 2012 at 20:50 UTC
Is there any way to make the google geocode return an accuracy parameter, if it gets the values from another field? The geocoder seems to always have a return value, even if it's just random characters entered as input.
Marking as major, I feel.
Comments
Comment #1
michaelfavia commentedThis is a full response form a google geocode request:
http://maps.googleapis.com/maps/api/geocode/xml?address=78704&sensor=false
And here are the various location_type codes that refer to the type of geocoding that was done and googles level of accuracy/calculation:
"ROOFTOP"indicates that the returned result is a precise geocode forwhich we have location information accurate down to street address precision.
"RANGE_INTERPOLATED"indicatesthat the returned result reflects an
approximation (usually on a road) interpolated between two precise points (such as intersections).
Interpolated results are generally returned when rooftop geocodes are unavailable for a street
address.
"GEOMETRIC_CENTER"indicates thatthe returned result is the geometric center of
a result such as a polyline (for example, a street) or polygon (region).
"APPROXIMATE"indicates that thereturned result is approximate.
You want the geocoder() function to return an object/associative array with this information in some fashion?
Comment #2
michaelfavia commentedLooked into this one as well for you and determined that pulling in the location_type (or a generic version of that value that is cross geocoder compatible) into the Point() class would be trivial if phayes sees value in having it there but having a hard time determining your usecase. Mind elaborating?
Here is the reference doc from bing geocode results:
http://msdn.microsoft.com/en-us/library/cc980950.aspx
They seem to have confidence interval but not location type field in their results.
Comment #3
nagiek commentedI only want to geocode fields which are 100% the spot (I guess
ROOFTOP). Otherwise, I don't want the result. So if the geocoder can tell me what Google thinks of the result in an obj/array, that would be helpful.Thanks Michael
Comment #4
michaelfavia commentedThis sounds like a reasonable feature. If someone else needs it (mark it back active) and ill consider writing it up myself, and i'll of course accept patches if you want to take a hack yourself.
I think it might best be implemented as a setting on the geocoder widget that each plugin can offer options for because each geocoder has different values (google, bing, yahoo).
We need the accuracy to be stored with the point or passed along with the geocoding result.
Im going to open another case to discuss this and other information we can glean off of our geocoding requests with phayes. If like to be able to offer address verification, bounding boxes, etc.
Comment #5
phayes commentedOkay, I'm going to start working on this.
I've already migrated away from using geoPHP for google-geocoding. Next step is to allow plugins to define config forms so we can add config for rejecting geocoding below a certain accuracy etc.
Comment #6
phayes commentedDone!
Check out the geocoder settings for google. You now have tons of additional options including the ability to reject geocodes based on accuracy. You can also also get the bounds (instead of the centroid) if you want.
As a bonus, I had to built a generalized system for geocoder-handlers to define settings forms. So now all geocoder-handlers can be configurable.
Comment #7
phayes commentedComment #8
michaelfavia commentedImplied in phayes comments is that this is in the 7.x-1.x dev branch if you want it not the beta release. It is also the only change at this point. We'll roll it into a release as soon as we get positive feedback and test it thoroughly.
Comment #9
phayes commentedAlso implied is we need testing and code review. :-)
Comment #10
nagiek commentedAwesome!! Glad to hear.
I hope to give it a test tomorrow.
Comment #11
Shadlington commentedIs it at all possible to use this to reject results when just a country is entered in an addressfield (that you are geocoding from)?
From the description it seems like that level of control is not possible.
My request at #1380570: Reject geocoding if accuracy requirements are not met asking for this feature was closed as a duplicate of this one so if this is not available yet should I re-open it?
Comment #12
phayes commentedOh yes, please do re-open