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

Street polygon duplicate #244

Open
ambrusadrianz opened this issue Mar 11, 2020 · 12 comments
Open

Street polygon duplicate #244

ambrusadrianz opened this issue Mar 11, 2020 · 12 comments

Comments

@ambrusadrianz
Copy link

Hey team!

I was using your awesome geocoding engine when I noticed something interesting.
Let me tell you more about it.


Here's what I did 😇

pelias.github.io/compare


Here's what I got 🙀

{
    "geocoding": ⊖{
        "version": "0.2",
        "attribution": "http://api.yourpelias.com/attribution",
        "query": ⊖{
            "enableDebug": false,
            "text": "dalagatan",
            "parser": "pelias",
            "parsed_text": ⊖{
                "subject": "dalagatan"
            },
            "size": 10,
            "layers": ⊖[
                "street"
            ],
            "private": false,
            "focus.point.lat": 59.4391,
            "focus.point.lon": 17.9415,
            "lang": ⊖{
                "name": "English",
                "iso6391": "en",
                "iso6393": "eng",
                "defaulted": false
            }
        },
        "engine": ⊖{
            "name": "Pelias",
            "author": "Mapzen",
            "version": "1.0"
        },
        "timestamp": 1583925036740
    },
    "type": "FeatureCollection",
    "features": ⊖[
       ⊖{
            "type": "Feature",
            "geometry": ⊖{
                "type": "Point",
                "coordinates": ⊖[
                    18.039446,
                    59.347814
                ]
            },
            "properties": ⊖{
                "id": "polyline:480661",
                "gid": "openstreetmap:street:polyline:480661",
                "layer": "street",
                "source": "openstreetmap",
                "source_id": "polyline:480661",
                "name": "Dalagatan",
                "street": "Dalagatan",
                "distance": 11.579,
                "accuracy": "centroid",
                "country": "Sweden",
                "country_gid": ⊖{
                    "0": "whosonfirst:country:85633789",
                },
                "country_a": "SWE",
                "region": "Stockholm",
                "region_gid": ⊖{
                    "0": "whosonfirst:region:85688429",
                },
                "region_a": "ST",
                "county": "Stockholm",
                "county_gid": ⊖{
                    "0": "whosonfirst:county:1159303035",
                },
                "localadmin": "Vantor",
                "localadmin_gid": ⊖{
                    "0": "whosonfirst:localadmin:1125362217",
                },
                "locality": "Stockholm",
                "locality_gid": ⊖{
                    "0": "whosonfirst:locality:101752307",
                },
                "neighbourhood": "Vasastaden",
                "neighbourhood_gid": ⊖{
                    "0": "whosonfirst:neighbourhood:85902593",
                },
                "continent": "Europe",
                "continent_gid": ⊖{
                    "0": "whosonfirst:continent:102191581",
                },
                "label": "Dalagatan, Stockholm, Sweden"
            },
            "bbox": ⊖[
                18.039043,
                59.347412,
                18.03985,
                59.348217
            ]
        },
       ⊖{
            "type": "Feature",
            "geometry": ⊖{
                "type": "Point",
                "coordinates": ⊖[
                    18.041739,
                    59.34523
                ]
            },
            "properties": ⊖{
                "id": "polyline:480353",
                "gid": "openstreetmap:street:polyline:480353",
                "layer": "street",
                "source": "openstreetmap",
                "source_id": "polyline:480353",
                "name": "Dalagatan",
                "street": "Dalagatan",
                "distance": 11.894,
                "accuracy": "centroid",
                "country": "Sweden",
                "country_gid": ⊖{
                    "0": "whosonfirst:country:85633789",
                },
                "country_a": "SWE",
                "region": "Stockholm",
                "region_gid": ⊖{
                    "0": "whosonfirst:region:85688429",
                },
                "region_a": "ST",
                "county": "Stockholm",
                "county_gid": ⊖{
                    "0": "whosonfirst:county:1159303035",
                },
                "localadmin": "Vantor",
                "localadmin_gid": ⊖{
                    "0": "whosonfirst:localadmin:1125362217",
                },
                "locality": "Stockholm",
                "locality_gid": ⊖{
                    "0": "whosonfirst:locality:101752307",
                },
                "neighbourhood": "Vasastaden",
                "neighbourhood_gid": ⊖{
                    "0": "whosonfirst:neighbourhood:85905583",
                },
                "continent": "Europe",
                "continent_gid": ⊖{
                    "0": "whosonfirst:continent:102191581",
                },
                "label": "Dalagatan, Stockholm, Sweden"
            },
            "bbox": ⊖[
                18.041603,
                59.345142,
                18.04191,
                59.345375
            ]
        }
    ],
    "bbox": ⊖[
        18.039043,
        59.345142,
        18.04191,
        59.348217
    ]
}

