Marker Misalignment with Custom Zoomify Provider
I am using the custom zoomify provider to load a custom map in. Everything loads up correctly, but then I am having problems with the markers lining up.
The issue appears to firstly be with the provider and not the map as when I switch to a satellite map the markers are lining up and when I switch back to the custom map everything is messed up.
I do know that the custom map has the points plotted correctly, because I was using UMap for a while and everything aligned in there using the same points for the transformation and the markers plotted correctly there.
What is strange is how the markers are off, it does not appear that everything is off by a fixed amount, rather each marker is further from its correct location than the last.
I think that this has something to do with the provider and the transformation in the custom provider class, but I am unsure.
You can see the dev version of the maps here:
http://staging.digitalaugustanrome.org/
Anyone have any ideas what might be going on and any ideas on how to go about debugging? I am running out of ideas.
Thanks
The issue appears to firstly be with the provider and not the map as when I switch to a satellite map the markers are lining up and when I switch back to the custom map everything is messed up.
I do know that the custom map has the points plotted correctly, because I was using UMap for a while and everything aligned in there using the same points for the transformation and the markers plotted correctly there.
What is strange is how the markers are off, it does not appear that everything is off by a fixed amount, rather each marker is further from its correct location than the last.
I think that this has something to do with the provider and the transformation in the custom provider class, but I am unsure.
You can see the dev version of the maps here:
http://staging.digitalaugustanrome.org/
Anyone have any ideas what might be going on and any ideas on how to go about debugging? I am running out of ideas.
Thanks
1
person has this problem
I have this problem, too!
Tell me when someone solves it.
The more people who report this problem, the more it gets noticed.
The more people who report this problem, the more it gets noticed.
The company marked this problem solved.
Create a customer community for your own organization
Plans starting at $19/month
-
Inappropriate?What is the projection of the coordinates you use in your custom MapProvider?
-
Inappropriate?I am using a Mercator Projection
-
Inappropriate?Could be you need to use LinearProjection and set a different value to transform your CustomProvider.
-
Inappropriate?I tried that and the exact same think happened. Everything was off, and it was off in the exact same location. What is throwing me for a loop is that all of the markers are not off by some constant value, rather they are all different with some values greater than others.
-
Inappropriate?Hi Kieran,
I tried the demo site that you posted and switched back and forth between the map providers. Everything looked OK to me, but I'm not sure what I'm looking for. Can you provide some screenshots and maybe annotate where the problem is?
I think you're saying that switching providers (using map.setMapProvider) is causing the problem? Or maybe you're saying you're having trouble implementing a zoomify map provider with an accurate projection. Please clarify, I have some theories and I should be able to help. -
Inappropriate?

