[Osm4j] Why don't objects of type "way" and type "relation" appear in a file in PBF format?
Sebastian Kürten
sebastian.kuerten at fu-berlin.de
Wed Nov 27 18:12:19 UTC 2019
Hi Manuel,
I'm sorry I did not get to answer you other messages yet.
Please be assured that PBF files contain the same amount of data as
XML. PBF is just better in basically every aspect except it cannot be
read with an ordinary text editor.
Please read about the file formats on the OpenStreetMap Wiki and find
out about the specifics.
In the meanwhile you can also try the following procedure to convince
yourself. Try following these steps I just tried on my own computer:
Download PBF file of Cuba:
wget http://download.geofabrik.de/central-america/cuba-latest.osm.pbf
Clone osm4j-utils:
git clone https://github.com/topobyte/osm4j-utils
Build osm4j-utils:
cd osm4j-utils
./gradlew clean create
Count objects in the file downloaded before:
./scripts/OsmCount --input-format pbf --input cuba-latest.osm.pbf
It should produce this output:
nodes: 3941711
ways: 493885
ways (closed): 304710
waynodes: 4684888
relations: 5228
relation members: 53957
As you can see there's nodes, ways and relations.
Also, you can study the code of osm4j-utils in order to find out how to
read and write PBF files. I think you will benefit a lot from studying
that code.
I think a tutorial would be even better, but I don't have that
available right now.
There is also information on the web on how to extract a smaller region
(Havanna) from a larger OSM data file (Cuba). It can be done with
osm4j-utils (with the executable OsmRegionFilter, by supplying a
--region argument with a WKT file. You would then need a WKT boundary
of Havanna, which you can obtain from Overpass API, for example) and
also with various other tools that are documented on the OpenStreetMap
Wiki.
I do not mean to sound to harsh, I just don't have the time right now
to answer your emails thoroughly and with too detailed instructions.
Best,
Sebastian
On Wed, 27 Nov 2019 12:46:53 -0500 (CST)
Manuel Enrique Puebla Martinez via Osm4j <osm4j at openstreetmap.org>
wrote:
> Hi:
>
> I am analyzing all the geographic objects of the information
> belonging to Havana, for this I downloaded the information from OSM
> in PBF format.
>
> Before, I had done the same work with a Havana municipality, which is
> included in what I downloaded now. The difference was that I used the
> XML format and not the PBF format.
>
> I find it curious, that with the municipality of Havana I found
> objects "OsmEntity" of type "way" and of type "relation", but now
> with the information of all Havana only objects of type "node"
> appear. It is contradictory that in a Havana municipality there
> appear objects of type "way" and of type "relation" while in all
> Havana only objects of type "node" appear. Will the answer be in the
> PBF format? Could it be that the PBF format does not allow capturing
> objects of type "way" and of type "relation" ?
>
> Any suggestions?
>
> Greetings.
>
>
> 1519-2019: Aniversario 500 de la Villa de San Cristóbal de La Habana
> Por La Habana, lo más grande. #Habana500 #UCIxHabana500
More information about the Osm4j
mailing list