[mapserver-users] POSTGIS/Mapscript DB connection is not closing (FWD)

trussell at mtcsc.com trussell at mtcsc.com
Mon Feb 4 16:46:11 PST 2002


Teb,

Postmaster is supposed to behave like that. It runs in the background and
fields requests. There's some great documentation on this at
http://www.postgresql.org/idocs/index.php?postmaster-start.html.

The code you included regards a topic I've been wondering about - doing a
postgis query from a point selection. Hope to get something working there...

Tom
----- Original Message -----
From: "teb" <teb at mallit.fr.umn.edu>
To: <mapserver-users at lists.gis.umn.edu>
Cc: <jeffloun at refractions.net>
Sent: Monday, February 04, 2002 12:15 PM
Subject: [mapserver-users] POSTGIS/Mapscript DB connection is not closing
(FWD)


>
> ------------- Begin Forwarded Message -------------
>
> Date: Mon, 04 Feb 2002 12:19:20 -0800
> From: jeff lounsbury <jeffloun at refractions.net>
> X-Accept-Language: en
> MIME-Version: 1.0
> To: mapserver-info at lists.gis.umn.edu
> Subject: POSTGIS/Mapscript DB connection is not closing
> Content-Transfer-Encoding: 7bit
>
> After I use mapscript to query my postgis layer in my map, the
> postmaster that got run never dies/closes?
>
> Anyone have any idea on why this might be happening?
> Hhere is an exerpt of the offending mapscript code...
>
>     file://turn the point where the user clicked on the image into a
lat/long
> co-ordinate
>         $pt = ms_newPointObj();
>         $lat = get_lat($map->extent->minx, $map->extent->maxx, $img_x,
> 700);
>         $long = get_long($map->extent->miny, $map->extent->maxy, $img_y,
> 350);
>         $pt->setXY($lat, $long);
>     file://query the postgis layer
>         $layer = $map->getLayer(5);
>         $err = @$layer->queryByPoint($pt, MS_MULTIPLE, $missby);
>
>         if($err == MS_FAILURE){
>           echo "<font size=4 color=red>There were no results found, try
> zooming in closer.</font>";
>         }else if( $err == MS_SUCCESS){
>           $layer->open($img->shapepath);
>     file://save the query results into an array
>           $i=0;
>           $result = $layer->getResult($i);
>           while($result != FALSE && $i < 5){
>             $shape = $layer->getShape($result->tileindex,
> $result->shapeindex);
>             $value = $shape->values;
>             $val[$i] = $value;
>             $i++;
>             $result =  $layer->getResult($i);
>           }
>           $results_found =1;
>         }
>         $layer->close;
>
>
>
> As well as the postgid layer in the mapfile:
> LAYER
>    CONNECTIONTYPE postgis
>    NAME "mypostgis"
>    DATA "point from usage_points"
>    CONNECTION "host=ox user=postgres port=5555 dbname=postgis_usage"
>    STATUS DEFAULT
>    TYPE POINT
>    CLASS
>     TEMPLATE query.html
>     MINSIZE 10
>     SYMBOL star
>     COLOR 250 0 25
>    END
>   END
>
> ,thanks
> -Jeff
>
>
> ------------- End Forwarded Message -------------
>
>
>




More information about the MapServer-users mailing list