Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 41 Next »

Introduction

In collaboration with the Treasurer/Tax Collector we are making a restful street address geocoding service available. This page describes the service. We mostly follow the OGC geocoding standard which is described here.

The Request

Here is the DEV URL with an example address of "100 Main St":

http://10.250.60.189/geocode/streetNetwork/findAddressCandidates?f=json&Address=100 Main St&Zip=94105

The the URL is case sensitive.
The service uses the street segment network only.
These data are carefully maintained by Department of Public Works, and brought into EAS on a nightly basis.
We return a single best candidate and have not implemented a scoring system.
Instead of scoring we return exceptions to help you correct the input data.
The location is based on the linear interpolation of the matching street segment.
We offset by 4 meters (about 12 feet) to the even or odd side.
For example, here is "217 4th St":

The Response

We strongly prefer JSON (available now) but we can produce XML if you buy us a beer.
The JSON is formatted for readability but your browser may obscure that.
The way to see the nicely formated JSON is to right click on the web page and select "view source".
If you use chrome or firefox you can type "ctrl-u".
If you use Internet Explore you can type "alt-v-c".
In any case, the JSON should look something like this:

{
    "inputAddressString": "100 Main St", 
    "inputZipCodeString": "94105", 
    "spatialReference": {
        "wkid": 4326
    }, 
    "foundMatch": true, 
    "foundEasMatch": false, 
    "candidates": [
        {
            "address": "100 MAIN ST", 
            "longitude": -122.39489592098057, 
            "latitude": 37.7917552676099, 
            "score": null, 
            "attributes": {
                "StreetName": "MAIN", 
                "StreetType": "ST"
            }, 
            "addressNumber": "100", 
            "street": {
                "streetNamePrimary": {
                    "base_street_name": "MAIN", 
                    "street_type": "ST"
                }, 
                "streetNameAliases": [], 
                "l_f_add": 101, 
                "l_t_add": 199, 
                "r_f_add": 100, 
                "r_t_add": 198, 
                "seg_cnn": 8628000, 
                "geometry": "MULTILINESTRING ((-122.3949402377882194 37.7918420903234775, -122.3934079394635717 37.7906126704266541))"
            }, 
            "zipCode": "94105", 
            "jurisdiction": "SF MAIN"
        }
    ], 
    "validations": [], 
    "didYouMean": []
}
Results and Performance

We have tested the DEV implementation against all of the Treasurer/Tax Collector addresses.
The canonical source of the data are here:
https://data.sfgov.org/Business-and-Economic-Development/Active-Businesses/funx-qxxn
I have also attached the data to this page.

results pending...

found street matchfound eas matchcountpercent
    
    
    
    

The service processes about 500 addresses per minute which should be fine for our purposes.
We have done no performance optimization so we can probably make it faster if you have a compelling reason.

Technical Details

If you are interested in technical details you can find the code mostly in 2 places.
More or less...

And in an effort to set a good example we have written real unit tests which you can see here!

Example URLs

The nominal example:

http://10.250.60.189/geocode/streetNetwork/findAddressCandidates?f=json&Address=100 Main St&Zip=94105

You can send data with no street suffix if it's not ambiguous:

http://10.250.60.189/geocode/streetNetwork/findAddressCandidates?f=json&Address=157 Noe&Zip=94114

But be aware that there are ambiguous cases:

http://10.250.60.189/geocode/streetNetwork/findAddressCandidates?f=json&Address=157 Stanyan&Zip=94114

http://10.250.60.189/geocode/streetNetwork/findAddressCandidates?f=json&Address=157 Stanyan St&Zip=94118

http://10.250.60.189/geocode/streetNetwork/findAddressCandidates?f=json&Address=157 Stanyan Ave&Zip=94114

We do not parse degraded addresses:

http://10.250.60.189/geocode/streetNetwork/findAddressCandidates?f=json&Address=PMB 169 SACRAMENTO ST&Zip=94114

Address that include extra information at the end parse but typically fail to return a candidate

http://10.250.60.189/geocode/streetNetwork/findAddressCandidates?f=json&Address=169 SACRAMENTO ST 7&Zip=94114

But if it's clearly as unit, it works 

http://10.250.60.189/geocode/streetNetwork/findAddressCandidates?f=json&Address=169 SACRAMENTO ST UNIT 7&Zip=94114

You should get a warning if the address range of the best matching street is not a perfect

http://10.250.60.189/geocode/streetNetwork/findAddressCandidates?f=json&Address=100000%20SACRAMENTO%20ST&Zip=94118

 

Example Client

Here is an example client written in python.

 

  • No labels

0 Comments

You are not logged in. Any changes you make will be marked as anonymous. You may want to Log In if you already have an account.