Excellent Josh, im really very thankful for your help.<div>i will try and then i will write to tell how it was.</div><div>Please, sorry for my bad english!!!!<br><br><div class="gmail_quote">2010/4/21 Joshua Hevenor <span dir="ltr"><<a href="mailto:jhevenor@rogers.com">jhevenor@rogers.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div><div style="font-family:times new roman,new york,times,serif;font-size:12pt"><div>It doesn't say anything in the PHP mapscript doc that would prevent this from working but I haven't done it this way. <br>
<br>If I was iterating through all shapes I would have a mapfile with the shapefile defined as a layer and use code like the the example the LayerObj::nextShape() documentation:<br><br><pre><span>$map = ms_newmapobj("d:/msapps/gmap-ms40/htdocs/gmap75.map");</span><br>
<span>$layer = $map->getLayerByName('road');</span><br><span>$status = $layer->open();</span><br><span>$status = $layer->whichShapes($map->extent);</span><br><span>while ($shape = $layer->nextShape())</span><br>
<span>{</span><br><span> echo $shape->index ."<br>\n";</span><br><span>}</span><br><span>$layer->close();</span><br><br><br><span style="font-family:bookman old style,new york,times,serif">I think the $layer->open is key to making the attributes available. </span><br style="font-family:bookman old style,new york,times,serif">
<span style="font-family:bookman old style,new york,times,serif">LayerObj::open() states that it will "Open the layer fo<span style="font-family:times new roman,new york,times,serif">r use with getShape()". Someone else may be able to offer a better explanation, </span><br style="font-family:times new roman,new york,times,serif">
<span style="font-family:times new roman,new york,times,serif">but at least this approach has worked for me in the past.</span></span></pre><br><br></div><div style="font-family:times new roman,new york,times,serif;font-size:12pt">
<br><div style="font-family:times new roman,new york,times,serif;font-size:12pt"><font size="2" face="Tahoma"><div class="im"><hr size="1"><b><span style="font-weight:bold">From:</span></b> Pedro Arriondo <<a href="mailto:pedroaa10@gmail.com" target="_blank">pedroaa10@gmail.com</a>><br>
</div><b><span style="font-weight:bold">To:</span></b> Joshua Hevenor <<a href="mailto:jhevenor@rogers.com" target="_blank">jhevenor@rogers.com</a>>; <a href="mailto:mapserver-users@lists.osgeo.org" target="_blank">mapserver-users@lists.osgeo.org</a><br>
<b><span style="font-weight:bold">Sent:</span></b> Wed, April 21, 2010 7:35:59 AM<br><b><span style="font-weight:bold">Subject:</span></b> Re: [mapserver-users] Reading shapefile's attributes<br></font><div><div></div>
<div class="h5"><br>First, thanks Josh for your answer.<div>I tell you that the the file it's good, because i use it in my job with Mapserver. </div><div>Too i can access to attributes with library dbase from PHP. (dbase_open,...dbase_get_record_with_names,...)</div>
<div>So.... i don't know how to continue....</div><div><br><br><div class="gmail_quote">2010/4/20 Joshua Hevenor <span dir="ltr"><<a rel="nofollow" href="mailto:jhevenor@rogers.com" target="_blank">jhevenor@rogers.com</a>></span><br>
<blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">
<div><div style="font-family:times new roman,new york,times,serif;font-size:12pt"><div><span>You can check that the shapefile has attributes using the command line tool ogrinfo. <a rel="nofollow" href="http://www.gdal.org/ogrinfo.html" target="_blank">http://www.gdal.org/ogrinfo.html</a></span><br>
You can check on spelling of fields, etc. It might as least get you started. <br><br>Cheers, <br>Josh<br></div><div style="font-family:times new roman,new york,times,serif;font-size:12pt"><br><div style="font-family:times new roman,new york,times,serif;font-size:12pt">
<font size="2" face="Tahoma"><hr size="1"><b><span style="font-weight:bold">From:</span></b> Pedro Arriondo <<a rel="nofollow" href="mailto:pedroaa10@gmail.com" target="_blank">pedroaa10@gmail.com</a>><br><b><span style="font-weight:bold">To:</span></b> <a rel="nofollow" href="mailto:mapserver-users@lists.osgeo.org" target="_blank">mapserver-users@lists.osgeo.org</a><br>
<b><span style="font-weight:bold">Sent:</span></b> Tue, April 20, 2010 2:36:15
PM<br><b><span style="font-weight:bold">Subject:</span></b> [mapserver-users] Reading shapefile's attributes<br></font><div><div></div><div><br>Hi friends, i writte from Argentina.<div><br></div><div>I'd like read attributes from a shapefile but i get "nothing", however i can read very good the geometries.</div>
<div>My code:</div><div><div><br></div>
<div>$shpFile = ms_newShapeFileObj( $_SERVER["DOCUMENT_ROOT"]."/zonas", -1); //my shapefile in disc</div><div>echo $shpFile->numshapes; //8 -> it's right!!</div><div><br></div><div>$oShape = $shpFile->getShape(0); //get first object</div>
<div><br></div><div>//..but....:</div><div>echo $oShape->numvalues; //0, however it has 2 values: "CODIGO" and "NOMBRE"</div><div>echo $oShape->values["CODIGO"]; //Here get empty (value is 4)</div>
<div><br></div><div><br></div><div><span style="font-family:arial,sans-serif;font-size:13px;border-collapse:collapse"> Thanks in advance!!!!.</span></div><div><font face="arial, sans-serif"><span style="border-collapse:collapse"><br>
</span></font></div><div><font face="arial, sans-serif"><span style="border-collapse:collapse">Pedro.</span></font></div><div><br></div></div>
</div></div></div></div>
</div></div></blockquote></div><br></div>
</div></div></div></div>
</div></div></blockquote></div><br></div>