JOSM Advanced editing
Saving and loading. osm files
For most purposes you’ll probably want to stick with downloading data and uploading your changes. When you upload your changes you have effectively “saved” your changes. Better than that, you’ve made your changes available for other people to see on the map, and to to make further changes to. OpenStreetMap is all about internet collaboration! However JOSM can also work with files on your local filesystem, saving and opening files to/from your local disk. This works much like any other normal desktop application.
Use ‘file’ menu > ‘Save As…’ to save data (and your changes) to a file.
Use ‘file’ menu > ‘Open…’ to open a previously saved file for editing or uploading.
The JOSM file format is an XML representation OpenStreetMap data in the standard. osm format. JOSM extends this slightly to store details of changes to OpenStreetMap data, that is, any changes which were not uploaded already at the time when the file was saved. This is a powerful feature which means JOSM can be used as an offline editor as follows:
While you have an internet connection…
Download an area of the map (can be one or several bounding boxes)
Save the data as a. osm file on your local disk.
While you’re offline without an internet connection…
Open the file
Maybe open GPS traces and overlay them on the data (This can also work fine offline)
Make changes e. g. add local information you have captured while out surveying
Save changes back to file. The file includes information about all your changes including moving and deleting data.
When you’re back to an internet connection…
Open the file from your disk into JOSM
Do “File” menu > “Update Data” to re-download the areas you worked
on. Resolve any conflicts (see following section)
Click upload to save the changes to the OpenStreetMap server.
Editing Thematic Data
Some people like to care about specific data in order to allow thematic maps to be created. In this case it is better to load only the data you really need. This will enhance JOSM’s performance and display only that objects you want to see. To accomplish this, it is necessary to filter the downloaded file before you load it with JOSM. Here is one of the ways to do this:
Download the programs osmconvert and osmfilter. Afterwards, to get just railway lines in Switzerland for example, perform the following commands.
Osmconvert switzerland. osm. pbf – out-o5m >switzerland. o5m
Osmfilter switzerland. o5m – keep=”railway= route=train =rail” >swiss_railways. osm
Be careful when editing! Do not delete or even move nodes. You cannot be sure if they are used by other ways because you did not load all the data. Editing filtered data is an efficient way to care about specific tags or relations but you should not use this method to change the shape of any object.
While you are editing with JOSM, there’s a chance other people could be editing the same area of data at the same time. JOSM only downloads data when you ask it to, which means you can have quite long editing sessions without necessarily noticing potential clashes with other contributors. In general it’s a good idea to upload regularly if you are able to do so, to reduce the chance and also the impact of any conflicts. But it’s can also be a good idea to download prior to uploading. The download action does not overwrite your changes with data from the server.