JOSM/Plugins/WMSPlugin

From OpenStreetMap Wiki
< JOSM‎ | Plugins
Jump to: navigation, search


Available languages
Deutsch English italiano 日本語 русский

Using the WMS plugin with Yahoo! Aerial Imagery (with a downloader installed)
Using the WMS plugin to trace woodland areas over Landsat imagery (bottom left), and comparing road layouts with 1950s NPE maps (top right)
screenshot needs updating since the new WMS plugin does continuous tile downloading

The WMS Plugin provided functions which are now part of JOSM core. The plugin allowed you to fetch images from any WMS source, and display them as a background image (a layer) within JOSM. It also supported Yahoo! Aerial Imagery and Rectifier like Metacarta and Geothing to display rectified/warped images.

Now that imagery is a core feature, you can open WMS sources from the 'imagery' menu. There is no longer any need to install these features as a plugin. See also the help page in the JOSM Wiki.

Starting with JOSM version 3715, WMS functionality is part of JOSM itself. Users of older version of JOSM may still be using this plugin.

Installation

Download wmsplugin.jar or follow the general procedure: JOSM/Plugins#Installation. After successful installation, you should see a new WMS entry in your main JOSM menu. Try it out with Landsat

Tutorial video on basic WMS setup

The Yahoo option will not work until you perform steps of the next section.

Installing Yahoo! aerial imagery downloader

To use Yahoo! aerial imagery you will need to install a tool for interfacing with Yahoo to download tiles.

Windows

webkit-image

On Windows use the WebKit based downloader called webkit-image as follows

  • Download webkit-image.zip
  • Unzip it.
  • Move the contents so that the DLL files and the EXE file are somewhere "on your system path". The best way to achieve this might be to place them alongside josm-latest.jar Keep the 'imageformats' subfolder alongside too (so all the contents of the zip).
  • Restart JOSM
  • Do 'WMS' menu -> YAHOO (Webkit)

You should start to get Yahoo! imagery (may take up to 30 seconds to start showing). If not, it may not be finding the DLL files correctly.

Note: If you don't want to place webkit-image in your system path or the JOSM directory you don't have to. By editing the download program you can specify an absolute or relative path to the webkit-image executable. Examples:

  • webkit/webkit-image {0} - loads webkit-image.exe from the subdirectory webkit relative to the JOSM installation directory
  • D:/webkit/webkit-image {0} - uses webkit-image D:\webkit\webkit-image.exe

Linux kernel Operating Systems

On Linux you can use different downloaders: gnome-web-photo or webkit-image.

OpenSuSE, SuSE and SLES Distributions

release 11.3 (opensuse)
  • gnome-web-photo : this can be installed using yast
  • webkit-image : can be built for Qt if you have development tools installed. You will need to use yast to install:
  1. libQTWebKit4-devel and friends
  2. libqt4-devel and friends
  3. pkg-config
  4. other more general requirements depending on your build environment

then follow the instructions below for Build from Source

  • webkit-image-gtk : try instructions below for webkit-image (GTK+) after installing libwebkit (+friends) and gtk2-devel; you will need to edit an include line in webkit-image-gtk.c so that it points to gio-unix-2.0/gio and not just gio, it should read:
#include <gio-unix-2.0/gio/gunixoutputstream.h>

Although the tool should now compile it may not scale tiles correctly within JOSM; use one of the other tools instead

gnome-web-photo for Fedora and Ubuntu

gnome-web-photo is compiled and prepackaged for some distributions, including Fedora and Ubuntu.

Attention: You have to select gnome-web-photo --mode=photo --format=png {0} /dev/stdout at the preferences dialog of the wms plugin.

On Ubuntu 8.10 'Intrepid Ibex'
  1. Install gnome-web-photo through synaptic (version used 0.3-0ubuntu2)
  2. Select gnome-web-photo --mode=photo --format=png {0} /dev/stdout as the downloader at the bottom of the WMS preferences pane. Then you can choose the "Yahoo Sat" option from the WMS pull down menu to get the background to download. You might have to zoom out a bit if data is not available at the current zoom level.
