Walking Papers Plugin broken

View: New views
6 Messages — Rating Filter:   Alert me  

Walking Papers Plugin broken

by Frederik Ramm :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

    I'm investigating this bug:

http://josm.openstreetmap.de/ticket/3855

The Walking Papers plugin is based on the old Slippy Map plugin, and the
code that leads to this bug roughly does this:

public void paint(Graphics g, MapView mv) {

LatLon topLeft = mv.getLatLon(0, 0);
LatLon botRight = mv.getLatLon(mv.getWidth(), mv.getHeight());

viewportMinX = lonToTileX(topLeft.lon());
viewportMaxX = lonToTileX(botRight.lon());
viewportMinY = latToTileY(topLeft.lat());
viewportMaxY = latToTileY(botRight.lat());

for (int x = viewportMinX-1; x <= viewportMaxX; x++) {
   for (int y = viewportMinY-1; y <= viewportMaxY; y++) {
     WalkingPapersKey key = new WalkingPapersKey(currentZoomLevel, x, y);

That's where it arrives at ridiculous values like 2147483647 for x and
-104914 for y.

Before I delve further into this - is this perhaps a consequence of
Dirk's recent change in the projection stuff? Is there an easy
workaround, or should I perhaps re-write the whole plugin based on the
*new* Slippy Map code which (I hear) is totally different?

Bye
Frederik

_______________________________________________
josm-dev mailing list
josm-dev@...
http://lists.openstreetmap.org/listinfo/josm-dev

Re: Walking Papers Plugin broken

by Ævar Arnfjörð Bjarmason :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, Nov 6, 2009 at 3:14 PM, Frederik Ramm <frederik@...> wrote:
> Hi,
>
>    I'm investigating this bug:
>
> http://josm.openstreetmap.de/ticket/3855
>
> The Walking Papers plugin is based on the old Slippy Map plugin, and the
> code that leads to this bug roughly does this:

Just as a note I filed 3 bugs in the tracker today:

 http://josm.openstreetmap.de/ticket/3854
 http://josm.openstreetmap.de/ticket/3855
 http://josm.openstreetmap.de/ticket/3856

What prompted this was that the guy who's doing the Kibera mapping
project asked about this on #osm. Map Kibera is a project to map a
slum in Kenya:

http://mapkibera.org/

They're starting on Monday and are planning to use JOSM/walkingpapers
so it would be really nice if people with the know-how to fix this
could look at what's causing those bugs & fix them.

_______________________________________________
josm-dev mailing list
josm-dev@...
http://lists.openstreetmap.org/listinfo/josm-dev

Re: Walking Papers Plugin broken

by Dave Hansen-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, 2009-11-06 at 16:14 +0100, Frederik Ramm wrote:

> Hi,
>
>     I'm investigating this bug:
>
> http://josm.openstreetmap.de/ticket/3855
>
> The Walking Papers plugin is based on the old Slippy Map plugin, and the
> code that leads to this bug roughly does this:
>
> public void paint(Graphics g, MapView mv) {
>
> LatLon topLeft = mv.getLatLon(0, 0);
> LatLon botRight = mv.getLatLon(mv.getWidth(), mv.getHeight());
>
> viewportMinX = lonToTileX(topLeft.lon());
> viewportMaxX = lonToTileX(botRight.lon());
> viewportMinY = latToTileY(topLeft.lat());
> viewportMaxY = latToTileY(botRight.lat());
>
> for (int x = viewportMinX-1; x <= viewportMaxX; x++) {
>    for (int y = viewportMinY-1; y <= viewportMaxY; y++) {
>      WalkingPapersKey key = new WalkingPapersKey(currentZoomLevel, x, y);
>
> That's where it arrives at ridiculous values like 2147483647 for x and
> -104914 for y.

I've never actually seen that particular bug.  However, there were a
bunch of issues with boundaries and limits, especially when zooming
around or being at the edges of the map.

The autozooming can also go postal sometimes.

> Before I delve further into this - is this perhaps a consequence of
> Dirk's recent change in the projection stuff? Is there an easy
> workaround, or should I perhaps re-write the whole plugin based on the
> *new* Slippy Map code which (I hear) is totally different?

It's not too totally different.  It's been pretty incremental actually.
The code that was copied has a few of my changes, but not the recent
stuff.

The recent changes use the JMapViewer code for tile storage, management,
and caching.  It makes things a lot faster and lets us potentially share
a tile cache with the slippy_map_chooser.

The layer code for WalkingPapers is still awfully close to the slippymap
layer.  My suggestion would be to go make a new TileSource and just try
to hack it in to the current slippymap.  I do believe the new code is
much nicer than what was there before and it should be easier to work
with.

You can either instantiate one of these classes:

    public static class Custom extends OsmTileSource.AbstractOsmTileSource {
        public Custom(String name, String url) {
            super(name, url);
        }
        public Custom(String name, String url, String extension) {
            super(name, url);
            this.extension = extension;
        }
        String extension;
        @Override
        public String getExtension() {
            if (extension == null)
                return super.getExtension();
            return extension;
        }
        public TileUpdate getTileUpdate() {
            return TileUpdate.IfNoneMatch;
        }
    }

or just override the getURL() from OsmTileSource.

-- Dave


_______________________________________________
josm-dev mailing list
josm-dev@...
http://lists.openstreetmap.org/listinfo/josm-dev

Re: Walking Papers Plugin broken

by Dave Hansen-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, 2009-11-06 at 15:20 +0000, Ævar Arnfjörð Bjarmason wrote:
> They're starting on Monday and are planning to use JOSM/walkingpapers
> so it would be really nice if people with the know-how to fix this
> could look at what's causing those bugs & fix them.

I didn't even know this plugin existed!  I'll be happy to look into
merging it with the existing SlippyMapPlugin, but it's going to take
some time unfortunately.

-- Dave


_______________________________________________
josm-dev mailing list
josm-dev@...
http://lists.openstreetmap.org/listinfo/josm-dev

Re: Walking Papers Plugin broken

by Dave Hansen-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, 2009-11-06 at 16:14 +0100, Frederik Ramm wrote:
> Hi,
>
>     I'm investigating this bug:
>
> http://josm.openstreetmap.de/ticket/3855

topLeft.lon(): -Infinity
topLeft.lat(): 90.0
botRight.lon(): Infinity
botRight.lat(): -90.0

The NavigableComponent is returning garbage.


_______________________________________________
josm-dev mailing list
josm-dev@...
http://lists.openstreetmap.org/listinfo/josm-dev

Re: Walking Papers Plugin broken

by Dave Hansen-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, 2009-11-06 at 15:20 +0000, Ævar Arnfjörð Bjarmason wrote:
> Just as a note I filed 3 bugs in the tracker today:
>
>  http://josm.openstreetmap.de/ticket/3854
>  http://josm.openstreetmap.de/ticket/3855
>  http://josm.openstreetmap.de/ticket/3856
>
> What prompted this was that the guy who's doing the Kibera mapping
> project asked about this on #osm. Map Kibera is a project to map a
> slum in Kenya:

I've fixed these, or at least worked around them enough to make it
usable.  Try the current SVN code, please.

Longer-term we need to work on consolidating that plugin with the
slippymap one.

-- Dave


_______________________________________________
josm-dev mailing list
josm-dev@...
http://lists.openstreetmap.org/listinfo/josm-dev