PERL/Mapscript postGIS examples?

Lowell.Filak lfilak at MEDINACO.ORG
Mon Mar 20 08:51:20 EST 2006


Stephen Davies writes: 

> Thanks for the feedback. 
> 
> Turning on PostgreSQL logging did indeed reveal more information.
> However, it leaves even more confused than before. 
> 
> It seems that the underlying cause of my results is that the extent 
> being used by mapscript bears no relation to the extent that I 
> specified. 
> 
> Here is the sql statement generated from mapscript: 
> 
>  2006-03-18 16:22:47 CST LOG:  00000: duration: 33.759 ms  statement: 
> DECLARE mycursor BINARY CURSOR FOR SELECT 
> location::text,asbinary(force_collection(force_2d(geom)),'NDR'),id::text 
> from probe WHERE geom && setSRID('BOX3D(139.522253226183 
> -0.000314231148091942,139.522253452601 -0.000314003203767908)'::BOX3D, 
> find_srid('','probe','geom') ) 
> 
> The actual extent specified (and the one that works from CGI mapserv) 
> was: 
> 
> 139.5143351 -34.7459112 139.5278707 -34.7207064 
> 
> The "correct" query as generated by a CGI call with the above mapext is: 
> 
> 2006-03-18 16:11:57 CST LOG:  00000: duration: 33.703 ms  statement: 
> DECLARE mycursor BINARY CURSOR FOR SELECT 
> location::text,asbinary(force_collection(force_2d
> (geom)),'NDR'),id::text from probe WHERE geom && 
> setSRID('BOX3D(139.508530404246 -34.7456930137356,139.533675395754 
> -34.7204885334377)'::BOX3D, find_srid('','probe','geom') )  
> 
> Again the extent is changed but nowhere as drastically. 
> 
> I then tried hard-wiring the extent into the map file and removing the 
> mapext argument from the CGI call and got the same result and the same 
> query. 
> 
> I then modified my PERL script to use the extent in the map file and 
> again got the same result and the same query generated. 
> 
> It looks as if the mapscript setExtent method does something strange and 
> different from the CGI mapext option and that both do strange things 
> with extent statements in map files in some circumstances. 
> 
> I tried changing the UNITS to DD but this made no difference (METERS is 
> required to make reference maps etc work properly in the CGI world.)

Stephen, 

Did you already try printing the values of $miny & $maxy or run it with 
"perl -d"?
If they args read in are correct then I'm wondering if:
my $rect = mapscript::rectObj->new($minx,$miny,$maxx,$maxy);
$map->{extent} = $rect;
would have a different effect. 

Lowell 



More information about the mapserver-users mailing list