Postgis point table

Eduardo Spremolla edspremolla at ANTEL.COM.UY
Tue Nov 23 07:32:27 EST 2004


I never see how to tell postgis to convert a bunch of point into a
polyline.

You have to do it with mapscript.

After you collect the point, do something like this:

  my $point = new mapscript::pointObj();
  my $line = new mapscript::lineObj();

  $layer = $map->getLayerByName('gps_route');

  foreach my $q(@gps_points)
  {

    $point-> { x} = $q-> { lon};
    $point-> { y} = $q-> { lat};
    $line->add($point);
        }

  my $shape = new mapscript::shapeObj($mapscript::MS_SHAPE_LINE);
  $shape->add($line);
  $shape->draw($map, $layer, $img);

  $map->drawLabelCache($img);
  $img->saveImage($image_path.$image_id, $map-> { imagetype} , $map-> {
transparent} , $map-> { interlace} , $map-> { imagequality});
  $img=$map->drawScalebar();
  $img->saveImage($image_path.$scalebar_id, $map-> { imagetype} , $map->
{ transparent} , $map-> { interlace} , $map-> { imagequality});


I hope it helps.


El mar, 23-11-2004 a las 09:12, Stéphane RIFF escribió:
> I have a postgis point table, display GPS coordinate in WGS84.
> It works well with mapserver.
> But now i'd like to show those points in a LINE type layer with mapserver
> but i can't figure how to do it :
> 
> i've tried this in mapfile :
> 
>   DATA
> "geometryfromtext(replace(astext(geomunion(geom)),'MULTIPOINT(','LINESTRING('),4326)
> from <tablename>;"
> 
> but mapserver failed to draw the layer.
> Does somebody already do something like that ???
> Thanks
-- 
Eduardo Spremolla <edspremolla at antel.com.uy>
Antel I+D



More information about the mapserver-users mailing list