marceloprates / prettymaps

A small set of Python functions to draw pretty maps from OpenStreetMap data. Based on osmnx, matplotlib and shapely libraries.
GNU Affero General Public License v3.0
11.16k stars 527 forks source link

Missing streets #53

Open Siron777 opened 3 years ago

Siron777 commented 3 years ago

Hi,

I am using this wonderful tool and I notice that some streets are not visible or are truncated. Here is an example for the City of Ottignies, in Belgium (address: Clinique Saint Pierre, Ottignies, Belgium). In purple there is some missing residential streets. In green there is some missing footways. ottignies

I am using the script from the Macao example, with path and track added to the drawing. I don't see in OSM any distinctive traits in the configuration of those streets which could explain the fact that they are not visible.

Best regards, Simon

G21-Goose commented 3 years ago

Hey Simon,

I just added a change to my PR #48 that seems to fix this. You can try it with this

pip install git+https://github.com/marceloprates/prettymaps.git@refs/pull/48/head

image

Siron777 commented 3 years ago

Thank you. For the testing, I did try the pip command to get the modified library, something was downloaded, but I was not able to get the modified code in my prettymaps library. I will investigate what is happening in the next few days.

G21-Goose commented 3 years ago

First you need to uninstall the previous prettymaps version with pip uninstall prettymaps. Also I had to close that previous PR because of some merge errors. This is the most recent one:

pip install git+https://github.com/marceloprates/prettymaps.git@refs/pull/54/head
Siron777 commented 3 years ago

Make sense, thank you!

All the missing streets are now there. Thank you²!

A subsequent issue I see now is that some footway are drawn with the width of a residential street. This is the case with the two which where missing in the green circle in my image. It is also the case for a few others in the image. My intuition would say that it occurs when a footway is the prolongation of a residential street. So when a residential street finishes in a dead end for a car, but in a footway for pedestrians, the footway will be drawn with the width of the street (but maybe this is just a coincidence and that rule is wrong).

G21-Goose commented 3 years ago

Hey, Glad it's sort of solved the issue. The OSM ID of those footways you mentioned are 518776174 and 518776176. In the get_streets() function infetch.pyafterstreetsis turned into aGeoDataFrame` with the line:

streets = ox.graph_to_gdfs(streets, nodes=False)

I saved it as a CSV with streets.to_csv('Belgium.csv'). If you search for the OSM ID's in the Belgium.csv file you get a result like this (only looking at two of the columns):

OSM ID Highway
[28036684, 518776174] ['residential', 'footway']
[518776176, 160717059] ['residential', 'footway']

The order of highway doesn't seem to match up with the order of the osmid. So I can't think of a way that it would be possible to determine that 518776176 and 518776174 are footways.

salanova-elliott commented 3 years ago

I think I could be experiencing a similar issue. I'm trying to plot the pedestrian tracks of Tromsø, Norway and prettymaps can't seem to find them with the tag I'm using. OSM says the main path is 'highway:track' (Lysløypa, 258648143), but when I try to assign that to a layer, it returns 'GEOMETRYCOLLECTION EMPTY'. Any ideas what could be happening?

I also reinstalled from refs/pull/54/head

G21-Goose commented 3 years ago

Hi @salanova-elliott Your issue doesn't seem to be the same, using the same approach I detailed before with the CSV, it is only called a track. I managed to get the tracks though I think? image

The coordinates I used were (69.6708, 18.95) and the radius I used was radius = 5000. The streets layer I did looked like:

'streets': {
    'width': {
        'track': 3,
    },
    'circle': False,
    'buffer': 1000
},

If you have used a custom_filter you may have to set retain_all to True so that you can see all the results e.g.

'streets': {
    'custom_filter': '["highway"~"track"]',
    'width':3,
    'circle': False,
    'buffer': 1000,
    'retain_all': True
},
salanova-elliott commented 3 years ago

Thanks for the quick response @G21-Goose! It was just my inexperience with OSM and prettymaps. I didn't realize 'highway' was filed under 'streets', I was trying to call that tag directly (ie 'foot_path': {'tags': {'highway': 'track'}}). Solved