pyrosm icon indicating copy to clipboard operation
pyrosm copied to clipboard

Exclude filter by service 'leaks'

Open anatrk opened this issue 3 years ago • 1 comments

I'm trying to use get_data_by_custom_criteria with exclude filter that has several tags and also values for service tag. The results contain unwanted service edges, for example with service=parking_aisle.

from pyrosm import OSM, get_data
 from shapely.wkt import loads
 
 drive_filter = dict(
     area=['yes'],
     service=['parking', 'parking_aisle', 'private', 'emergency_access','parking_aisle'],
     highway=['cycleway', 'footway', 'path', 'pedestrian', 'steps', 'track',
              'corridor', 'elevator', 'escalator', 'proposed', 'construction',
              'bridleway', 'abandoned', 'platform', 'raceway'],
     motor_vehicle=['no'],
     motorcar=['no']
 )
 
 osm = OSM(get_data("test_pbf"))
 
 driving = osm.get_data_by_custom_criteria(custom_filter=drive_filter,
                                           osm_keys_to_keep="highway",
                                           filter_type="exclude")
 driving['service'] = driving['service'].apply(lambda x: 'MyNone' if (x is None) else x)
 
 print(f"Number of lines parsed: {len(driving)}")
 driving_t = driving.groupby('service')['id']
 print(driving_t.count())

Output is:

     id  service
service                    
MyNone         173      173
driveway        27       27
parking_aisle    7        7

anatrk avatar Mar 14 '21 16:03 anatrk

@anatrk Hi! Thanks for reporting! 👍🏻 I will take a look at this. I have witnessed similar behavior --> #108

HTenkanen avatar Mar 15 '21 08:03 HTenkanen