1

I am currently working in map for a province of Papua New Guinea. In OpenStreetMap (OSM) I have recently updated and added new relations for boundaries of admin_level=5 and admin_level=6, which were not present before.

The relations I am analysing are the following: 5,259,918 and 5,259,919. You can check them here:

http://ra.osmsurround.org/analyzeRelation?relationId=5259918

http://ra.osmsurround.org/analyzeRelation?relationId=5259919

I extract the OSM data with http://extract.bbbike.org in PBF format, and then I export it with ogr2ogr using a command similar to the following

ogr2ogr -f "SQLite" -dsco SPATIALITE=YES png-full-test.db planet_xxx.osm.pbf

The resulting .db is later used in QGIS for creating the map. I use a custom osmconf.ini to extract the tags I need for my map.

The relations were created using both non-existing lines (borders where there is no other feature, created just for this purpose) and existing lines (such as rivers, which are part of the relation). The latter do not have specific tags for boundary=administrative or admin_level=6 as these are included in the relation (and according to my best understanding, there is no need to put them twice).

However, when I open the resulting file, only the lines which have the tags explicitly added will be shown. The ones such as rivers or roads, which are part of the relations but that they don't have neither boundary or admin_level tag, will not be listed in none of the resulting tables (other_relations, lines, points, multilinestrings or multipolygons). They are lost in the process. A quick and dirty solution would be to add the missing tags to the rivers / roads, but I am wondering if there is any other cleaner way to solve the issue.

  • It would be nice if you could put some sample data for downloading somewhere or an exact command that downloads data from some API, but then the data may be different tomorrow, so that others can easily make tests with the same data. – user30184 Jun 25 '15 at 18:01
0

Are you sure the new data is already in your source files? Maybe you could download with overpass api, which is always current.

Existing lines will not get any boundary tags from the relation they are member of, but the whole relation is created as a separate polygon with a negative relation ID.

  • Thanks! I just checked in the polygons table and the data is there. I was wrongly assuming that the data should be found in the lines or multilinestrings tables. I never checked the polygon for the boundaries (as all the rest I was displaying were not there). – Juan Batman Jun 25 '15 at 22:24
  • The boundary would go into the lines table if it was broken (i.e. not closed). – AndreJ Jun 26 '15 at 5:58
0

It wouldn't probably really respond to your answer but (and if your source file already contains your modifications, as suggested by a previous answer), i guess that ogr2ogr can sometimes have mixed results when dealing with polygons or relations if the OSM data don't strictly respect the schema required by ogr2ogr. You probably already have a look on this question and on the OGR diver for OSM ? Also this OSM contributor reference some difficulties with boundaries extraction.

But maybe can you be more precise when you say that some of these ways are lost in the process, what do you exactly mean ? Are you using some SQL request in the ogr2ogr command line ? Or do you mean that the way you talk about (for example a river which is part of a relation describing an administrative boundary) is actually present but without any reference to his role in the relationship ? Or that there is no polygon created when it should have been, using that said way ?

  • Yes, the river is present but I was expecting to find boundaries tags somewhere, or a second line with the boundaries reflecting the relation. At the end I was wrong, as the relation is exported as a polygon, as described in the answer above. Thanks anyway for your help! – Juan Batman Jun 25 '15 at 22:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.