OpenStreetMaps, often shortened as OSM, is a public map, maintained by a worldwide community. I recently had the honour of talking to someone who does OSM mapping. OSM mapping is something I’ve been interested in for a while now and even though I don’t want to get involved with it too much, it seems nice to be able to contribute when I feel something is missing, or to gather missing information as an activity during walks. The person in question helped me get started with OSM mapping, so here is a rundown of what I’ve learned so far in the hopes it may help you get started as well!
Let’s start with how OSM represents things. In OSM things are represented as an Object, also called Elements. Objects have properties and OSM has three types of objects. There’s a Point, a Line and a Relation. We’ll start with looking at Points. A Point, also called a Node, is just a point on the map with some properties. Let’s take an example, https://www.openstreetmap.org/node/6818148554. In the url we already see the number 6818148554. This is the unique identifier of this Node. When we open the url, we see different properties.
We see that the node has a name, location, tags and there’s also history of the node. In the example we see that this is the first version of the node and it was added almost two years ago. A lot of information can be added with tags. One tag is the amenity tag and is used here to say that this location is a bar. The amenity tag can be used for all kinds of stuff and the OSM wiki has a whole page on it. Tags are really just key-value pairs and the keys must be unique. There are ways around it if you need multiple values for a tag, but we’ll not go deeper into them here since that’s out of scope for purpose of this article. The fact that they are unique means that you can only choose one amenity. Even though the amenity tag looks like a very general tag, you can’t just use it for everything. A bar is marked with this, but a shop has it’s own tag. Because of this, you can mark a point as being both a bar and a shop. https://www.openstreetmap.org/node/9084064039 is an example of this.
We see that the amenity is filled in as cafe and shop is filled in as board_games. That makes this place both a (board game) shop, as well as a cafe. Note that in our previous example the amenity was not cafe, but bar. OSM makes a distinction between pub, cafe and bar. The distinction can be found on the amenity page of the OSM wiki. In this example we also see a lot of other tags the previous example didn’t have. We have a description, opening hours, email and more. That’s awesome! Once you have an example of what data can be added and how, you’re halfway there adding data yourself!
We saw that one node can have a lot of data, while another node may still be lacking much. One way to contribute is to go look for places that are still missing data. So how are we going to find that? Luckily there’s a big OSM community with people capable of building great tools.
One great tool is Overpass which allows you to query data in OSM. It has it’s own query language documented on the OSM wiki, but here we’re just gonna go over some fundamentals to help us find places to add data.
When we open the tool, we see some text on the left and a map on the right (see pick below). What we’re going to do is find the bars, pubs and cafe’s that don’t have opening hours filled in yet. In the tool you can click on Wizard and a pop-up will show. This wizard has it’s own, much simpler, query language. In the search bar you can type
amenity=bar and then press “build and run query”. This will show you all the bars on the map from the part of the map that’s visible. Cool huh! If you move the map or zoom out, the query won’t automatically run again, you have to press “Run” to rerun the query.
This isn’t much, so let’s do something a bit more challenging. Now we’ve only looked for bars, but we already know that there are also pubs and cafe’s and we want to find them too. You can find all of them by doing
amenity=bar | amenity=cafe | amenity=pub. The
| is an OR operator and means that you want all Objects that have any of the conditions you asked for. To look for all bars who have opening hours, we can use the AND operator
& and a wildcard
* for the opening hours
amenity=bar & opening_hours=*. To mix the OR and AND operators, it’s best to use brackets, and if you want to find the Objects that don’t contain opening_hours, you can use the NOT operator
! like so
(amenity=bar | amenity=cafe | amenity=pub) & opening_hours!=*. This query is already starting to get big and it’s possible that you’ll get a “time out” warning because it takes too long. If so, you can zoom in on the map to make the area to search smaller. One way to optimise the query is to use a regex. I’m not gonna go into the details of how regexes work, but the equivalent query is
amenity~"bar|cafe|pub" & opening_hours!=*. Note that you use a tilde
~ for regexes instead of an equals-sign and that you put the regex between double qoutes.
If you want to search in a city instead of the visible map, you can do that by using the
amenity~"bar|cafe|pub" & opening_hours!=* in Brugge. The last can be done because there’s an area defined as Brugge in OpenStreetMaps, but we haven’t talked about that yet. Btw, for the developers among you, if you want to have json data, there’s the Data tab for that on the right and the Help contains a link to the API documentation.
Another great tool made by someone in the OSM community is Mapcomplete. You can choose between themes to show different Points Of Interests (POI’s) on the map. It’s a very end-user friendly way of finding places. You can find bars, restaurants, shops, public toilets, drinking water, art works, and more. The tool also gives general information on the different points, like opening hours, how accessible it is for wheelchairs, and other things. When opening hours are filled in, it will even show on the icon whether the place is open or closed! The tool really gives a good end-user experience and is the kind of app you could give a casual user.
When you try out Mapcomplete, you’ll notice that you can get questions when certain information is missing. One easy way to contribute is to answer these questions. For that, you’ll need an OSM account, so go ahead, make one, and try it out!
When you want to do more specific or complex things, you can edit in OpenStreetMaps directly. Log in to OpenStreetMaps and click Edit. When we take our second example again, you see on the left that you can change information and that everything is represented in a user-friendly way. When you made useful changes, you can press the Save button. Then you’ll need to provide a short description of what you did and you can click Upload to publish your changes. Don’t do this just yet though, there are some catches to look out for.
Even though things are presented in a user-friendly way, it’s still very easy to make mistakes because things can sometimes be done in multiple ways, and good practices have grown over the years and may differ from location to location. You may notice that our examples don’t have the Postcode and City filled in. That’s normal and isn’t something you should fill in. As we saw earlier, it’s already defined that this area is Brugge. For that, another Object is used, namely a Relation.
The Relation Object
A relation is not something a beginner will really need, so we’re not going to go deeper into it, but one example is the city Brugge. Another use of relations is to show things like tram or bus routes.
The Line Object
The third and last object is the Line, or way. When we go back to our second example in Edit mode, we see that this cafe is located in a street called the Langestraat. When we click on the street, we that we select a part of that street. The street is represented with a Line, also referred to as a way. A way can be open or closed and is used to represent this that are more than just a point. Examples where lines are used are for streets and buildings. On the line we’ve currently selected, you can also see different points. These can be to tell OSM where a curvature happens, or to show where things like a cross points, traffic lights, crosswalks, or other useful things are.
If we check the properties, then at the bottom we see that this line is part of two relations. Both of these Relations are bus lines.
Let’s do something! On the top you can choose Point and then double click somewhere on the road. Don’t worry, as long as you don’t save, you’re not doing anything wrong. Now a new point will be added on the street and you can say what kind of point it is. If it’s a crosswalk, you can select that. There isn’t actually a crosswalk here, so we’re not going to save this. It does show you how a crosswalk can be added.
Lines can be open, like this example, or closed, like they are with buildings.
Tips and tricks
By now I’ve done some changes myself, so here are some tips based on my (limited) experience:
- There are different tools to add things to OpenStreetMaps. Use what you feel most comfortable with for the task at hand. Don’t be afraid to use different tools for different kind of changes. That’s why they are there.
- In general it’s probably better to use tools like Mapcomplete, because things aren’t always as straight forward in OpenStreetMaps. For example, if there’s a shop somewhere, and the house is already on OSM, but not the fact that it’s a shop. Is it better to add a separate point? Or better to add info to the line representing the house? These things are often open for interpretation and without clear rules. When adding to a building, you’re kind of implying that the whole building is a shop, but this may not always be true. Or there may be name collisions when a building has some historical significance and has it’s own name separate from the shop. With Mapcomplete, you don’t have to make such considerations, you always add a new point, which is a good practice.
- Another possible problem with editing in OpenStreetMaps is that tags are sometimes still present in drop downs, but not actively used any more. When editing things on OpenStreetMaps, always try to look for examples first and read the documentation on the tags you’re adding. And even then it’s possible that local customs are different than what’s on the general wiki. When you’re really unsure, or you think you made a mistake, you can always look for your local chapter and see what contact info they have. I’ve done that for Belgium and it already helped me out.
- Another tip is to look up a similar object that already has the type of information you want to add to another point. You can use OSM’s default search, use Overpass, or maybe you have a gps app based on OSM where you can find POI’s. Once you found an object with the needed info, you can add it to your object in a similar way. But again, when you’re really unsure, it’s probably better to ask first.
- It may take a couple of minutes before your changes are visible on OSM, but it shouldn’t take too long either. If you added something, but you don’t see it changing, it’s possible that your browser still has the old tiles cached. Best is to refresh the page using
ctrl+F5. You can also try to search for the thing you added through the search field. If it finds it, it means it’s added, even if it doesn’t show on the tile in your browser. Or you can try a new session in a private window and see if it shows there.
- If you want to do big changes, it may be better to ask first. Maybe it’s already possible to automate what you want to do, in which case it not really necessary to do things manually. You can still do some things manually, just to get the hang of it, but it may be better to put effort in things that aren’t easily automated.
- And most importantly, if you think you made a mistake, don’t panic! Just look up how to contact your local OSM chapter and ask them. Tell them what you think you did wrong, give them a link to the object where you did the changes, and ask what’s best to do. Even if you don’t think you’ve done anything wrong, it’s probably still a good idea to say hello to everyone. In my experience at least, people there are really nice and welcoming.
Even though there may be some pitfalls when editing OSM directly, there are some tools to make it much easier for you. Once you now what you want to map, it’s pretty easy to figure out what to do and where to ask help. Once you’ve done a couple of changes, you’ll soon feel comfortable with it, so give it a try! From personal experience I can say that seeing your changes on a map is feels pretty rewarding, and the community is really nice and helpful. Have fun mapping!