[ka-Map-users] Perl back end and other features

Paul Spencer pspencer at dmsolutions.ca
Sun May 29 20:25:32 EDT 2005


Hi Stephen,

this sounds great! comments inline ...

Stephen Woodbridge wrote:
> Hi all,
> 
> I have been writing a perl backend for ka-map and have it pretty 
> function at this point. I have integrated have also add a few 
> enhancements like:
> 
> 1) the ability to define a [long, lat, scale] to the mapfile structure 
> after the image type in the array and made init.cgi position the map to 
> that location and scale when the map is initialized.

great addition ... did you also make it so these could be passed to the 
init script so that the calling application could affect the start up 
without requiring changes on the server side?

> 
> 2) I added a geocoder interface that allows you to enter a location on 
> the map page then passes the request to init.cgi which parses the 
> address string into fields gets it geocoded using a remote service and 
> causes the map to be positioned to that location.
> 
> I am doing these for a presentation to the User's conference and the 
> source will be made available after the conference by Where2getit.com.
> 

will you contribute it to ka-Map cvs?  I would be interested in getting 
you a cvs-commit account so that you can maintain it also since I am not 
much of a perl programmer :)

> I have a few questions:
> 
> 1. When I position the map after geocoding a location I set the location 
> to cX, cY instead of computing these values as the center of the 
> extents, but this is not centered on the viewport. I think this is 
> because of the clamp to a tile is causing it to be shifted. How can I 
> get it to center? Can I send some additional javascript values to cause 
> it to scroll/slide after it is loaded so it is centered?

I really need to wrap my head around the correct logic to center the map 
correctly based on the initial extents or using the requested extents in 
your example.  I just haven't had the time to work it out.

You can scroll/slide by a number of pixels ... if you are using the cvs 
version, the code would be called using kaMap_moveBy x, y ) or 
kaMap_slideBy x, y ) ... these will be made part of the kaMap object at 
some point but right now they are stand-alone functions

> 
> 2. The Next thing I would like to support is a route overlay like 
> google. Have you thought about doing this? I can get the route polyline 
> loaded into a javascript array, how do I get the array displayed as a 
> polyline on a layer? How do I scale the coordinates for the route to the 
> current zoom scale? I'm not asking for code (but I would take it :), 
> more for the your thoughts on how to best approach this?

Google's approach seems to be a hybrid depending on browser.  In mozilla 
-based browsers, they display a huge transparent image ... actually an 
alpha'd image I think ...

this guy has an explanation of how google does it:

http://jgwebber.blogspot.com/2005/02/mapping-google.html

For me, I would prefer just to use the transparent gif approach I think 
and pin the image on the map.  I think this should be quite easily done 
if you can calculate the top/left corner of the image in geo-coords and 
convert to pixel coords then create a new image object 
(document.createElement('img')), set it up appropriately and add it to 
the 'theInsideLayer' div with position: absolute and the correct 
top/left position.

Note that the top/left will need to be adjusted by the xOrigin and 
yOrigin and the image will have to be redone completely when zooming

Alternately, an entire new layer could be added and the route polyline 
be drawn by mapserver as a layer which would then be tiled in the same 
way as the other map layers ... only this one should be cached 
differently and managed slightly differently on the client side


> 3. OK, while I'm asking has anyone, done anything with putting markers 
> on a layer? with mouseovers on the markers? etc.

thinking about it ... same approach as above.  I will likely add the 
capability to the kaMap API at some point, unless someone else does it 
first.

> 
> This is very nice work Paul! I had started to do this myself when you 
> announced it, so I'm happy to work on it an make some contribution 
> instead. I will get a URL posted shortly.
> 

thanks, we're looking forward to it.

Paul

> -Steve W.
>  http://imaptools.com
>  http://where2getit.com
> _______________________________________________
> ka-Map-users mailing list
> ka-Map-users at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/ka-map-users
> 

-- 
+-----------------------------------------------------------------+
|Paul Spencer                           pspencer at dmsolutions.ca   |
+-----------------------------------------------------------------+
|Applications & Software Development                              |
|DM Solutions Group Inc                 http://www.dmsolutions.ca/|
+-----------------------------------------------------------------+


More information about the ka-Map-users mailing list