I have been trying to build in some compensation, so I am currently storing two sets of points so it appears to be working, but it is really still off. While this works I would really like to figure out a way to only have to use one set of accurate points.
In the attached screen shot, it is showing where the markers should be, but they are off. When I switch to the satellite map they are right on.
I think that the problem is that it is not projecting correctly, but I cannot say for certain. It seems that something in the transformation is off. The strangest part is (as you see in the screen shot) both markers are not off by the same amount. Marker 13 is above 14, but on the map it is below 13.
Does that help?
Thanks -
Inappropriate?I see. So it's not a problem with *switching* it's a problem with the projection of your custom map.
If it's upside down, that suggests that you measured pixels or coordinates from the bottom left of your image instead of the top left.
Can you post the values that you used in the Modest Maps calculator, and the Transform and Projection code from your zoomify provider? -
Inappropriate?Yeah, I am fairly certain that it is a problem with the projection. I used Photoshop to measure the points so the point of origin is the top left. Here are the values that I entered into the calculator:
Width: 9271, Height: 8894
1. Long/Lat: (41.910465, 12.461607), X/Y: (207, 922)
2. Long/Lat: (41.875519, 12.471178), X/Y: (1519, 8566)
3. Long/Lat: (41.882452, 12.514307), X/Y: (8601, 7232)
I removed the floor from the zoom so I am currently using the value: 13.178509245652181
This is the transform that I have:
transform = new Transformation( 231810.6258680795, -9282022.047004225, 7441707.690541031, 9342734.422270255, 303484.0834775752, -2276732.6995155974); -
Inappropriate?It looks like you might have latitude and longitude mixed up there? You should use the ceiling (rounded up) value of the zoom, so in this case 14. Also remember that x=column and y=row.
I get the following from the calculator, for mercator projection:
var t:Transformation = new Transformation(9342734.422270255, 303484.0834775752, -2276732.6995155974,
231810.6258680795, -9282022.047004225, 7441707.690541031);
__projection = new MercatorProjection(14, t);
Does that work? -
Inappropriate?Thanks, that completely worked. So what did you do? Swap the longitude and latitude or the x and y?
-
Hooray! Switched long lat I think. And set the zoom level to 14.
We'll try to make this easier in future :) -
Crazy I thought that I tried this. Sometime you need to work though the problem with someone else. Thanks for the help. -
My mistake. It was row and column that I switched. Rest easy! -
That makes sense and I could see how I could have mistaken the X and Y values. -
Absolutely - I get row/column and x/y mixed up from time to time too. -
Inappropriate?I plan to add this to Modest Maps proper when I can test it some more, but in case it's useful here's a subclass of the zoomify provider that can do the transform derivation itself given three Locations, three Points and the original image dimensions. It should be clearer:
class DigitalAugustanRomeProvider extends AbstractZoomifyMapProvider implements IMapProvider
{
public function DigitalAugustanRomeProvider()
{
var imageWidth:Number = 9271;
var imageHeight:Number = 8894;
defineImageProperties('http://mapserver.digitalaugustanrome.org/rome/zoomify/', imageWidth, imageHeight);
var l1:Location = new Location(41.910465, 12.461607);
var p1:Point = new Point(207, 922);
var l2:Location = new Location(41.875519, 12.471178);
var p2:Point = new Point(1519, 8566);
var l3:Location = new Location(41.882452, 12.514307);
var p3:Point = new Point(8601, 7232);
var projectionZoom:int = Math.ceil(Math.log(Math.max(imageWidth, imageHeight)) / Math.LN2);
var t:Transformation = deriveTransformation(l1, p1, l2, p2, l3, p3);
__projection = new MercatorProjection(projectionZoom, t);
}
public function rawProject(lat:Number):Number
{
return Math.log(Math.tan(0.25 * Math.PI + 0.5 * lat));
}
/** Generates a transform based on three pairs of points, l1 -> p1, l2 -> p2, l3 -> p3. */
public function deriveTransformation(l1:Location, p1:Point, l2:Location, p2:Point, l3:Location, p3:Point):Transformation
{
var deg2rad:Number = Math.PI/180.0;
var a1x:Number = l1.lon*deg2rad;
var a1y:Number = rawProject(l1.lat*deg2rad);
var a2x:Number = p1.x;
var a2y:Number = p1.y;
var b1x:Number = l2.lon*deg2rad;
var b1y:Number = rawProject(l2.lat*deg2rad);
var b2x:Number = p2.x;
var b2y:Number = p2.y;
var c1x:Number = l3.lon*deg2rad;
var c1y:Number = rawProject(l3.lat*deg2rad);
var c2x:Number = p3.x;
var c2y:Number = p3.y;
var x:Array = linearSolution(a1x, a1y, a2x, b1x, b1y, b2x, c1x, c1y, c2x);
var y:Array = linearSolution(a1x, a1y, a2y, b1x, b1y, b2y, c1x, c1y, c2y);
return new Transformation(x[0], x[1], x[2], y[0], y[1], y[2]);
}
/** Solves a system of linear equations.
t1 = (a * r1) + (b + s1) + c
t2 = (a * r2) + (b + s2) + c
t3 = (a * r3) + (b + s3) + c
r1 - t3 are the known values.
a, b, c are the unknowns to be solved.
returns the a, b, c coefficients.
*/
public function linearSolution(r1:Number, s1:Number, t1:Number, r2:Number, s2:Number, t2:Number, r3:Number, s3:Number, t3:Number):Array
{
var a:Number = (((t2 - t3) * (s1 - s2)) - ((t1 - t2) * (s2 - s3))) / (((r2 - r3) * (s1 - s2)) - ((r1 - r2) * (s2 - s3)));
var b:Number = (((t2 - t3) * (r1 - r2)) - ((t1 - t2) * (r2 - r3))) / (((s2 - s3) * (r1 - r2)) - ((s1 - s2) * (r2 - r3)));
var c:Number = t1 - (r1 * a) - (s1 * b);
return [ a, b, c ];
}
override public function toString():String
{
return "DIGITAL_AUGUSTAN_ROME";
}
}
Clearly there aren't too many steps needed to take this class and generalise it for future use – you would specify the projection to use (and skip the rawProject step for LinearProjections) and make imageWidth/Height, the locations and points and the URL into parameters.
I’m motivated
Loading Profile...



EMPLOYEE