On Ubuntu 9.04 'Jaunty Jackalope'

The gnome-web-photo package in Ubuntu 9.04 has introduced bugs with JOSM, resulting in mis-aligned and distorted WMS imagery. This can be rectified by installing an older version of gnome-web-photo.

While the common suggestion has been to compile and manually install gnome-web-photo, you can get away with installing the version from Ubuntu 8.10 instead.

  1. Uninstall any existing version of gnome-web-photo using Synaptic, or by issuing the following command on the command line: sudo apt-get remove gnome-web-photo
  2. Download an older version of gnome-web-photo from the Ubuntu Mirror.
    • gnome-web-photo_0.3-0ubuntu2_amd64.deb for 64 bit Ubuntu systems.
    • gnome-web-photo_0.3-0ubuntu2_i386.deb for 32 bit Ubuntu systems.
  3. Once the file has downloaded, double click it to install it to your system. If for some reason this doesn't work, you can install it from the command line using sudo dpkg -i gnome-web-photo_0.3-0ubuntu2_*.deb
    • Note, this may introduce problems when you upgrade to later versions of Ubuntu, so you may need to uninstall this package before you do so. You can do this by following the instructions in step one.
    • Every time you update your packages Ubuntu will attempt to update this package to the broken version. To stop this from happening add the following three lines to your /etc/apt/preferences (you may have to create this file)
      Package: gnome-web-photo
      Pin: version 0.3*
      Pin-Priority: 1001
    • This may introduce dependencies problems, the package requires libxul0d. Run the command sudo apt-get -f install and it should fix any problems.
  4. Select 'gnome-web-photo --mode=photo --format=png {0} /dev/stdout' as the downloader at the bottom of the WMS preferences pane. Then you can choose the "Yahoo Sat" option from the WMS pull down menu to get the background to download. You might have to zoom out a bit if data is not available at the current zoom level.
On Ubuntu 9.10 'Karmic Koala'

The gnome-web-photo package in Ubuntu 9.10 does not seem to download any data.
Repeat the steps listed above for 9.04 by installing the old version of the package and it works.

On Ubuntu 10.04 'Lucid Lynx'
  1. The gnome-web-photo((version used 0.8-0ubuntu2)) package in Ubuntu 10.04 does not seem to download any data.
On Ubuntu 10.04.1 'Lucid Lynx'
  1. Install the latest gnome-web-photo((version used 0.8-0ubuntu3)) package from Synaptic (or any other way you like).

And select 'gnome-web-photo --mode=photo --format=png {0} /dev/stdout' as the downloader at the bottom of the WMS preferences pane in JOSM.

  • Has this worked for you or are you only copy-pasting this info? logictheo 16:23, 26 September 2010 (BST)
  • I have tested the above and it worked for me. Cipt2001 11:31, 14 October 2010 (BST)
On Ubuntu 10.10 'maverick'
Troubleshooting: if you see white stripes
sudo cp gnome-web-photo-fixed /usr/local/bin
sudo chmod a+x /usr/local/bin/gnome-web-photo-fixed
  • install package netpbm
  • in JOSM -> Settings -> WMS, change "gnome-web-photo" to "gnome-web-photo-fixed" in the selection for download program.

webkit-image (QT)

WebKit has some flavors, the main ones are QT-WebKit and WebKit-GTK+. See below for the GTK+ version.

On Debian unstable/sid and testing/wheezy

If you installed josm with aptitude/apt-get you should get webkit-image-gtk installed automatically. If for some reason you don't have it, or it is not working correctly, you can install webkit-image-qt with the following command:

sudo aptitude install webkit-image-qt

If you have both webkit-image-qt and webkit-image-gtk installed and want to make sure that josm is using webkit-image-qt you can either:

sudo aptitude remove webkit-image-gtk

or

sudo update-alternatives --config webkit-image

or

go to the josm preferences, WMS tab and change "webkit-image {0}" to "webkit-image-qt {0}".

