How to calculate Transformation between different projections
Hi, i've been working with this library since a month and i appreciate the effort that you put on this. I think it's an excellent project.
I've a problem calculating transformations between different projections.
My base layer it's provided by Geoserver, but the geographic data it's stored in EPSG:22182.
I've made a WMS provider that connects to the server and ask for each tile. It seems to work fine, but the map is a little deformed.
I think this because it's stored in POSGAR 94 but i don't understand how to calculate the necessary transformation.
Is there a way to calculate the transformation without using the calculator, for example using data from spatial reference?
(Actually i can't determine 3 point to use with the calculator)
I've a problem calculating transformations between different projections.
My base layer it's provided by Geoserver, but the geographic data it's stored in EPSG:22182.
I've made a WMS provider that connects to the server and ask for each tile. It seems to work fine, but the map is a little deformed.
I think this because it's stored in POSGAR 94 but i don't understand how to calculate the necessary transformation.
Is there a way to calculate the transformation without using the calculator, for example using data from spatial reference?
(Actually i can't determine 3 point to use with the calculator)
1
person has this question
I have this question, too!
Tell me when someone answers.
The more people who ask this question, the more it gets noticed.
The more people who ask this question, the more it gets noticed.
Create a customer community for your own organization
Plans starting at $19/month
-
Inappropriate?Hi Grispoo -
There are two parts to your question. One is implementing EPSG 22182. It looks like it's an instance of transverse mercator with a unique center and offset, so you'd need to implement some of the math found near the bottom of http://mathworld.wolfram.com/Mercator..., in a new IProjection class. If you have a copy of PROJ4 kicking around, it would help make it possible to check your work.
The second part is determining your transformation matrix. This is slightly harder to explain; is it enough of a hint to say that you're looking for transformation into image pyramid Coordinate, rather than flat map Point space?
If this isn't helpful I can try to follow up with a bit of code. Do you already have a tile set somewhere that we can look at together?
I’m hopeful
-
Inappropriate?Mmmmm my problem was that i was calculating wrong the BBox of each tile, based in the coordinate. That mistake was giving me a distortionated the map as result.
After fixing it it worked right "out of the box"
/// Some code from my WMS Provider
public function getTileUrls(coord:Coordinate):Array
{
var sourceCoord:Coordinate = sourceCoordinate(coord);
var total:Object = tiles.totalTiles(coord.zoom);
if (coord.row < 0 ||
coord.row >= total.vertical ||
coord.column < 0 ||
coord.column >= total.horizontal) {
return null;
}
return [ config.baseUrl + config.getConfig() + "BBOX=" + getBBox(coord)];
}
protected function getBBox(coord:Coordinate):String
{
var size:Number= tiles.tileSize(coord.zoom);
var left:Number = tiles.limits.minX + coord.column * size;
var right:Number = tiles.limits.minX + (coord.column + 1) * size;
var top:Number = tiles.limits.maxY - coord.row * size;
var bottom:Number = tiles.limits.maxY - (coord.row + 1) * size;
return "" + left + "," + bottom + "," + right + "," + top;
}
// CODE FROM AND AUXILIARY CLASS
public function tileSize(zoom:int):Number
{
_maxDist = Math.max(distX, distY)
return _maxDist / Math.pow(2, zoom);
}
public function totalTiles(zoom:int):Object
{
var size:Number = tileSize(zoom);
return {horizontal: Math.ceil(distX / size), vertical: Math.ceil(distY / size)};
}
Now I will start to implement POSGAR projection, with that math you posted here
I will post any result when it's done.
Thanks for your guidance.
I’m thankful
-
Inappropriate?I've a very rudimentary implementation of the formula that appears at the bottom of http://mathworld.wolfram.com/MercatorProjection.html
(Note that the IProjection interface is my own, not the one used in modest map core)
The problem is that's not working properly.... Am I missing something?
Input location is in real degrees, output should be the projected location
public class EPSG22182 implements IProjection
{
public function transform(loc:Location):Location
{
var phi:Number = loc.lat;
var phiZero:Number = -90;
var lambda:Number = loc.lon;
var lambdaZero:Number = -69;
var B:Number = Math.cos(phi) * Math.sin(lambda - lambdaZero);
var x:Number = MyMath.atanh(B);
var y:Number = Math.atan((Math.tan(phi)/Math.cos(lambda - lambdaZero))) - phiZero;
var l:Location = new Location(x, y);
return loc;
}
public function toString():String
{
return "EPSG:22182";
}
}
I’m confused
-
Inappropriate?I'm not sure what you need that for (Map already has functions locationPoint and pointLocation to get screen coordinates for lat/lon and vice versa) but the error in your code is that you return loc when you probably mean to return l.
Why not return a flash Point when your data is x/y? The compiler would have caught the mistake then. -
Inappropriate?Ahhhhhhh.... stupid mistake ¬¬
I'm using it to create a valid bounding box string in a generic WMS Provider.
The idea was to convert the location into a valid location for the given projection.
I returned a location to have a uniform data type inside the calculations of the WMS Provider mentioned above
I’m silly
-
Inappropriate?I see... so the WMS server expects bbox parameters in the chosen projection, got it. Sounds good, keep going!
BTW, getsatisfaction supports HTML code and pre tags which makes code easier to read in posts. See the "Some HTML allowed" link when you're posting for more details.
Loading Profile...



EMPLOYEE
EMPLOYEE