[OSM-talk] JOSM to display downloaded area

Frederik Ramm frederik at remote.org
Thu May 24 22:23:52 BST 2007


Hi,

    since the 0.4 API will often return more (in terms of area covered) 
than you asked for, there's a potential for dangerous edits. The API 
will return any way intersecting with your bounding box with all its 
segments and nodes, even outside the bounding box; however, other 
elements using these segments/nodes outside the bounding box are not 
included. (Nor is it desirable to include them - the API would become 
very slow, and once we have a dense interconnected network, a small 
bounding box will download the whole planet!)

This means that if you (re)move items that are not inside the area you 
originally downloaded, you may inadvertently change or even break other 
ways/segments that you don't see and that use the nodes or segment you 
change.

A good solution for this problem would be something like this:

* store downloaded area with every download
* also store "source area" in the file if data is saved, and read back 
from file when loading
* downloaded area may consist of a number of polygons (if you repeatedly 
download small sections - intersecting rectangles merge into one 
polygon, disjunct rectangles give separate polygons)
* area outside the downloaded area should be shaded somehow, and maybe 
edits in such an area should be forbidden outright?

This is more or less reflected in ticket #149 in the JOSM trac.

I don't have a lot of time ATM but to fix the worst, I have added the 
capability to show the bounds of the downloaded area(s) as rectangle(s). 
You can switch that feature on in the drawing preferences dialog, and of 
course the colour of the rectangle is selectable as well. That will at 
least give you an indication of whether you're editing inside a safe 
area or not.

The change should be in josm-latest.jar from tomorrow (Friday) morning. 
I have not tested this change together with the mappaint plugin - it 
will not break anything but depending on how mappaint operates the 
rectangles may not show (please give feedback).

Anyone with time on their hands is of course welcome to have a go at 
improving this, i.e. saving downloaded areas to files, shading areas, 
etc. - internally you'll see that I have added a collection of 
DataSource objects to the main dataset, and anytime you add data from a 
file or from the server, the DataSource collection gets an extra element 
reflecting the new source.

Bye
Frederik

-- 
Frederik Ramm  ##  eMail frederik at remote.org  ##  N49°00.09' E008°23.33'




More information about the talk mailing list