[Xastir] Open Street Map support (read this)

Tom Russo russo at bogodyn.org
Wed Jun 9 16:38:16 EDT 2010


On Wed, Jun 09, 2010 at 11:55:45AM -0700, we recorded a bogon-computron collision of the <curt.we7u at gmail.com> flavor, containing:
> 
> Thanks to Jerry Dunmire, KA6HLD, we now have Open Street Map support
> in Xastir.  Woohoo!
> 
> For an interesting place to look, zoom in on a border and see what
> differences you can find for roads crossing said border.  For the
> main Canadian border crossing north of me I can't see any difference
> in the roads at all.
> 
> Thanks Jerry!

This is very good stuff, as the OSM maps do look really nice, and probably
won't suffer from the very stupid projection issues that the Census TIGER
data had.

That said, the second I tried it I got a map that wasn't lining up with other 
data I had.  At first I thought this was an issue with the
server returning a different geographic region than the one requested,
because I've seen the same thing happen with terraserver aerial photos, if 
trying to view too big a map at particular zoom levels.

But rather, it seems to be an issue with how the OSM code tries to restrict
our zoom level to those that match OSM levels.

Here's an example, using my 1261x1019 map window:

  http://www.swcp.com/~russo/xastir_osm/bad_view.png

This particular view is actually one of my map bookmarks, showing the area
where most of the APRS activity is near me.  The bookmark sets zoom level to
131 and the center to 35d04.715'N by 106d29.866'W.

The image is a screenshot showing the OSM layer with a county-provided road 
shapefile drawn on top. The orange road running diagonally from center-right 
to lower-right is the OSM representation of NM state road 337, which is
represented in black to its left from the county GIS files.  The county
one is right --- it shows my Igate (KM5VY-10) in the correct relation to
roads.

Other roads look wrong, too --- compare the sorta reddish major streets in
Albuquerque from OSM to similarly-shaped, but differently-scaled, roads in black
from the county shapefile.

Zooming in even just a tiny bit, as by selecting just the area inside the
map boarder, makes the server return precisely what is asked for and the
downloaded map line up very nicely with the county data:

http://www.swcp.com/~russo/xastir_osm/good_view.png


FWIW, when run with debug level 512, the OSM code prints out:

left side is -106.777989
right side is -106.217544
top  is 35.263983
bottom is 34.893183
lat center is 35.078583
long center is -106.497767
screen width is 1261
screen height is 1019
map width is 0.560444
map height is 0.370800
scale_y = 131
scale_x = 160
zf = 11.627562
z = 12

in the first (bad) case and

left side is -106.715161
right side is -106.280817
top  is 35.223122
bottom is 34.934406
lat center is 35.078764
long center is -106.497989
screen width is 1261
screen height is 1019
map width is 0.434344
map height is 0.288717
scale_y = 102
scale_x = 124
zf = 11.995294
z = 12

in the second (good) case.

I also note that the code appears to be changing requested zoom levels to match
OSM zoom levels.  This may or may not be desirable (I was puzzled when I tried
to set a custom zoom level to a particular value, and the code repeatedly 
set it to something else).

And now that I say that, I see where the problem must be.

I note that when I *tried* to set zoom level to 131 by hand (using the 
"Custom zoom level") it wouldn't do what I asked, but when I chose my map 
bookmark it did actually go to that zoom level --- perhaps the actual issue is 
that Xastir is really using my selected bookmarked zoom level despite the OSM 
code's attempt to restrict to OSM zoom levels.  

As soon as I try to zoom in by selecting the area inside the border, the 
code that restricts to OSM levels actually does work, and therefore the map
I see after the zoom is done looks good.  It just seems to be bookmarks that
are busted (because the restriction to specific zoom levels isn't respected).

Not sure where to look for that mistake, but it would explain why I'm getting
bad OSM maps at my bookmarked view.

Rather than try to restrict the allowed zoom levels, it might be better to
pull in an image of a nearby OSM level and then rescale it to the requested
Xastir zoom level.  That's what the terraserver and other .geo code does.  

Regardless, it's cool that OSM is usable now.  If it were more easily adapted
for use with user-selected zoom levels (especially those in bookmarks), it'
be even better.

--
Tom Russo    KM5VY   SAR502   DM64ux          http://www.swcp.com/~russo/
Tijeras, NM  QRPL#1592 K2#398  SOC#236        http://kevan.org/brain.cgi?DDTNM
 "It is better to live on your feet than to die with your knees."
  -- Mil Millington on running, in Instructions for Living Someone Else's Life



More information about the Xastir mailing list