Forum: General Topics

Forums / General Topics / MapOrganizer: calibrating maps with uniform areas ...

 

Subject:MapOrganizer: calibrating maps with uniform areas in corners. 

wicher

17:59
Sunday
13-Feb-2011

Hi!

I've run into troubles when calibrating certain maps with MapOrganizer several times - and I strongly believe that I'm not the only one here ;)
The only way to calibrate maps in MapOrganizer is to input coordinates of top-left/bottom-right corners of your map. The problem appears when your map area in these corners is "uniform" (sea, lake, large chunks of forests, etc) and defining an exact positions of the corners is impossible. It is especially severe when calibrating maps of islands. Currently the only way to go in such a situation is the "trial-and-error + predefined waypoints" method, whic is time consuming and helluva annoying.
An (not so?) easy fix for the problem would be to let the users _choose_ the points of calibration (by clicking on the map loaded to MapOrganizer), rather than forcing them to use the two corners.
From the point of view of Java GUI, such a change would not be very time consuming, I am not sure about the maths behind it though...
Stephen - don't you think that adding this feature would be a good idea?

Cheers!

wicher
 

Stephen

19:44
Sunday
13-Feb-2011

Location:
Surrey, UK

Phone Model:
BB 9800 Torch
BlackBerry 8900
SE W910i
Nokia 5800

Hi Wicher,

Yes, it should be fairly straightforward to add a simple 2-point calibration method, which would calculate the corner coordinates via linear interpolation after entering the lat/lng and x/y coords of 2 points on the map. It would only be accurate for truly rectangular-projection maps (as always), but should help your situation where the top/bottom/left/right edges are not accurately measurable.

(One point to note is that currently you don't actually have to just enter the *corner* coordinates - you can use any point along the top edge for the Latitude Top coordinate, etc)

Will see what I can do...

Cheers,
Stephen

 

wicher

7:59
Monday
14-Feb-2011

Hi Stephen,

Thanks for the quick reply!

" Yes, it should be fairly straightforward to add a simple 2-point calibration method, which would calculate the corner coordinates via linear interpolation after entering the lat/lng and x/y coords of 2 points on the map. It would only be accurate for truly rectangular-projection maps (as always), but should help your situation where the top/bottom/left/right edges are not accurately measurable. "

It could be even easier if you force users to define their calibration points on the diagonal of the map only. This way you do not need the "clickable" map area. You could jest let us define an offset of the calibration points from the corners, for example: in 1/3rd of the diagonal. This way the only what you need to do is to add an extra textbox (for the offset) and print markers on the map field in the place where the calibration points are chosen. This way the math behind it should also be much easier (intuitively).

" (One point to note is that currently you don't actually have to just enter the *corner* coordinates - you can use any point along the top edge for the Latitude Top coordinate, etc) "
That's right, but only if your map uses rectangular projection, which is rarely a case. Most of the maps use the UTM projection. Of course, one could use a third-party tool to perform preliminary conversion of his map to rectangular projection, but it just adds one more level of difficulty to the whole process. It is so much easier to use the MapOrganizer built-in converter (true, it works for Mercator only, but since most of the maps use UTM, we are happy :) ).

Just out of curiosity, does TMJ use equirectangular projection, as described in Wikipedia http://en.wikipedia.org/wiki/Equirectangular , or does it use some sort of derivative of that projection. I am asking because in the equirectangular projection, the map distortion becomes more and more serious the closer we get to the poles. I've been using TMJ on Iceland (close to the polar circle). Unfortunately I did not manage to prepare raster maps, because Icelandic maps use a special projection (special case of Lambert Conic Projection with WGS84 datum, as far as I remember) and after converting it to equirectangular projection I got very distorted, "extended" maps. On the other hand, I compared the "shape" of my TMJ tracks to that "extended" map and they did not fit at all, the TMJ tracks were not "extended" and their shape was actually very similar to the shape of the paths marked on the original, not converted map! This suggests, that TMJ uses some specific case of the equirectangular projection, am I right?

Cheers

wicher
 

Stephen

11:45
Monday
14-Feb-2011

Location:
Surrey, UK

Phone Model:
BB 9800 Torch
BlackBerry 8900
SE W910i
Nokia 5800

Hi Wicher,

" It could be even easier if you force users to define their calibration points on the diagonal of the map only. This way you do not need the "clickable" map area. You could jest let us define an offset of the calibration points from the corners, for example: in 1/3rd of the diagonal. This way the only what you need to do is to add an extra textbox (for the offset) and print markers on the map field in the place where the calibration points are chosen. This way the math behind it should also be much easier (intuitively). "

Mmmm, surely by forcing the user to use fixed points is just going back to the original problem - what if these fixed points also happen to lie in a blank area of sea, etc?

Actually I've already implemented the basic 2-point clicking method (yet to upload it though), seems to work fine, but only with the rectangular-projection caveat as above!

" That's right, but only if your map uses rectangular projection, which is rarely a case. Most of the maps use the UTM projection. Of course, one could use a third-party tool to perform preliminary conversion of his map to rectangular projection, but it just adds one more level of difficulty to the whole process. "

The trouble is that any projection other than rectangular is simply not going to be helped by this calibration method. The sole use for this is to aid in calibrating a rectangular map where there are no accurately known calibration points around the borders. Any other projection really will need to be pre-converted (somehow) to benefit.

" It is so much easier to use the MapOrganizer built-in converter (true, it works for Mercator only, but since most of the maps use UTM, we are happy) "

Actually the built-in converter is very specifically only for standard Mercator (ie the projection used by most online maps, eg OSM, Bing, Google, etc) rather than Transverse Mercator/UTM, the converter simply corrects for latitude distortion, whereas UTM would need a more complex longitude correction as well.

" Just out of curiosity, does TMJ use equirectangular projection, or does it use some sort of derivative of that projection "

The equirectangular projection directly maps each degree of latitude/longitude along the y and z axes, so a full equirectangular map of the world would be exactly twice as wide as it is high (ie 360 degrees longitude vs 180 degrees latitude).

TMJ uses a more general rectangular projection (so not necessarily 'equi-'!), where the x and y axes can use different linear scales, allowing maps that lie farther from the equator to be vertically stretched to more closely align with on-the-ground distances. Most map projections are chosen to allow relatively large areas to be represented without too much local distortion. However if you're only dealing with a small area, then a rectangular projection should be perfectly good enough for most purposes.

If using equirectangular maps of Iceland then yes, they would seem vertically squashed (at Iceland's 65 deg N, 1 degree of latitude is roughly 110km, but 1 degree longitude is only 50km-ish), whereas TMJ tries to stretch them back (by 1/cos(65)) so that the axes both represent the same on-the-ground scale, hence the track shape will probably look similar to any printed maps of the same area.

Cheers,
Stephen

(Hope I'm not over-confusing the issue!! ;-)
 

wicher

22:42
Monday
14-Feb-2011

Hi Stephen,

" Mmmm, surely by forcing the user to use fixed points is just going back to the original problem - what if these fixed points also happen to lie in a blank area of sea, etc?
Actually I've already implemented the basic 2-point clicking method (yet to upload it though), seems to work fine, but only with the rectangular-projection caveat as above!
"

programs programs
I was thinking of letting the user choose any points on the diagonal, equally distant from the corners. It is rather unlikely that all the points on the diagonal are "blank". Well, 2-point clicking method is obviously much more flexible and you've already implemented it (wow, that was fast!), so there is not much to discuss here :)

" Actually the built-in converter is very specifically only for standard Mercator (ie the projection used by most online maps, eg OSM, Bing, Google, etc) rather than Transverse Mercator/UTM, the converter simply corrects for latitude distortion, whereas UTM would need a more complex longitude correction as well "

It explains why there was a little distortion on some of my maps :D

" TMJ uses a more general rectangular projection (so not necessarily 'equi-'!), where the x and y axes can use different linear scales, allowing maps that lie farther from the equator to be vertically stretched to more closely align with on-the-ground distances.
[...] TMJ tries to stretch them back (by 1/cos(65)) so that the axes both represent the same on-the-ground scale, hence the track shape will probably look similar to any printed maps of the same area. "


Hmm, it may sound like a stupid question, but does it mean that I can also use maps in the equirectangular projection as an input to MapOrganiser and it will do the axes scaling based on your proprietary algorithm? The thing is that there are quite a few projection converters out there, but you must know what projection you want as a result ;)

" (Hope I'm not over-confusing the issue!!) "

The more you explain us the fewer stupid questions we ask ;)

Cheers

Wicher
 

Stephen

17:08
Tuesday
15-Feb-2011

Location:
Surrey, UK

Phone Model:
BB 9800 Torch
BlackBerry 8900
SE W910i
Nokia 5800

Hi Wicher,

" Hmm, it may sound like a stupid question, but does it mean that I can also use maps in the equirectangular projection as an input to MapOrganiser and it will do the axes scaling based on your proprietary algorithm? "

Yes, absolutely - equirectanglar should work perfectly well! Also, if your equirectangular map image files only cover a small area (say up to 1 or 2 deg latitude) then you could even try stretching them vertically in (eg) Photoshop before using in the MapOrganiser. This will then give a more real looking track shape when displayed in TMJ. Just multiply the height of the image by 1/cos(lat) (where lat is the average or centre latitude of the map). eg a 1000x1000 pixel equirectanglar map of London might be stretched by roughly 1/cos(51) to 1000x1590 to give a better shape.

I've now updated the MapOrganiser download page to v2.7 with the new additions - the Tools/Calculate Bounds opens the 2-click interpolation function.

Hope it works!

Cheers,
Stephen
 

wicher

22:31
Tuesday
15-Feb-2011

Stephen,

" [...]you could even try stretching them vertically in (eg) Photoshop before using in the MapOrganiser. This will then give a more real looking track shape when displayed in TMJ [...] ".

All right, it's all clear now. I thought that it is the MapOrganizer that does all the image processing (based on the image size and calibration points). Does it mean, that the track shape is adjusted by TMJ to fit the (stretched) map and the track shape may be different in PLAN and MAP pages? Or is the track "stretching" synchronized in both these pages?

Thank you so much for the MapOrganizer update! I will test it tomorrow.

Regards

wicher
 

wicher

8:27
Wednesday
16-Feb-2011

Oh, one more thing I forgot to ask:

" Also, if your equirectangular map image files only cover a small area (say up to 1 or 2 deg latitude) then you could even try stretching them vertically in (eg) Photoshop before using in the MapOrganiser "

Why can I do it only if the map covers a small area? Doesn't TMJ use the same scaling factor to the entire area of a given raster map?

cheers

wicher
 

Stephen

9:34
Wednesday
16-Feb-2011

Location:
Surrey, UK

Phone Model:
BB 9800 Torch
BlackBerry 8900
SE W910i
Nokia 5800

" Does it mean, that the track shape is adjusted by TMJ to fit the (stretched) map and the track shape may be different in PLAN and MAP pages? "

Yes - the scaling on the two views are completely separate. The Map page uses the fixed scale as set in the map file, whereas the Plan view changes its scaling depending on the latitude being displayed (adjusted by the same cos() function noted above) to ensure that it roughly shows the correct on-the-ground shape.
(NOTE: on the Map page this only applies to Offline *.tmj maps - the Online maps use the Mercator projection, but thats a whole other conversation...!!)

" Why can I do it only if the map covers a small area? Doesn't TMJ use the same scaling factor to the entire area of a given raster map? "

Yes TMJ does use the same latitude=>pixel and longitude=>pixel scaling for the entire map area - you could use a larger area, but the amount of distortion will increase the further north/south you move. It all boils down to the fact that the scaling is (strictly) only correct (with respect to distance on the ground) along a single line of latitude. The error is barely noticeable when staying close to this latitude (hence a degree either side shouldnt be a problem), but if using a larger area spanning several degrees then the top part of the map will seem more squashed (or less, depending which way up you are!) than the bottom.

If only the world was flat!

Cheers,
Stephen
 

wicher

17:19
Wednesday
16-Feb-2011

" [..] but if using a larger area spanning several degrees then the top part of the map will seem more squashed (or less, depending which way up you are!) than the bottom. "

Well, it only influences a visual impression of the map. As long as the track fits to the map - I'm happy ;)

The questions concerning the details of projection used by TMJ must sound trivial to you, but I believe that there are many users like me who got confused by the projection conversions. Perhaps it would be worth to separate the projection part of this thread to a new thread or even to mention it in the user manual of the MapOrganizer...

Thank you for your excellent support! Its quality (and your patience) are admirable!

Best Regards!

wicher
 
 

Stephen

21:38
Sunday
20-Feb-2011

Location:
Surrey, UK

Phone Model:
BB 9800 Torch
BlackBerry 8900
SE W910i
Nokia 5800

I've now updated the MapOrganiser page with a bit more info on usage and projections (though re-reading it I'm not sure if I've just made it seem even more complicated!!).

I must admit that I'm no expert on projections whatsoever - my overriding reason for sticking with the rectangular projection was so that I *didn't* have to get too involved in the horrible maths and complexity of the others!!

Cheers,
Stephen
 

(You must be logged in to post a reply to this thread)