After some time figuring out how Openscales works with "features" (POI = Point of Interest) I keep having issues with the positions of these features after zooming in or out.
To zoom I use
map.zoomIn(); OR map.zoomOut();
and below you can see the code
const MERCATOR_PROJECTION:String = "EPSG:900913";
const NORMAL_PROJECTION:String = "EPSG:4326";
//create map
map = new Map();
map.size = new Size(1200, 700);
map.projection = MERCATOR_PROJECTION;
map.backTileColor = Palette.MAP_BACKGROUND;
map.defaultZoomInFactor = 0.5;
map.defaultZoomOutFactor = 2;
map.restrictedExtent = new Bounds(541000,6865000,548000,6870000,MERCATOR_PROJECTION);
//add geo-layer
mapLayer = new Mapnik('Mapnik');
mapLayer.displayedName = 'base';
mapLayer.projection = MERCATOR_PROJECTION;
mapLayer.generateResolutions(18, OSM.DEFAULT_MAX_RESOLUTION);
mapLayer.buffer = 1;
map.addLayer(mapLayer);
//define borders of zooming
map.maxResolution = new Resolution(mapLayer.resolutions[0],mapLayer.projection);
map.minResolution = new Resolution(mapLayer.resolutions[mapLayer.resolutions.length-1],mapLayer.projection);
//some controls
var mp:MousePosition = new MousePosition(new Pixel(0,0));
mp.displayProjection = MERCATOR_PROJECTION;
mp.prefix = 'Current: ';
mp.x = 250;
mp.y = 10;
map.addControl(mp);
map.addControl(new DragHandler());
map.addControl(new WheelHandler());
addChild(map);
//create the markers
markers = new VectorLayer("markerLayer");
markers.projection = MERCATOR_PROJECTION;
markers.generateResolutions(17, OSM.DEFAULT_MAX_RESOLUTION);
markers.style = Style.getDefaultPointStyle();
//add the first marker
var loca:Location = new Location(4.905,52.371,NORMAL_PROJECTION);
loca = loca.reprojectTo(new ProjProjection(MERCATOR_PROJECTION));]
var marker:PointFeature = PointFeature.createPointFeature(loca,null,Style.getDefaultCircleStyle());
markers.addFeature(marker);
//add a second marker
loca = new Location(4.902,52.37,NORMAL_PROJECTION);
loca = loca.reprojectTo(new ProjProjection(MERCATOR_PROJECTION));
marker = PointFeature.createPointFeature(loca);
markers.addFeature(marker);
//add marker with different symbol
loca = new Location(4.9,52.37149,NORMAL_PROJECTION);
loca = loca.reprojectTo(new ProjProjection(MERCATOR_PROJECTION));
var mark:CustomMarker = CustomMarker.createUrlBasedMarker("add_placemark.png",loca);
markers.addFeature(mark);
//add features-layer to map
map.addLayer(markers);
It looks like that the current resolution does not match any of the generated resolutions and therefore some kind of miscalculation forces the "features" to "move" around after zooming.
I have tried many "solutions" I found at this group but I have set the projections of the map, geo-layer and markers/features-layer to the same projection (MERCATOR).
I am really missing simple Openstreetmaps-example with "features" on top of it with a specific area to focus on (for example Amsterdam). This is really helpful to get a good insight how to move from Google Maps for Flash to Openscales.
Can anyone reproduce the "moving features"? And does anyone has an idea about what could be wrong? map.restrictedExtent? or something else? Would appreciate your help.