[Chameleon] dynamic mapfile

anthony farrant anthony.k.farrant at gmail.com
Mon Apr 23 04:32:24 EDT 2007


Thanks Julien! Works like a charm.
The only modification I had to make was to make the shapefileObj write
directly the points instead of passing it the lineObj and shapeObj.

I know this is a laborious and inelegant solution compared to PostGIS. I'm
going to try to switch our system over to PG in a not to far away future.

Thanks again,

A




On 4/20/07, Julien-Samuel Lacroix <jlacroix at mapgears.com> wrote:
>
> Hi,
> If you want to query your dynamic data, you'll have to create a
> temporary shapfile. You can't insert attributes in the the inline
> feature other than the text. To create a new shapefile, put the shape
> object you were adding to your layer features in a shapefile object.
> Than to add attributes, you'll have to create a separate DBF files.
> Here's a sample code:
>
> $aDbfStruct =   array(
>                         array( 'id'       ,'N', 7, 0),
>                         array( 'specie'       ,'C', 50),
>                         array( 'country'      ,'C', 50)
>                       );
> $dbfFile = dbase_create( $szFileName.'.dbf', $aDbfStruct);
>
> $shpFile = ms_newShapeFileObj( $szFileName, -2 );
> $oShp = ms_newShapeObj(MS_SHP_LINE);
> $oLine = ms_newLineObj();
> $nPoints = count($aPoints);
> for ( $i=0; $i<$nPoints; $i++ )
> {
>      $oLine->addXY($aPoints[$i]['x'], $aPoints[$i]['y']);
> }
> $oShp->add( $oLine );
> $oLine->free();
> $shpFile->addShape($oShp);
> $oShp->free();
> dbase_add_record( $dbfFile, array_values( 1, 'specie', 'country' ) );
> dbase_close($dbfFile);
>
>
> You can also manage everything in a PostGIS, but that's a different world.
>
> Julien
>
>
>
> anthony farrant wrote:
> > Hi guys,
> >
> > I succeeded in creating dynamic layers by dynamically creating a mapfile
> > with *INLINE FEATURES* and passing it as an argument to the
> > initialization script. Works fine with the exception that:
> >
> > I can't add other attributes than the coordinates (latitude & longitude)
> > and by consequence I cannot make the layer queryable.
> >
> > I was wondering if it was possible to add attributes (like in a
> > shapefile: country, species name, source) to the layer with the "INLINE
> > FEATURES technique".
> >
> > If not is it possible to add queryable attributes (like in a shapefile:
> > country, species name, source) to a dynamically created layer with
> > MAPSCRIPT.
> >
> > I know these attributes usually come in a "dbf"-file but is it possible
> > to associate these with  a dynamic layer?
> >
> > I'm kind of stuck at this point so any kind of help is welcome.
> >
> > Have a nice weekend y'all,
> >
> > Anthony
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Chameleon mailing list
> > Chameleon at lists.maptools.org
> > http://lists.maptools.org/mailman/listinfo/chameleon
>
> --
> Julien-Samuel Lacroix
> Mapgears
> http://www.mapgears.com/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/chameleon/attachments/20070423/07eb11c3/attachment.html


More information about the Chameleon mailing list