[Cartoweb-users] Howto highlight points on map based on results returned from sql database

Alexandre Saunier alexandre.saunier at camptocamp.com
Tue Sep 26 10:16:35 EDT 2006


Hello,

if your locations are geographical objects accessible to MapServer 
(belonging to some MS layers with correct "id_attribute_string" 
METADATA) you may use the "recenter/hilight by id" system of CartoWeb:
http://cartoweb.org/doc/cw3.3/xhtml/dev.newplugin.html#dev.newplugin.special.filters

An alternate solution would be to make the outline plugin draw those 
locations. To do so, extend outline in your project and add the 
following method:
     public function setPointsCoords($pointsCoords) {
         $shapes = array();
         foreach ($pointsCoords as $point) {
             $shape = new StyledShape;
             $shape->shape = $point;
             $shapes[] = $shape;
         }
         $this->outlineState->shapes = $shapes;
     }
Then call this method from your extended outline or from a dedicated 
plugin. The method argument is an array of Point objects.
The recentering is done using some recenter_x/recenter_y parameters 
described in the above manual page.

AS

Oliver Ishmael wrote:
> I have written an html form which allows users to select services they 
> want. A php script then returns the locations from a mysql database that 
> support these services. I would like these locations to be highlighted 
> on a cartoweb map as points.
> 
> I could add x/y coordinates to the mysql table - but how do i get these 
> to highlight a point on a the map?
> 
> Any tips or examples would be greatly appreciated!


More information about the Cartoweb-users mailing list