Thanks Julien! Works like a charm.<br>The only modification I had to make was to make the shapefileObj write directly the points instead of passing it the lineObj and shapeObj.<br><br>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.
<br><br>Thanks again,<br><br>A<br><br><br><br><br><div><span class="gmail_quote">On 4/20/07, <b class="gmail_sendername">Julien-Samuel Lacroix</b> <<a href="mailto:jlacroix@mapgears.com">jlacroix@mapgears.com</a>> wrote:
</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi,<br>If you want to query your dynamic data, you'll have to create a<br>temporary shapfile. You can't insert attributes in the the inline
<br>feature other than the text. To create a new shapefile, put the shape<br>object you were adding to your layer features in a shapefile object.<br>Than to add attributes, you'll have to create a separate DBF files.<br>
Here's a sample code:<br><br>$aDbfStruct = array(<br> array( 'id' ,'N', 7, 0),<br> array( 'specie' ,'C', 50),<br> array( 'country' ,'C', 50)
<br> );<br>$dbfFile = dbase_create( $szFileName.'.dbf', $aDbfStruct);<br><br>$shpFile = ms_newShapeFileObj( $szFileName, -2 );<br>$oShp = ms_newShapeObj(MS_SHP_LINE);<br>$oLine = ms_newLineObj();
<br>$nPoints = count($aPoints);<br>for ( $i=0; $i<$nPoints; $i++ )<br>{<br> $oLine->addXY($aPoints[$i]['x'], $aPoints[$i]['y']);<br>}<br>$oShp->add( $oLine );<br>$oLine->free();<br>$shpFile->addShape($oShp);
<br>$oShp->free();<br>dbase_add_record( $dbfFile, array_values( 1, 'specie', 'country' ) );<br>dbase_close($dbfFile);<br><br><br>You can also manage everything in a PostGIS, but that's a different world.
<br><br>Julien<br><br><br><br>anthony farrant wrote:<br>> Hi guys,<br>><br>> I succeeded in creating dynamic layers by dynamically creating a mapfile<br>> with *INLINE FEATURES* and passing it as an argument to the
<br>> initialization script. Works fine with the exception that:<br>><br>> I can't add other attributes than the coordinates (latitude & longitude)<br>> and by consequence I cannot make the layer queryable.
<br>><br>> I was wondering if it was possible to add attributes (like in a<br>> shapefile: country, species name, source) to the layer with the "INLINE<br>> FEATURES technique".<br>><br>> If not is it possible to add queryable attributes (like in a shapefile:
<br>> country, species name, source) to a dynamically created layer with<br>> MAPSCRIPT.<br>><br>> I know these attributes usually come in a "dbf"-file but is it possible<br>> to associate these with a dynamic layer?
<br>><br>> I'm kind of stuck at this point so any kind of help is welcome.<br>><br>> Have a nice weekend y'all,<br>><br>> Anthony<br>><br>><br>> ------------------------------------------------------------------------
<br>><br>> _______________________________________________<br>> Chameleon mailing list<br>> <a href="mailto:Chameleon@lists.maptools.org">Chameleon@lists.maptools.org</a><br>> <a href="http://lists.maptools.org/mailman/listinfo/chameleon">
http://lists.maptools.org/mailman/listinfo/chameleon</a><br><br>--<br>Julien-Samuel Lacroix<br>Mapgears<br><a href="http://www.mapgears.com/">http://www.mapgears.com/</a><br></blockquote></div><br>