Here's what I was expecting ✨

I was expecting the Dalagatan street to be merged by polylines into a single polygon.


Here's what I think could be improved 🏆

Is this a polylines issue? Or there is some problem with the underlying OpenStreetMap data?

@missinglink
Copy link
Member

Hi @ambrusadrianz, you should have a database called street.db within the interpolation subdirectory of your data dir.

Could you please query the database for the IDs 480661 and 480353 from the polyline table.

That will help me understand better why they weren't joined.

@ambrusadrianz
Copy link
Author

It doesn't seem to contain any of the ids. Should I try to prepare the data again?

@missinglink
Copy link
Member

Ok so another way is to get the data directly from the polylines file which was used at import time.

It will be in your data dir and likely end with .0sv or .polylines, the IDs are simply the line numbers in the file.

@ambrusadrianz
Copy link
Author

Found the issue, since I have only a Sweden import, the ids are not the same as in the global pelias index. (duh)

The two polylines are:

  • qmjqpBux~na@~m@j{@~HxPjB`OnAnZ
  • qurxoBi`xcb@pQ_^

@missinglink
Copy link
Member

Hmm.. something weird is going on, my calculations of the polylines show them as ~50km apart.

However, the two results you posted are only 316 m apart!?

> var p = require('@mapbox/polyline');
undefined

> p.toGeoJSON('qmjqpBux~na@~m@j{@~HxPjB`OnAnZ', 6)
{ type: 'LineString',
  coordinates:
   [ [ 18.087835, 59.545321 ],
     [ 18.086869, 59.544569 ],
     [ 18.086584, 59.544409 ],
     [ 18.086327, 59.544355 ],
     [ 18.085887, 59.544315 ] ] }

> p.toGeoJSON('qurxoBi`xcb@pQ_^', 6)
{ type: 'LineString',
  coordinates: [ [ 18.428437, 59.139945 ], [ 18.428933, 59.139648 ] ] }

@missinglink
Copy link
Member

So I suspect that it is correct to consider them disjoined but the centroids appear to be incorrect.

@missinglink
Copy link
Member

missinglink commented Mar 13, 2020

Are you sure it's not these two disjoined streets with the same name? (the highlighted one is 'qurxoBi`xcb@pQ_^')

Screenshot 2020-03-13 at 20 46 33

@missinglink
Copy link
Member

These are the two points from your original report:

Screenshot 2020-03-15 at 11 26 19

Please provide more information.

@ambrusadrianz
Copy link
Author

I did a reimport of the swedish data, something seems to be off.

The polygon ids don't seem to refer to the correct polyline entries. They're much further away than the position of the pelias location.

Do you have any suggestion? What am I doing wrong? Tried with the sqlite database and the plain polylines extract as well.

@missinglink
Copy link
Member

missinglink commented Mar 16, 2020

The IDs should map to line numbers in the file, maybe you're looking at the lines either one before or one after the target line?

@missinglink
Copy link
Member

Also worth noting that the point Pelias provides for a street is 50% along the linestring at its midpoint.

@missinglink
Copy link
Member

What does grep -ni Dalagatan /path/to/polylines.0sv return?

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

2 participants