Skip to content

Regex for Nominatim API call doesn't account for spaces, causing incorrect weather data #15

Open
@slaugaus

Description

@slaugaus

RegExp=(?siU)"features":\[{"type":"Feature","properties":{"geocoding":{.*,"label":"(.*)",.*,"admin":{.*?"level\d+":"(.*)"}}},"geometry":{"type":"Point","coordinates":\[(.*),(.*)\]}}\]

The offending spaces are in the value of geometry, as seen near the end of this response for Hell, Michigan. Removing them makes the regex work as intended.

{"type":"FeatureCollection","geocoding":{"version":"0.1.0","attribution":"Data © OpenStreetMap contributors, ODbL 1.0. http://osm.org/copyright","licence":"ODbL","query":"Hell, MI"},"features":[{"type":"Feature","properties":{"geocoding":{"place_id":415106,"osm_type":"node","osm_id":154309316,"osm_key":"place","osm_value":"hamlet","type":"district","label":"Hell, Putnam Township, Livingston County, Michigan, United States","name":"Hell","city":"Putnam Township","county":"Livingston County","state":"Michigan","country":"United States","country_code":"us","admin":{"level7":"Putnam Township","level7":"Putnam Township","level6":"Livingston County","level6":"Livingston County","level4":"Michigan","level4":"Michigan"}}},"geometry":{"type": "Point","coordinates": [-83.9849477, 42.4347571]}}]}```

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions