[mapserver-users] confusion about postgis bounding box -> valid map extent

Alex Rice alex_rice at arc.to
Fri Aug 23 14:46:06 EDT 2002


I am using PostGIS and getting a bounding box of objects in 
PostGIS with the functions Envelope() or Box3d(). The bounding 
box will not be the same aspect ratio as my Map object.

Here are some things I am confused about.

- Is it correct that in Perl mapscript, the only way to set the 
extent of the map object is directly accessing 
$mapObj->{extent}->{minx} etc.? Pretty sure this is true, just 
want to verify I'm not missing something.

- What's the expected behavior if in Perl mapscript I set the 
extent as above, call prepareQuery(), then draw, if the new 
extent has a different aspect ratio than the output image size?

- In php_mapscript.c  there are functions for dealing with the 
map extent based on a box inside the visible image, or a point + 
scale, etc.  Does anyone have example Perl code, for instance, of 
the map->zoomRectange() function in php_mapscript.c? I have seen 
the &set_extent() method from mapquakes.pl and seen the examples 
Lowell posted in Perl, but those are zoom & pan, not fitting an 
extent to another rect. If there isn't sample perl code

- In maptemplate.c, the function setExtent() has several cases 
for the "source" of the change in extent. Do  any of those cases 
apply to my situation? Maybe I can adapt the C code to a Perl 
method.

- Is there a way to get PostGIS to fit a bounding box to an 
aspect ratio? It would be nice if I didn't have to do it in perl 
at all. A function like this is what I'm imagining

select extent2extent(5, 3, box3d(the_geom), centroid(the_geom));

where 5:3 is the aspect ratio
box3d is the extent of the object
centroid is the center of the requested new extent

Thanks,

Alex Rice, Software Developer
Architectural Research Consultants, Inc.
alex_rice at arc.to
alrice at swcp.com





More information about the mapserver-users mailing list