OpenStreetMap 标志 OpenStreetMap

The other week Development Seed posted some fresh new data for Jalisco, Mexico, together with instructions on how to use JOSM to get it into OpenStreetMap.

Of course, like most good things, it’s much easier and shinier to do it in Potlatch. At which point you might ask “What? You can open .osm files in Potlatch?”. Yes, you can, and here’s how you do it.

First of all, go to https://github.com/mapbox/osm-jalisco/downloads and grab the .osm files. Camino_2011 doesn’t download when I try it, but the other two are fine.

Now open Potlatch in the part of Mexico which you want to edit. Here’s a handy link.

Go to the “Background” menu, and click “Vector file…”:

The background menu

At the bottom, select “OSM”, then “File: Open…” to load your .osm file. Do this for each one:

Adding a new layer

You’ll see them appear as layers in the list. By default they’re shown in ‘Potlatch’ style, which means they look the same as the rest of the map. You can choose any currently-loaded stylesheet to show them in, but I like to use ‘GPS’, which displays them as a clear cyan line:

Setting the style

Close the window and go back to the map. Look! Your .osm file is being displayed!

It’s being shown as a background layer. In other words, it won’t be uploaded next time you save. (Because unthinking imports are bad, right kids?) So to add it to the map, you need to pull it through from the background layer to the main map.

Couldn’t be easier. Just alt-click. (Or, if you’re using a Linux system that reserves alt for its own nefarious purposes, shift-control-click.)

Et voila

And that really is all there is to it.

Even more awesome

This is just scratching the surface, but there’s lots more you can do with vector background layers. Basically, Potlatch does the hard work of making data usable, so you don’t have to faff around with a bunch of preprocessing scripts.

You can open from local disc (like this) or fetch from the Internet. You can open .osm, .gpx, .kml or - yes - even shapefiles. (If loading from local disc, put the .shp, .dbf and .shx files in a .zip).

Wrong projection? No problem: P2 can reproject from OSGB or NAD83 (and we’re happy to add new projections if needs be).

Data too dense? Just enable the ‘Simplify’ button and Potlatch will run a Douglas-Peucker line simplification over it, at the strength you’ve specified in the Options dialogue.

And the cleverest thing of all: MapCSS-based tag transformations. You can supply a stylesheet-like text file that tells Potlatch how to map tags in the source data to OSM standards. Use MapCSS selectors as normal, and the special ‘set’ and ‘delete’ instructions to control the output. It’s best expressed through an example, so here’s one I used for OS VectorMap District data.

电子邮件图标 Bluesky图标 Facebook图标 LinkedIn图标 Mastodon图标 Telegram图标 X图标

讨论

Mele Sax-Barnett2012年05月25日 17:29 的评论

Richard, this is great! I will definitely be sharing this strategy with GIS folks I meet all the time that are interested in putting public/open data into OSM.

aseerel4c262013年01月26日 18:22 的评论

Thanks Richard! I have linked this page at osm.wiki/Potlatch_2#How_to_use_Potlatch_2

net-buoy2017年07月12日 20:02 的评论

I tried to use your method to upload some .shp files, and they will not upload using the shapefile radio button either as NADS or as WGS84. They do appear in the menu if I select them as GPX files… but then they do not appear in the background at all.

net-buoy2017年07月12日 20:07 的评论

by the way, I can import the shape files into JOSM, but the difficulty in getting JOSM to work through firewalls etc make it a hassle to use. However, JOSM can save the imported shape files as a wsm file… but there appears no way to use the wsm file as a background in Potlatch.

Richard2017年07月13日 08:00 的评论

Do you have a link to the shapefiles?

dpsspatial2018年02月 1日 19:01 的评论

Richard, this is great!

dpsspatial2018年02月 1日 19:20 的评论

Actually - now seeing the Potlatch took all the columns from the imported data, which I wasn’t aware it was doing. Will have to go in and clean this up, if possible…

登录以留下评论