[mapserver-users] Add points to shape
Stephen Woodbridge
woodbri at swoodbridge.com
Thu May 16 11:34:28 PDT 2002
Well, I could be wrong, but I think you are mistaken about the .shx
file. It is an index to the start of each shape object in the file that
is addressible by the object number and is not related to the dbf file
at all.
Because the shape objects can ve variable sizes based on the kind of
shape and the amount of data defined the .shx file just makes it faster
and easier to locate the position of the record in the .shp file. the
relationship between the .dbf and the .shp file is simply that rec n of
the .dbf is related to rec n of the .shp
-Steve
Puneet Kishor wrote:
>
> On Thursday, May 16, 2002, at 04:33 AM, Stepan Kafka wrote:
>
> > You must add record to dbf separately by means of php_dbase modul
> > functions.
> > You are also able to add attributes here etc.. at this point.
>
> well, you can't just add a shape to the .shp file and a dbase record to
> the .dbf file and have them correlate. remember, they are linked
> together by the interim .shx file. I haven't done this, but I am
> assuming the shape adding method automatically creates a linked, empty
> dbf record.
>
> in any case, I think Guillaume is wanting to draw "annotations"... just
> for temporary display. In which case, he would want to add shapes, not
> in the ESRI shapes sense, but shapes in the geometric (or non-geom)
> shapes sense.
>
> pk/
>
> >
> > Stepan Kafka
> >
> >> -----Pùvodní zpráva-----
> >> Od: owner-mapserver-users at lists.gis.umn.edu
> >> [mailto:owner-mapserver-users at lists.gis.umn.edu]za uivatele Guillaume
> >> Sueur
> >> Odesláno: 16. kvìtna 2002 10:11
> >> Komu: Liste MapServer
> >> Pøedmìt: [mapserver-users] Add points to shape
> >>
> >>
> >> Hi there,
> >> I'm trying to build up an application able to add points to a shape
> >> using
> >> mapscript. I'm using these two methods :
> >>
> >> function creerPoint($Xpt,$Ypt)
> >> {
> >> GLOBAL $gpoMap;
> >>
> >> $flnShapefile = "c:\inetpub\wwwroot\ipso_facto\htdocs\data\logipro";
> >> $objShapefile = ms_newShapeFileObj( $flnShapefile, MS_SHP_POINT);
> >> $oLayer = $gpoMap->getlayerbyname(BIENS);
> >>
> >> //methode 1
> >> //$point = ms_newPointObj();
> >> //$point->setXY($Xpt,$Ypt);
> >> //$objShapefile->addPoint($point);
> >> //$objShapefile->free;
> >>
> >> //methode 2
> >> $point = ms_newPointObj();
> >> $point->setXY($Xpt,$Ypt);
> >> $line = ms_newlineObj();
> >> $shape = ms_newshapeObj(MS_SHAPE_POINT);
> >> $line->add($point);
> >> $shape->add($line);
> >> $objShapefile->addshape($shape);
> >> $objShapefile->free;
> >> }
> >>
> >> Both methods are doing the same : they add a point in the shape
> >> file, but no
> >> line in the dbf file, so the layer is corrupted and can't be opened.
> >> Addfeature seems to do the same.
> >>
> >> Any idea ?
> >>
> >> Thanks
> >>
> >> ----------------------------------------------------
> >> Guillaume SUEUR - guillaume.sueur at geosignal.fr
> >> Ingénieur développement
> >> GEOSIGNAL
> >> 25bis, avenue Marcel DASSAULT
> >> BP 5836
> >> 31505 TOULOUSE CEDEX
> >> ------------------------------------------------------
> >>
> >>
More information about the MapServer-users
mailing list