Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't handle "City, State" format very well #332

Open
charleshan opened this issue May 22, 2018 · 2 comments
Open

Doesn't handle "City, State" format very well #332

charleshan opened this issue May 22, 2018 · 2 comments

Comments

@charleshan
Copy link

charleshan commented May 22, 2018

It looks like photon is looking for a place when characters are added after "New York."

>>> geocoder.komoot('New York').json
{
    'address': 'New York, United States of America',
    'bbox':
    {
        'northeast': [-71.7955694, 45.0158611],
        'southwest': [-79.761944, 40.477399]
    },
    'confidence': 10,
    'country': 'United States of America',
    'lat': 43.1561681,
    'lng': -75.8449946,
    'ok': True,
    'osm_id': 61320,
    'osm_key': 'place',
    'osm_type': 'R',
    'osm_value': 'state',
    'raw':
    {
        'geometry':
        {
            'coordinates': [-75.8449946, 43.1561681],
            'type': 'Point'
        },
        'type': 'Feature',
        'properties':
        {
            'osm_id': 61320,
            'osm_type': 'R',
            'extent': [-79.761944, 45.0158611, -71.7955694, 40.477399],
            'country': 'United States of America',
            'osm_key': 'place',
            'osm_value': 'state',
            'name': 'New York'
        }
    },
    'state': 'New York',
    'status': 'OK'
}

>>> geocoder.komoot('New York, NY').json
{
    'address': '37 West 44th Street, New York City New York, United States of America',
    'city': 'New York City',
    'country': 'United States of America',
    'housenumber': '37',
    'lat': 40.7555778,
    'lng': -73.9815595,
    'ok': True,
    'osm_id': 3759225465,
    'osm_key': 'club',
    'osm_type': 'N',
    'osm_value': 'sport',
    'postal': '10036',
    'raw':
    {
        'geometry':
        {
            'coordinates': [-73.9815595, 40.7555778],
            'type': 'Point'
        },
        'type': 'Feature',
        'properties':
        {
            'osm_id': 3759225465,
            'osm_type': 'N',
            'country': 'United States of America',
            'osm_key': 'club',
            'housenumber': '37',
            'city': 'New York City',
            'street': 'West 44th Street',
            'osm_value': 'sport',
            'postcode': '10036',
            'name': 'New York Yacht Club',
            'state': 'New York'
        }
    },
    'state': 'New York',
    'status': 'OK',
    'street': 'West 44th Street'
}

I believe the second command should have resulted in the same output as the first.
screenshot_2018-05-21-19_41_07

@alexandervlpl
Copy link

Most American users expect state abbreviations like NY and VT to work, and get confused and frustrated when they don't. I see this as a major issue!

@zackrspv
Copy link

zackrspv commented Jan 7, 2025

We usually get around this by calling the expand endpoint on libpostal for any abbrivations:

curl -v -X POST -H "Content-Type: application/json" -d '{"address":"CO"}' https://your_libpostal_server.com/expand

Response:
["co","colorado","county","company"]

And then calling the proper endpoint on Photon to feetch the data:

curl -X GET "https://your_server.com/api?q=Colorado"

which returns the needed items. I find that expanding common items first is easier. It's also helpful if you use something like pub 28 from the USPS to help normalize things as well before passing to the geocoder.

Not certain if that's something that should be specifically an issue w/ this project, as technically this project DOES work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants