[ka-Map-users] Loading layer data dynamically in kaMap.

Schalk Snyman schalk at wor-x.com
Tue Mar 27 03:08:43 EST 2007


Hello to all kaMap users!

Background:
I am trying to "port" a project, done with Mapserver and javascript, to kaMap. The program has the functionality to check/uncheck layers and add the data
dynamically from a database. This is necessary because the data are updated continuously, e.g. vehicle position... 

The memory saving with the caching of tiles mainly influenced my choice to move to kaMap. I lose the map quite often with Mapserver only.

Question:
I have a sql database server which contains the data for my layers (position etc.). I need to load the data into layers at runtime and update the layers
continuously. The problem is that although the javascript from init.php show that the layer is added (or at least the correct parameters are inserted) e.g.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
map.addLayer(new _layer( { name:'taxi',visible:true,opacity:100,imageformat:'png',queryable:false,tileSource:'redraw',redrawInterval:10000,refreshInterval:5000,scales: new Array('1','1','1','1','1','1','1','1','1')}));"; 
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
BUT: when I later do a getlayerByName('taxi') in an AJAX called php file to load the data, which is called every 2s, the layer does not exist.

Here is my layer in the mapfile:

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#####################################################
# Unit layer could be a Vehicle or Dispensing unit

LAYER
    NAME "taxi"
    GROUP "taxi"
    STATUS ON
    DATA "dummy"
    METADATA
          "tile_source" "redraw"
          "redraw_interval" "10000"
          "refresh_interval" "5000"
    END
    TYPE point
    LABELCACHE on
          CLASS
              SYMBOL "Taxi"
              SIZE 30
              STYLE
                  COLOR -1 0 0
              END
              TEXT ""
              LABEL
                  BUFFER 20
                  TYPE Truetype
                  FONT "arial"
                  SIZE 8
                  POSITION uc
                  COLOR 0 0 0
                  ANGLE AUTO      
             END
     END
END
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

I tried to use KaXmlOverlay, which worked OK, but
-> I already have code for an overlib imagemap,
-> support for the overlay tooltip is lacking,
-> overlays can't be switched on/off with usual layer checking

I need this to work or my motivation for using kaMap would be nullified,
Any help will be much appreciated!

Schalk Snyman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/ka-map-users/attachments/20070327/0f575acd/attachment.html


More information about the ka-Map-users mailing list