RES: [mapserver-users] Anybody have updated Mapserver Utilities??

woodbri at swoodbridge.com woodbri at swoodbridge.com
Thu Aug 22 15:10:44 EDT 2002


While this is an excellent utility there is a much simpler way to get 
the extents of the shape file. See the below, and the file extents 
are list as File Bounds (xmin, ymin) to (xmax, ymax).

[woodbri at linus mdata]$ shpdump nhpnnd | head
Shapefile Type: Point   # of Shapes: 125797

File Bounds: ( -176.766473,   17.932413,0,0)
         to  (  179.391600,   71.316577,0,0)

Shape:0 (Point)  nVertices=1, nParts=0
  Bounds:( -156.744416,   71.316577, 0, 0)
      to ( -156.744416,   71.316577, 0, 0)
     ( -156.744416,   71.316577, 0, 0)  

Broken pipe


On 22 Aug 2002 at 14:50, EDUARDO PATTO KANEGAE wrote:

> I don´t think this is "really" a good utiliti, but here it goes:
> 
> i´ve just worked in a project that was an intranet n it has a report that
> 	must show a grid, containting atributes, and too a map of the
> grid(or a map of the forest specifcaly)...
> and the problem in this application is that each map should appear in its
> full extent. so, i dit this:
> 
> 1.execute the utility SHPDUMP, with something like:
> 	$ shpdump mymap.shp > mymap.dmp // dmp -> Dump file result
> 
> 2.execute the my PHP funtion 'get_shp_corners' passing the dumpfile as
> parameter:
> 	
> 	$result = get_shp_corners('mymap.dmp');
> 
> 3.and EURECA! finally got 2 coordinates at $result array that can be used to
> set the EXTENT parameter of my MapFiles. e.g. :
> 
> i can write a MapFile using:
> ...
> EXTENT x1 y1 x2 y2
> ...
> 
> where:
> x1 = $result[0]
> y1 = $result[1]
> x2 = $result[2]
> y2 = $result[3]
> 
> 4.so, let´s see the PHP code:
> /***************************************************************************
> ****************/
> /*
> get_shp_corners: returns an array containing x1 y1 x2 y2 - that is the full
> extent - of a ShapeFile, based on its dumpfile
> $dumpfile = a text file that is generated with the shpdump command
> 
> Author: Eduardo Patto Kanegae <eduardo at scopotecnologia.com.br>
> 
> */
> function get_shp_corners($dump_filename){
> 	$dmp_hwnd = fopen($dump_filename,'r');
> 	if (!$dmp_hwnd){
> 		return FALSE;
> 	} else {
> 		fclose($dmp_hwnd);
> 		$vet_lin_dumpfile = file($dump_filename);
> 		
> 		$p_found[0]=FALSE;
> 		$p_found[1]=FALSE;
> 		$p_found[2]=FALSE;
> 		$p_found[3]=FALSE;
> 		
> 		$tmp[0] = "";
> 		$tmp[1] = "";
> 		$tmp[2] = "";
> 		$tmp[3] = "";
> 		
> 		for($j=0;$j<strlen($vet_lin_dumpfile[2]);$j++){
> 			$car = substr($vet_lin_dumpfile[2],$j,1);
> 			if ($car =="(" || ($p_found[0])){
> 				$p_found[0]=TRUE;
> 				if ($car!=","){
> 					if ($car !="(" && $car!=" "){
> 						$tmp[0] = $tmp[0] . $car;
> 					}
> 				} else {
> 					$p_found[0]=FALSE;
> 				}
> 			} elseif (($car=="0" || $car=="1" || $car=="2" ||
> $car=="3" || $car=="4" || $car=="5" || $car=="6" || $car=="7" || $car=="8"
> || $car=="9" || $car=="-" || $car==".") || ($p_found[1])){
> 				$p_found[1]=TRUE;
> 				if ($car!=","){
> 					$tmp[1] = $tmp[1] . $car;
> 				} else {
> 					break;
> 					$p_found[1]=FALSE;
> 				}
> 			}
> 		}
> 		for($j=0;$j<strlen($vet_lin_dumpfile[3]);$j++){
> 			$car = substr($vet_lin_dumpfile[3],$j,1);
> 			if ($car =="(" || ($p_found[2])){
> 				$p_found[2]=TRUE;
> 				if ($car!=","){
> 					if ($car !="(" && $car!=" "){
> 						$tmp[2] = $tmp[2] . $car;
> 					}
> 				} else {
> 					$p_found[2]=FALSE;
> 				}
> 			} elseif (($car=="0" || $car=="1" || $car=="2" ||
> $car=="3" || $car=="4" || $car=="5" || $car=="6" || $car=="7" || $car=="8"
> || $car=="9" || $car=="-" || $car==".") || ($p_found[3])){
> 				$p_found[3]=TRUE;
> 				if ($car!=","){
> 					$tmp[3] = $tmp[3] . $car;
> 				} else {
> 					break;
> 					$p_found[3]=FALSE;
> 				}
> 			}
> 		}
> 		return $tmp;
> 	}
> }
> /***************************************************************************
> **********/
> 
> regards
> 
> Eduardo Patto Kanegae
> eduardopk at vcp.com.br <mailto:eduardopk at vcp.com.br> 
> Time Planejamento - UNIDADE LA - Ramal 9126
> eduardo at scopotecnologia.com.br <mailto:eduardo at scopotecnologia.com.br> 
> http://www.scopotecnologia.com.br
> 
> 
> -----Mensagem original-----
> De: Dean Gadoury [mailto:gadoury at dmsolutions.ca]
> Enviada em: quinta-feira, 22 de agosto de 2002 11:32
> Para: Mike Smith; mapserver-users at lists.gis.umn.edu
> Assunto: RE: [mapserver-users] Anybody have updated Mapserver
> Utilities??
> 
> 
> Mike, have you tried MapLab? You can get information about it and download
> it at the following address:
> http://www.dmsolutions.on.ca/maplab.html
> 
> 
> -----Original Message-----
> From: owner-mapserver-users at lists.gis.umn.edu
> [mailto:owner-mapserver-users at lists.gis.umn.edu]On Behalf Of Mike Smith
> Sent: Thursday, August 22, 2002 10:26 AM
> To: mapserver-users at lists.gis.umn.edu
> Subject: [mapserver-users] Anybody have updated Mapserver Utilities??
> 
> 
> Hello,
> 
>     I have been beating my head against the wall trying to find
> utilities that will ease the development of Mapserver web pages to no
> avail!  I have downloaded and tried all the utilities on the Mapserver
> home page but they don't work with my version of Mapserver!  I'm running
> the latest stable version, 3.6.1, on a Sun box running Solaris 8.  I've
> got mapserver working fine and the demo worked fine and mapplet works
> fine in my demo, the only thing is that the "Mapserver Workbench"
> developer told me that he has not updated his tool since Mapserver
> 3.4.x, so I can't use that, and "MapUtils" appears to be for old
> versions of Arcview and old versions of Mapserver as well!  The files it
> generates don't work with my version of Mapserver.  Has anybody updated
> Maputils, or any other tool for that matter, to work with Mapserver
> 3.6.1?  I'd like to have something that generates the ".map" files out
> of ArcView at the very minimum, but I'll take whatever I can get in lieu
> of writing those config files manually!
> 
> HELP?!?!?!
> 
> 





More information about the mapserver-users mailing list