Open MarkRaadsen opened 2 months ago
Based on OSM tagging. Propose we go for: boundary and then - in simplest form - go for administrative boundary unless explicitly indicated via settings. Then take first match that is found, see https://wiki.openstreetmap.org/wiki/Key:boundary?uselang=en
NOTE: needs a bit more sophistication --> bounding area can be defined separately for zoning and services parsing --> yet currently the code to extract this is scattered through preProcessingHandler and network reader. We do not want to copy this across to the Zoning reader and handlers. SOLUTION: Create an OsmBoundingBoundaryBuilder which will contain the code for the various pre-processing steps now in the networkhandler as well as the functionality to then construct a new OsmBoundary. This code can then be reused in network/zoning/services readers. This is the next thing to do <-- REFACTORING, then testing
write tests with various bounding boundaries for network only, pt only, network and pt both and intermodal to see if it is working, also test various configs (with boundary type other than administrative and different admin_level values.
It is likely that using a name for the bounding area is more likely to be used than a rectangular bounding box. As such tracking the spanning square bounding box and flagging warnings based on this spanning bb is no longer a good default way of doing things. So, we discontinue using this method as the default and instead replace it by using the bounding boundary instead. Only if we have no bounding boundary we revert to the spanning bounding box
Testing reveals inefficient construction of OSM ways + currently we make to many nodes/ways available even if they fall entirely outside the bounding area specified. Debug this to fix up. Another general improvement to all of this would be to do the preprocessing of the bounding area before doing anything with preregistering of OSM nodes, this would allow for a more flexible approach where we only preregister nodes within the bounding area, then register OSM ways that have at least one node in the area (fully), and then register all nodes that are part of those ways. This would simplify checking and would also reduce the number of error message regarding missing nodes
Further improve: the new approach as per above can cause an OSMway to have NO nodes within bounding area, but due to another OSMway that is intersecting with it to be partially within the bounding area still have some nodes available even though it should NOT be considered --> so if the first node of a link is not available and another is chosen it should be checked if that node falls within the bounding area, if not then we should discard the OSM way quietly....example OSMway 4269134 for melbourne named bounding box test --> then continue refactoring to reduce checks/logging due to this improved approach --> then do the same for zoning
UPDATE: first part dealt with using secondary pre-registration to avoid this problemand not preregister such OSM ways, see comment below on how to best continue. pre-registration of nodes now sorted it seems
Partly implemented above. Likely best to instead keep a register (of ids) of OSMWays that were found eligible during preprocessing. Only when they are found eligible we should bother parsing them in the network main processing --> then ease the logging/warning regarding bounding boxes that are now triggered during node collection etc. This approach should be more elegant --> then apply same approach to zoning
ease the logging/warning regarding bounding boxes that are now triggered during node collection and when creating link because this should now never be needed anymore and we can remove all that somewhat ugly code
add support for parsing subsections of OSM files based on name, e.g., "New South Wales", or "Sydney", instead of rect bounding box only