We're working on a project using OSM files, which is focused on our region: the Basque Autonomous Community. Some months ago, we're asked (by the Transportation division of the basque government) to introduce HGV restrictions on some roads. These ones were numerous, but we're able to do it manually.

This time we must introduce lots of updates to many roads (we don't know the exact number). These're vehicles' max length, height, weight and width restrictions to primary roads, so there's a way to automate it.

So far, we've been studying alternatives to accomplish the task.

Take region's PBF file and try to parse and modify it using a library. I've tried using Atlas with a Java application, but when loading the map I was thrown the expected OutOfMemoryError exception.

Modify online OSM data programmatically.

What's the best way to do it? Take into account the task can't be done manually...

asked 28 Apr, 15:29

sanchezingartek's gravatar image

sanchezingartek
11113
accept rate: 0%


First, do you want to modify the online database for everyone or just your local copy ? I'll focus on the first option.

You'll need to follow the Import process, especially discussion with the local community, dedicated account for easy revert and so on.

You'll have to publish the input data for public review, test your process on small area first, ask for comments...

Level0 is a low-level editor, which might suit your need. JOSM has a lot of power also.

My main concern is how will you identify the correct road to edit ? Roads in OSM are split in numerous parts (on bridges, lane changes and such). And of course what do you do if the data is already present, but different ?

Are you sure a semi-automated process is not possible, like through MapRoulette, or Osmose ?

Mechanical edits are really not encouraged, because the risks to mess the data are high.

Regards.

permanent link

answered 28 Apr, 17:22

H_mlet's gravatar image

H_mlet
1.7k732
accept rate: 13%

Agree with everything H_mlet says, but you should really look at the work of Richard on TfL Cycleway data, see talk-gb. This is a rather analogous problem and therefore I would suggest his approach would work for you. It does depend on having good skills in PostgreSQL, PostGIS and PL/pgSQL.

In real practice I would recommend engaging him to consult on the process if that is financially viable.

permanent link

answered 28 Apr, 17:57

SK53's gravatar image

SK53 ♦
24.1k46242379
accept rate: 20%

Thanks for your replies.

I'd like to share all the modifications, since they're made by the basque government. For the time being, I'll make changes to a local copy. Once all the changes have been made, I'll publish them, following your recommendations.

I'm going to explain the process I'm following.

  1. I download Spain's latest map from geofabrik (https://download.geofabrik.de/europe/spain-latest.osm.pbf).
  2. I use osmconvert to crop the map and leave the Basque Autonomous Country: $ osmconvert spain-latest.osm.pbf -b=-3.9853,42.3585,-1.1948,43.5685 -o=euskadi-latest.o5m
  3. Filter the map to only highways: $ osmfilter euskadi-latest.o5m --keep="highway=" -o=euskadi-roads-latest.o5m

Now, my goal is to filter the map and leave only the roads. I've been told to modify from primary to below highways. According to the wiki, I guess I'd modify these: primary, secondary, tertiary and road. I'd not modify link roads, special road types, paths, sidewalks, cycleways and lifecycles.

The tags I've been told to modify, with their respective default generic values, are: maxlength (40m), maxheight (4.7m), maxwidth (5m) and maxweight (110t). These values can be extracted from the following gubernamental document.

So, I must modify each tag per each highway:

$ osmfilter euskadi-roads-latest.o5m --modify-tags="!maxlength and ( highway=primary or =secondary or =tertiary or =road ) add maxlength=40" -o=euskadi-roads-latest-with-maxlength.o5m

This statement must be repeated for maxheight, maxwidth and maxweight. The problem here is that I must detect the roads in which there isn't any tag prestablished to avoid override it.

It seems !maxlength won't work... -bash: !maxlength: event not found

Other alternatives would be maxlength!="" or maxlength!=null...

Thank you

permanent link

answered 29 Apr, 14:11

sanchezingartek's gravatar image

sanchezingartek
11113
accept rate: 0%

edited 29 Apr, 14:16

2

First, I must say I've never done any import. But from what I read, here are some humble remarks.

  • Your proposed process will generate a lot of conflicts, as you'll be working on outdated data. You should download only a small part, apply your modifications, upload as soon as possible, and then another small part and so on. With visual verification.

  • Please read and follow the Import guideline, which means that your process must be documented and discussed on the wiki and the import mailing-list, where experienced people will see it.

  • Explicit tagging of implicit road characteristics is usually frowned upon. But there is a tag to say that it's the default speed : source:maxspeed

  • Maybe you should add information to this page.

  • I've had a look a the reference document, I don't see how you can do the conflation. Even assuming that all the refs are in the database, to compute the PK, with the way split everywhere and such, will be a challenge. That's the part of your process that you should test and document the most.

Best regards, and good luck.

(30 Apr, 13:36) H_mlet
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×17
×12
×11

question asked: 28 Apr, 15:29

question was seen: 377 times

last updated: 30 Apr, 13:36

powered by OSQA