RES: [Mapserver-users] Dynamic creation of shapefiles ...

Lowell Filak lfilak at medinaco.org
Fri Feb 6 09:40:52 EST 2004


Murilo

Try using shpinfo to verify that there are the same number of shapes as
there are dbf records.
The shpinfo output should also tell you what the extents of the
shapefile are.
HTH

Lowell

The following message was sent by "Murilo Lacerda Yoshida"
<murilo.yoshida at agx.com.br> on Thu, 5 Feb 2004 19:28:46 -0200.

>   Sorry for not posting the email to the list...
>   The shapefile is created, but I don't know how to check if it is
> right. The only way I know to do this is displaying it on the
> application, but it is not working. The dbf file is right.
>   I have another doubt. How do I know the minscale and the maxscale of a
> shapefile created dynamically? I was thinking that this could be the
> problem, so I changed this settings to a great scale (2+001 -> minscale
> and 2+100 -> maxscale). I don't know, but I think that this values are
> big...
>   Thanks,
>     Murilo
> 
> -----Mensagem original-----
> De: Lowell Filak [mailto:lfilak at medinaco.org] 
> Enviada em: quinta-feira, 5 de fevereiro de 2004 19:21
> Para: Murilo Lacerda Yoshida; mapserver-users at lists.gis.umn.edu
> Assunto: RES: [Mapserver-users] Dynamic creation of shapefiles ...
> 
> I don't readily see anything but I'm not familiar with all the methods
> your using so I'm forwarding this to the list.
> Do you already have logging turned on or do you know for certain that
> the shapefile is created successfully?
> 
> Lowell
> 
> The following message was sent by "Murilo Lacerda Yoshida"
> <murilo.yoshida at agx.com.br> on Thu, 5 Feb 2004 18:54:49 -0200.
> 
> >   This is the function I use to do the shapefile...
> > 
> > 	function fazerShape()
> > 	{
> > 		$shape = ms_newShapefileObj($this->path_to_data .
> > $this->shapeFile, MS_SHP_POLYGON);
> > 		
> > 		$def = array( array("ID", "N", 5, 0), array("NOME", "C",
> > 128), array("PATH", "C", 1024) );
> > 		$objDbf = dbase_create($this->path_to_data .
> > $this->shapeFile . ".dbf", $def);
> > 		
> > 		if ($objDbf !== false)
> > 		{
> > 			$k = 0;
> > 			foreach($this->talhao as $chave=>$valor)
> > 			{
> > 				$objShape =
> > ms_newShapeObj(MS_SHAPE_POLYGON);
> > 				$objLine = ms_newLineObj();
> > 				
> > 				for ($i = 0; $i <
> > $this->maximos[$chave]; $i++)
> > 				{
> > 					$lat = $this->lat[$chave][$i];
> > 					$long = $this->long[$chave][$i];
> > 					
> > 					if ($lat > $this->maxY)
> > 						$this->maxY = $lat;
> > 					if ($lat < $this->minY)
> > 						$this->minY = $lat;
> > 					if ($long > $this->maxX)
> > 						$this->maxX = $long;
> > 					if ($long < $this->minX)
> > 						$this->minX = $long;
> > 						
> > 					$objLine->addXY($lat, $long);
> > 				}
> > 				
> > 				$lat = $this->lat[$chave][0];
> > 				$long = $this->long[$chave][0];
> > 				
> > 				$objLine->addXY($lat, $long);
> > 
> > 				$objShape->add($objLine);
> > 				$objLine->free();
> > 				$shape->addShape($objShape);
> > 				$objShape->free();
> > 				
> > 				$k++;
> > 				$reg = array($k, $this->talhao[$chave],
> > $this->path[$chave]);
> > 				dbase_add_record($objDbf, $reg);
> > 			}
> > 			
> > 			$shape->free();
> > 			dbase_close($objDbf);
> > 		}
> > 
> > 	}
> > 
> > This is the one where I try to add all the points to one line and then
> > add the line to the shape and then the shape to the shapefile ...
> > 
> > 
> > 
> > -----Mensagem original-----
> > De: Lowell Filak [mailto:lfilak at medinaco.org] 
> > Enviada em: quinta-feira, 5 de fevereiro de 2004 18:43
> > Para: Murilo Lacerda Yoshida; mapserver-users at lists.gis.umn.edu
> > Assunto: Re: [Mapserver-users] Dynamic creation of shapefiles ...
> > 
> > You may want to include some of your code, as the method you are using
> > should work.
> > 
> > Lowell
> > 
> > The following message was sent by "Murilo Lacerda Yoshida"
> > <murilo.yoshida at agx.com.br> on Thu, 5 Feb 2004 18:10:26 -0200.
> > 
> > >   Hi all,
> > >   I am trying to create dynamically a shapefile, with polygon
> shapes,
> > > but I am having trouble to do it.
> > >   If I understood the documentation, I have to do several lines with
> > the
> > > points that I have, and add one by one to the shape object, and then
> > add
> > > the shape object to the shapefile, is that correct?
> > >   I tried this way, but it didn't work. SO I tried to do a line with
> > all
> > > my points and then add this line to my shape object, and then add
> this
> > > shape object to the shapefile object. Still don't work.
> > >   Am I doing something wrong? I saw once a example at the mapserver
> > wiki
> > > about this, but I couldn't find it again.
> > >   Thanks in advance,
> > >       Murilo
> > > 
> > 
> > 
> > 
> > 
> 
> 
> 
> 
> 
> _______________________________________________
> 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