RES: [Mapserver-users] Dynamic creation of shapefiles ...
Lowell Filak
lfilak at medinaco.org
Thu Feb 5 13:20:43 PST 2004
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
> >
>
>
>
>
More information about the MapServer-users
mailing list