Building from Source
  • Install the following packages: build-essential libqt4-dev (>= 4.4.3[1][2]) libqt4-webkit pkg-config
  • Download and compile (you may have to replace moc with moc-qt4, or /usr/include/qt4 with /usr/lib/qt4/include):
wget http://svn.openstreetmap.org/applications/editors/josm/webgrabber/webkit-image.cpp
moc webkit-image.cpp > webkit-image.h
g++ -I /usr/include/qt4/ -I /usr/include/qt4/QtGui -I /usr/include/qt4/QtNetwork/ webkit-image.cpp -o webkit-image -lQtCore -lQtWebKit -lQtGui -s -O2
  • instead of the previous step, you can use the packaged Makefile:
svn co http://svn.openstreetmap.org/applications/editors/josm/webgrabber
cd wmsplugin
make webkit-image
  • Copy it to somewhere in your path:
sudo cp -v webkit-image /usr/local/bin/
[1] 4.2.1 from current Debian stable/etch is missing files, you'll absolutely need to compile. These files appear not before 4.4.3-1, that is in testing/lenny (checked in Ubuntu archives). You'll have to leave the "clean" state of our stable system to get the Debian testing or unstable package and it's dependencies. To do so, you'd like to add at least one line like
http://ftp.debian.org/debian/ testing main contrib non-free
into your /etc/apt/sources.list file, or you'll not be able to even see the needed packages. Think twice before allowing any upgrade of existing packages to a more recent testing or unstable version, however, you'll have no choice to get Yahoo imagery working again with current JOSM revisions ...
[2] Running aptitude I found following packages as mimimum additional install: libqt4-xml, libqt4-dbus, libqt4-script, libqt4-designer, libqt4-sql, libqt4-qt3support, libqt4-svg, libqt4-xmlpatterns, libqt4-help, libqt4-assistant, libqt4-test, qt4-qmake, libqt4-dev (all 4.4.3-1), but your experience may vary.
Experimental Debian and Ubuntu Packages

There are experimental debian and ubuntu packages fro webkit :

you add to your /etc/apt/source.list

 deb http://osm.komzpa.net/~mdupont/osm/ gjergi-osm main
 deb-src http://osm.komzpa.net/~mdupont/osm/ gjergi-osm main

and then :

 apt-get install webkitimageqt

see also : https://bugs.launchpad.net/ubuntu/+source/josm/+bug/509061 see also : http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=569040

  • one person succeeded installing it and making it work with Ubuntu 10.10 (as gnome-web-photo did not work)
  • one person succeeded installing it and making it work with Ubuntu 10.04
  • one person succeeded installing it and making it work with Trisquel 4.0
On Mandriva 2010.0
  • Prerequisites
urpmi webkitkde-devel libqt4-devel
urpmi subversion gcc-c++
  • Get the sources and compile
svn co http://svn.openstreetmap.org/applications/editors/josm/webgrabber
cd wmsplugin
make webkit-image
  • As root, copy it to somewhere in your path:
cp webkit-image /usr/local/bin/

Gentoo webkit-image ebuild

The following code is an ebuild that installs webkit-image (QT) on a Gentoo Linux computer. See this Linux Reviews article on how to install custom ebuilds. Using the path sci-geosciences/webkit-image/webkit-image-9999.ebuild to save the ebuild to within your local Portage overlay should work fine.

# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

inherit subversion

DESCRIPTION="JOSM tool to interface with Yahoo! imagery"
ESVN_REPO_URI="http://svn.openstreetmap.org/applications/editors/josm/webgrabber"
SRC_URI=""

KEYWORDS="x86"
LICENSE="GPL-2"
SLOT="0"
DEPEND="sci-geosciences/josm
	>=dev-qt/qtcore-4.4.3
	dev-qt/qtwebkit"

src_compile() {
	cd "${S}"
	make webkit-image || die 'Cannot make webkit-image'
}

src_install() {
	cd "${S}"
	dodir /usr /usr/bin

	into /usr

	dobin "${S}/webkit-image" || die 'Cannot install webkit-image'
}

webkit-image (GTK+)

It requires GTK+ 2.20+ and WebKitGtk+. Compile and install webkit-image-gtk.c.

Libraries required: libgtk2.0-dev libwebkit-dev.

To compile it, run: gcc -W -o webkit-image webkit-image-gtk.c `pkg-config --libs --cflags gtk+-2.0 webkit-1.0`

(note:it builds but fails with "image == null" errors on Mandriva Linux, whereas Qt version works, on Gentoo too)

success on the following Operating Systems

comments: Ubuntu 10.04: Compiling http://svn.openstreetmap.org/applications/editors/josm/webgrabber/webkit-image-gtk.c a success! Putting the resulting webkit-image(made executable) in the directory /usr/local/bin/ . Doesn't load any yahoo tiles and just says "Exception occured". Once it showed some tiles but they covered tiny rectangles while everything else was "Exception occured".

Mac OS X

Prerequisites

Installation

Download Intel-only binary from http://www.lassitu.de/osm/webkit-image-r13262-qt-4.5-osx10.5.6.zip (MD5 checksum ecf2e2f044ce259af702247729468be1)

Download PPC-only binary from http://westpol.dnsalias.org/webkit-image-r16071-qt-4.5-osx10.5.7.zip (MD5 checksum 2d00c2dbb1222b0293f7eaeccb1d5e8c)

Or compile from source:

1. Use svn to check out the wmsplugin from http://svn.openstreetmap.org/applications/editors/josm/webgrabber

$ svn co http://svn.openstreetmap.org/applications/editors/josm/webgrabber

2. In the Makefile, change the LDFLAGS line to read:

LDFLAGS=-framework QtCore -framework QtGui -framework QtWebKit -framework QtNetwork

3. Build the program with make:

$ make

if it fails with webkit-image.h:15:2: error: #error "(The moc has changed too much.)" update the header files with

$ moc webkit-image.cpp > webkit-image.h

4. Copy the webkit-image program to a directory that is part of the PATH. If you're not sure which directory to use, try this:

$ sudo mkdir -p /usr/local/bin
$ sudo cp webkit-image /usr/local/bin
Unix programs (and Mac OS X) look for programs to execute in a list of directories. This search list is kept in the PATH environment variable. By default, PATH is set to /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin. To check the current value of the PATH environment variable, use echo $PATH. You can copy the webkit-image program to any of the directories listed in PATH, and JOSM and the wmsplugin will automatically find them.

Configuration

Since July 2009, no further configuration is necessary. If you've installed webkit-image in a directory not in the PATH, you need to modify the path given in the Downloader text box at the botton of the wemplugin preferences page.

FreeBSD

If you have JOSM installed from ports collection, then you already got webkit-image (QT) compiled and installed, and Yahoo imagery will work out of the box.

Source

You can get source of the WMS plugin from Subversion:

svn co http://svn.openstreetmap.org/applications/editors/josm/webgrabber

Using the WMS plugin

  • Load / Download openstreetmap data and go to your favourite area
  • Show the 'Layers' panel if it isn't showing already (Click the toggle button: Liste aller Ebenen.png)
  • Click the menu option "WMS → Landsat" (or whatever named WMS server you want to use) This should cause it to create a new imagery layer.
  • Wait a few moments for it to begin fetching image tiles.

As you pan around it will download more tiles. It also seems to remove tiles which are out of viewing area, to free up memory.

To remove the imagery and stop all WMS downloading, select the layer and click the trash can button. You can also temporarily toggle visibility of the layer (keeps imagery in memory). Right click on the layer (in the layers panel) to access further WMS layer options.

When your WMS layer is selected, the data layer is shown as deselected (dark grey). Simply select your data layer again (often called 'unnamed') to restore normal colours. It is also possible to display the WMS layer "above" the data layer, which will hide the data layer completely. Use the up/down arrows to fix the ordering.

You can adjust the positioning of the imagery by clicking Adjust WMS-Layer.png button on the left. In this mode you can drag and drop the WMS layer. Press the button again to lock it in place. This can be useful if the imagery appears to be offset from reality, but note that your GPS unit isn't perfect. A bad GPS signal can cause an entire trace to have an offset from reality, so you may find it useful to check also by downloading other GPS traces recorded for the area.

You may need to adjust your map colours ('Edit' menu -> 'Preferences') to be darker or lighter, to contrast with the images you are using.

Basic troubleshooting

Things to try in case of problem.

no image appears, even after waiting a bit

  • adjust zoom level so that the scale in the top left says ~150m, delete the layer (trash can icon), add it again from the menu.
  • The plugin may not find the DLL files. Check you have placed all of the webkit-image zip file contents them somewhere on the system path.

images at bad resolution from Yahoo

  • adjust zoom level as decribed above. Note that in most regions Yahoo imagery has a lesser resolution than Google Maps.

Exception occurred red tiles

  • This can mean the WMS server is temporarily not available. Landsat and OpenAerialMap seem to be prone to periods of non-availability. Delete the WMS layer and try again 10 minutes later.

error : bad parameters red tiles

  • Check that configuration -> projection is set to EPSG:4326 or Mercator.

gray tiles

  • if you have non-ACSII symbols in the path to your plugin folder in Windows (e.g. cyrillic letters in your name in C:\Documents and Settings\your name\Application Data\JOSM\plugins), a possible solution is to change your name to an equivalent short filename. To find this open a command window and do
dir /x "C:\Documents and Settings"

In its output the column to the left of your name should contain short version of your name, let it be for example 9335~1. Add a line to the batch file starting JOSM:

rem   Contents of start_JOSM.cmd
set APPDATA=C:\Documents and Settings\9335~1\Application Data
start javaw -jar josm.jar

"Plugin requires JOSM update: wmsplugin" at JOSM startup

  • Update JOSM: see JOSM to last tested version.
  • If the message still appears, the problem is on your side - you have a newer version plugin version than your josm can hande. Go to the plugin preferences page and update there. This should install the last version which is usable in your josm (when necessary does a downgrade of the plugin).

For other troubleshooting you can ask a bunch of JOSM users via various Contact channels. Bugs are tracked on josm trac 'Plugin WMS' component

Caching

To reuse the tiles over JOSM sessions without having the reload them from the server, right click on the WMS layer and set a bookmark. During the next session, select the new WMS created by the bookmark in the WMS memu. Additionally, you may want to modify the following values in the preferences :

  • cache.wmsplugin.expire -1 : this is a time in second until the tiles are invalidated. -1 means "never flush".
  • cache.wmsplugin.maxsize 999999999 : maximal size of the cache (probably in MB)

Even though you have to download an area "manually", you can work offline using this technique.

Using a "Rectified Image"

Do not use copyrighted material, unless you have the right/permission to do so (see the Licensing section below)!

Before you start with your own images, it might be a good idea to start with Landsat data so you'll learn how to work with these downloaded images.

To work with your own images in JOSM:

  • upload your aerial image / scanned old map to either
  • rectify it on their site so it "fits with reality"
  • XXX - wait for the image to be processed?
  • remember the metacarta id (look at the URL in your browser)
  • in JOSM, load some openstreetmap data of the expected image area (to be in the right "clipping range")
  • click on WMS -> Rectified Image and enter the id in the upcoming dialog

If the "clipping range" was wrong, you might see just nothing. In this case zoom out and retry the download.

Adding a WMS Server

Do not use copyrighted material, unless you have the right/permission to do so (see the Licensing section below)!

To add a new WMS Server, use the Menu: 'Edit' menu -> 'Preferences' and click on the WMS tab. Now you can add / remove WMS server URL's.

A WMS server typically can provide different projections, subsets of data, etc., so you may need to experiment with the URL settings to get the best results.

Adding presets for objects and source=yahoo_wms

It can be useful to let other users know what your data is based on by adding source=yahoo_wms. This can be quickly done by creating a JOSM tagging preset for roads, woodland, etc and source=yahoo_wms.

Once this is setup, it is simple to apply custom combinations of tags to an node, way or area in JOSM:

  • Download the Yahoo-road.png Yahoo road icon.
  • Open your favourite text editor and insert the following:
<annotations>
  <item name="road-source" icon="[PATH TO ICON]\Yahoo-road.png">
      <key key="source" value="yahoo_wms" />
      <key key="highway" value="road" />
  </item>
</annotations>
  • Save it as yahoo-presets.xml
  • Open JOSM
  • Open the Preferences, go to the Map Settings (3rd tab)
  • Add your file at the "Tagging Preset Sources"
  • Restart JOSM
  • If you want, you can put the preset in your toolbar for quick access (Preferences, Toolbar customization)
  • You might also want presets for things like Yahoo-farm.png landuse=farm and/or Yahoo-stream.png waterway=stream
  • Download the above icons and add new <item> entries to your yahoo-presets.xml file
  • Contact User:LeedsTracker if you want any more icons made --LeedsTracker 17:04, 28 February 2009 (UTC)

Remote control

Since version 22677 the WMSPlugin will register an additional remote control command "wms" if the RemoteControl plugin version 22675 or newer is loaded.

The "wms" command instructs JOSM to open a WMS layer in the same way as with the "rectified image" menu command.

 GET /wms?title=foobar&urldecode=false&url=...

where

parameter required/

optional

meaning
url R WMS URL in the usual format. This must be the last parameter.
title O Title (name) of WMS layer. If not specified the title will be "remote WMS".
urldecode O Disable URL-decoding of URL value if true. All other values will be URL-decoded anyway.
cookies O Can be used to specify cookies for the WMS request.

Note: The "url" parameter must be the last one. Everything after url= will be used as the WMS URL. It is not mandatory to URL-encode the value, but the WMSPlugin will try to URL-decode it unless urldecode=false is specified. If you notice that the decoding modifies the URL in an unwanted way, add "urldecode=false" before the "url" parameter.

This remote control function can be disabled by setting preferences value

 wmsplugin.remotecontrol=false

or by using the checkbox "Allow remote control (reqires remotecontrol plugin)" in the preferences editor.

Licensing

Warning.png
You MUST NOT trace over maps, aerial photography, or satellite images from any source, unless the images are public domain, or otherwise compatible with our OpenStreetMap License.

Tracing over an image is generally regarded to be creating a derivative work of the underlying image. This is also the case for aerial photographs as well as for (more clearly copyrighted) finished maps. If the images are copyrighted, or if you are unsure of the copyright status of the images, from a particular source, then you must not use those images for tracing/correcting maps for OpenStreetMap.

Sources you can use
  • NASA Landsat - Public Domain low resolution satellite imagery. Worldwide coverage, but generally too low-res for tracing roads or other such details.
  • Bing Aerial Imagery - Special Permission - We have been given special permission to derive our vector map data.
  • Yahoo! Aerial Imagery - For a long time we've been allowed to derive our vector map data from Yahoo. It requires a special downloader component. Installation described above.
  • De:DOP Sources - List of DOP sources for Germany and their status of permission to use in OSM
  • New Jersey 2007 aerial photography. Only available within and slightly overlapping the borders of New Jersey. There are no restrictions on its use.
  • OpenAerialMap: This is currently offline, but if/when this project is resuscitated it provides open aerial imagery compiled from many sources/imagery donations.
  • WikiProject_Italy/PCN: Covering all of Italy with good ortho-rectification and far better resolution than Yahoo (please don't trace from Yahoo in Italy for this reason, as there is a big offset)

See WMS sources for more information.

Sources you can't use
  • Google map tiles - Copyrighted!
  • Google aerial imagery - Copyrighted!
  • Bing map tiles - Copyrighted! (we're only allowed to use the aerial imagery)
  • Yahoo map tiles - Copyrighted! (we're only allowed to use the aerial imagery)
  • Pretty much any other source which is not explicitly listed above