[Mapserver-users] Using mapserv to return map extents

Eric Bridger eric at gomoos.org
Thu Jul 31 06:27:59 EDT 2003


The extent of a shapefile is available using mapscript. In the
shpinfo.pl perl script which comes with the mapserver distribution shows
an example, the bounds is the same as the extent.

$shapefile = new mapscript::shapefileObj($file, -1) or die "Unable to
open shapefile $file.";

print "Shapefile $file:\n\n";
print "\ttype: ". $types{$shapefile->{type}} ."\n";
print "\tnumber of features: ". $shapefile->{numshapes} ."\n"; 
printf "\tbounds: (%f,%f) (%f,%f)\n", $shapefile->{bounds}->{minx},
$shapefile->{bounds}->{miny}, $shapefile->{bounds}->{maxx},
$shapefile->{bounds}->{maxy};
    


On Wed, 2003-07-30 at 18:00, Alasdair_McCall/Jigsaw at JI.CO.ZA wrote:
> 
> 
> 
> 
> Hi,
> 
> I was wondering if it's possible to use Mapserv as an application that can
> be used to return the map extents of a layer and/or shapefile(s). I have a
> drop down box that contains the layers that are defined in the .map file.
> When a user selects a layer, i want to generate a map that is zoomed to
> that layer. Alternatively I could also query the shapefile to return the
> extents and then generate the zoomed map image.
> 
> Currently i've hard coded the map extents for each layer, but this is not
> desirable.
> 
> Perhaps there is some other application out there that can do this can of
> query. I'm not very knowledgable on GIS and apologise if i've used the
> wrong termonology or misunderstood something about Mapserver. It's a great
> application that is working 100% for everything else.
> 
> Much thanks,
> Alasdair.
> 
> _______________________________________________
> Mapserver-users mailing list
> Mapserver-users at lists.gis.umn.edu
> http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
> 





More information about the mapserver-users mailing list