OS 2.0 Mapnik layer shifting

162 views
Skip to first unread message

edouard

unread,
Jan 9, 2012, 3:55:27 PM1/9/12
to openscales-dev
Hi,

It seems that in low resolutions (high levels of zoom so that houses/
streets are clearly visible), Mapnik layer tends to "shift" a little
when changing resolution.

The problem is visible in the "Global examples/Legal Information
Examples" from the demo for instance. There are levels of zoom in
which, when zooming in and out, the layer shifts. For example, It
occurs when the ScaleLine displays "1000m/500m" or "100m"...

I don't know if I made myself clear enough, but that problem didnt't
occur in version 1.2.1.

Regards,

--
Edouard


Maxime Viry

unread,
Jan 11, 2012, 4:18:07 AM1/11/12
to opensca...@googlegroups.com
Hi,

It's a known issue due to freeZoom with tiled layers.
We are working on it.

Regards,
Viry Maxime




--
Edouard


--
You received this message because you are subscribed to the Google Groups "openscales-dev" group.
To post to this group, send email to opensca...@googlegroups.com.
To unsubscribe from this group, send email to openscales-de...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/openscales-dev?hl=en.


Hermes David

unread,
Feb 3, 2012, 6:51:10 AM2/3/12
to opensca...@googlegroups.com
Hi,

I found how to fix the problem. the problem occurs as a consequence of 2 things:

   1) Wrong tile origin - the default value is Location(0,0, "EPSG:EPSG:4326"), but for OSM layers, it shoud be Location(-20037508.34, 20037508.34, "EPSG:900913")

   2) wrong min and max resolutions. - OSM layers should use as max resolution 156543.0339, but some code on FXLayer tries to reproject the default max resolution from "EPSG:EPSG:4326" to "EPSG:900913" generating diferent values and as consequence a minor shift on tiles, that intensifies as you zoom in and as you go more to west and south (farther  from tile origin). To fix this, just set the min and max resolutions to the correct values or simply override the methods to return resolutions[0] and resolutions[resolutions.lenght-1].

Regards,
Hermes David Junior

Ossi Rönnberg

unread,
Feb 8, 2012, 8:33:34 AM2/8/12
to openscales-dev
I'm having this issue... my VectorLayer is shifting as you zoom in or
out.
I tried these values, but it just makes Mapnik disappear completely.

Hermes David

unread,
Feb 9, 2012, 6:32:01 AM2/9/12
to openscales-dev
//this is my custom Mapnik class with the shift problem fixed.

package com.openscales
{
import org.openscales.core.basetypes.Resolution;
import org.openscales.core.layer.osm.OSM;
import org.openscales.geometry.basetypes.Bounds;
import org.openscales.geometry.basetypes.Location;
import org.openscales.geometry.basetypes.Pixel;

public class OSMapnik extends OSM
{

public function OSMapnik( name:String)
{
var url:String = "http://a.tile.openstreetmap.org/";
super(name, url);

this.altUrls = [ "http://b.tile.openstreetmap.org/",
"http://c.tile.openstreetmap.org/" ];
this.generateResolutions(18, OSM.DEFAULT_MAX_RESOLUTION);

this._tileOrigin = new Location(this.maxExtent.left,
this.maxExtent.top, this.projection);

}

override public function
getSupportedResolution(targetResolution:Resolution,
finest:Boolean=false):Resolution{
return super.getSupportedResolution(targetResolution, finest);
}

override public function get minResolution():Resolution{
return new Resolution(this.resolutions[resolutions.length-1],
this.projection)
}

override public function get maxResolution():Resolution{
return new Resolution(this.resolutions[0], this.projection);
}

}
}



//this is my custom FxMapnik, if you need to use

package com.openscales
{
import org.openscales.core.basetypes.Resolution;
import org.openscales.core.layer.osm.OSM;
import org.openscales.fx.layer.FxTMS;

public class FxOSMapnik extends FxTMS {
public function FxOSMapnik() {
super();
this.maxResolution = new Resolution(OSM.DEFAULT_MAX_RESOLUTION,
"EPSG:900913");
this.numZoomLevels = 18;

this._layer=new OSMapnik("");

Hermes David

unread,
Feb 9, 2012, 6:34:27 AM2/9/12
to openscales-dev
And dont forget to set the map projection to "EPSG:900913", since
layers only appear if the map is in the same projection

Ossi Rönnberg

unread,
Feb 9, 2012, 7:54:07 AM2/9/12
to openscales-dev
Nice, that did the trick!
I don't know what I tried wrong.

Hermes David

unread,
Feb 9, 2012, 8:51:34 AM2/9/12
to openscales-dev
It works better if you skip broken zoom levels by setting

map.defaultZoomInFactor = 0.5;
map.defaultZoomOutFactor = 2;

Ossi Rönnberg

unread,
Mar 8, 2012, 8:06:07 AM3/8/12
to opensca...@googlegroups.com
http://www.youtube.com/watch?v=LJFXHJDqd8c 

There is still strange difference between AIR and EMBED versions.

diego

unread,
Jan 2, 2013, 5:36:01 AM1/2/13
to opensca...@googlegroups.com
Hi guys. I need Mapnik to be in EPSG:4326, but I'm not being able to do it. What would be the best way to accomplsh this? And I have the same issue with Bing.

Regards,

Diego
Reply all
Reply to author
Forward
0 new messages