NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

Hi, I'm using the windows version of osmfilter to try and extract city and town names with lat and long. The idea being to build a gazeteer for use in memory map. The command i use is

osmfilter spain.o5m --keep-tags="city" --keep-tags="town"-o=mycity.osm

The program runs, seems to be working but then keeps returning osmfilter error : write error

I've searched using google and one other person has asked about this error but no answer was given.

asked 05 Jan '14, 12:45

daveasbury's gravatar image

daveasbury
16111
accept rate: 0%

edited 05 Jan '14, 13:29

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
82.5k927201273


You have misunderstood the --keep-tags option. It does not actually filter the objects - it just decides which tags to copy over to the output. This means that your command will include all input objects in the output (instead of just cities and towns).

The write error is likely a consequence of this misunderstanding; your command results in a file of about 9 GB and it is possible that you are either out of disk space, or even using a file system that cannot handle files that large.

What you want is:

osmfilter spain.o5m --keep-nodes="place=city =town" --keep-ways= --keep-relations= -o=mycity.osm
permanent link

answered 05 Jan '14, 13:28

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
82.5k927201273
accept rate: 23%

Thanks for the reply. I've sorted the write error. You are correct about the filtering. So is it possible to filter in the form - copy one town and cities?

I've tried various examples but none seem to do what i'm after

(05 Jan '14, 14:37) daveasbury
1

so you want to limit your result to a smaller area?

If yes, can you define that area via a boundingbox or a boundary relation from the OSM data? like http://www.openstreetmap.org/relation/2417889 ?

(06 Jan '14, 16:26) stephan75

Nope.

What I am attempting is to take the file spain-latest.osm.pbf which i obtained, and extract all the towns and cities contained within it as well as their lat and long. This data would be ouput to a csv file in the form

Example

Barcelona 28.00023 3.34568

benidorm 28.00034 3.90987

this I would hope to import into the program memory map navigator to create a town look up gazeteer.

(06 Jan '14, 19:52) daveasbury

The command in the grey box at the end of my original reply does just that (it doesn't give you a CSV but an OSM file with only towns and cities).

(07 Jan '14, 09:48) Frederik Ramm ♦
2

... and then use http://wiki.openstreetmap.org/wiki/Osmconvert to convert your OSM file to a CSV file where you determine yourself what elements should be in the output file.

Read that documentation in the OSM wiki and try several tags.

(07 Jan '14, 16:51) stephan75
2

Thanks folks! finally sorted thanks to your replies using osmfilter spain.o5m --keep-nodes="place=city =town =village =hamlet =suburb =province" --keep-ways= --keep-relations= >mycity.osm

and

osmconvert mycity.osm --csv="name place province @lat @lon" -o=somefilename.csv

this i imported into memorymap to work with my Mobac maps and it works!

(07 Jan '14, 19:58) daveasbury
showing 5 of 6 show 1 more comments
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:

×293
×205
×66
×60

question asked: 05 Jan '14, 12:45

question was seen: 11,555 times

last updated: 08 Jan '14, 22:36

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum