Logo Search packages:      
Sourcecode: josm-plugins version File versions  Download package

org::openstreetmap::josm::plugins::ywms::YWMSPlugin Class Reference

Inherits org::openstreetmap::josm::plugins::Plugin.

List of all members.

Detailed Description

YWMS server

Emulates a primitive WMS server (only GetMap requests) that serves Yahoo! satellite images.

This plugin is heavily based on Frederik Ramm <frederik@remote.org> YWMS server in perl (see http://lists.openstreetmap.org/pipermail/dev/2007-January/002814.html), so most of the calculations and documentation is taken from his code. However, this plugin does not need any X server to run, because of a Firefox feature that dumps all loaded pages to PPM files, activated through the environment variable MOZ_FORCE_PAINT_AFTER_ONLOAD, pointing to the directory and prefix of the generated image files.

For each incoming request:

This method can theoretically be used to display maps from any web site where the API supports selecting a geographic region AND includes a call to find out the region actually displayed.

This is required because most such services have discrete zoom levels, while the WMS request issued by josm expects to receive EXACTLY the coordinates requested in an image of the requested pixel size.

The HTML/Javscript used by this server uses the Yahoo! API to display an image depicting the selected area in the best available zoom level and then inquires about the area actually displayed, which will always be larger than what was requested. This information is then written to stdout using the "dump" Javascript command. From there it is read by this server, and used to stretch and cut the resulting browser image to the size requested in the WMS request.

To illustrate: <lu> josm says "I want the area (48.5,7.0)-(48.8,7.1) as a 1000x800 pixel image" we ask Yahoo about the best zoom level to display this area on 1000x800 and request the image we ask Yahoo about the extents actually displayed and receive the answer: (48.45,6.95)-(48.85,7.15) This is .4 degrees high (we requested .3 degrees high) and .2 degrees wide (we requested .1 wide). We scale the image to 1333x1600 and cut a 1000x800 section from the middle, knowing that this will now be exactly .3 degrees by .1 degrees (minus projection errors of course!) <lu>

Implementation note: <lu> Some information is passed from Javascript to Java, so Firefox must be configured with the method "dump" to work. To allow this method in firefox, create or modify the option "browser.dom.window.dump.enabled=true" in "about:config"

Also, as firefox must be started and killed once and again, it is recommended to create a profile with the option "browser.sessionstore.resume_from_crash" to false and set other profile to default, so no nag screens are shown. </lu>

Francisco R. Santos <frsantos@gmail.com>

Frederik Ramm <frederik@remote.org>

0.2 03/10/2007

Definition at line 76 of file YWMSPlugin.java.

Public Member Functions

PreferenceSetting getPreferenceSetting ()
void restartServer ()
 YWMSPlugin ()

Static Package Attributes

static HTTPServer server

The documentation for this class was generated from the following file:

Generated by  Doxygen 1.6.0   Back to index