Skip to content

Added support for OSM BB Header to OSMReader - #2134

Closed
hegerdes wants to merge 2 commits into
graphhopper:masterfrom
hegerdes:ReaderStuff
Closed

hegerdes wants to merge 2 commits into
graphhopper:masterfrom
hegerdes:ReaderStuff

Conversation

@hegerdes

Copy link
Copy Markdown

The OSMReader is now able to use the OSM BBox Header.

I reimplemented and updated the old version that was already implemented but put in comments.

Bound bound;
if (header.hasBbox()) {
HeaderBBox bbox = header.getBbox();
bound = new Bound(bbox.getRight() * COORDINATE_SCALING_FACTOR, bbox.getLeft() * COORDINATE_SCALING_FACTOR,
bbox.getTop() * COORDINATE_SCALING_FACTOR, bbox.getBottom() * COORDINATE_SCALING_FACTOR,
header.getSource());
} else {
bound = new Bound(header.getSource());
}

This solvels #2133

@michaz

michaz commented Sep 23, 2020 •

Copy link
Copy Markdown
Member

I'm reluctant to have code around that produces information which is then not used. To be honest, if I came across that code, I would think "unused code" and remove it again. I would even think it might confuse users because it looks like it plays some role somewhere, which it doesn't.

Now I see what you meant by "use it as a library" -- good point, though I'm not sure we support e.g. extending OSMReader in your own code and then getting to the new element you're adding as "library use". We just don't have it on our radar. (At least I don't, maybe others disagree.) It could just change back any time.

@boldtrn

boldtrn commented Sep 23, 2020

Copy link
Copy Markdown
Member

Just a note: you could also use Osmosis or Osmconvert to cut the pbf file, which is probably easier than doing it in GraphHopper. For example here is the Osmconvert wiki page explaining how to do this: https://wiki.openstreetmap.org/wiki/Osmconvert#Keeping_Cross-Border_Ways_Complete

@karussell

Copy link
Copy Markdown
Member

It was indeed a feature at some point where the import was very memory intense and I did not know the existing tools ... unfortunately I did not fully remove the code it seems. For now I would indeed prefer to have the code removed as there seems to be no one with a need for it as it could be easily done externally.

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

Successfully merging this pull request may close these issues.

4 participants