<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office"><head><!--[if gte mso 9]><xml><o:OfficeDocumentSettings><o:AllowPNG/><o:PixelsPerInch>96</o:PixelsPerInch></o:OfficeDocumentSettings></xml><![endif]--></head><body><div style="color:#000; background-color:#fff; font-family:Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:13px"><div id="yui_3_16_0_ym19_1_1502378801080_12453">Once you have the shape object, you can access the associative array values to retrieve the desired value by attribute name. <br id="yui_3_16_0_ym19_1_1502378801080_12454"></div><div id="yui_3_16_0_ym19_1_1502378801080_12455"><br id="yui_3_16_0_ym19_1_1502378801080_12456"></div><div class="yahoo-link-enhancr-card yahoo-link-enhancr-not-allow-cover ymail-preserve-class ymail-preserve-style" style="max-width:400px;font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;" data-url="http://mapserver.org/mapscript/php/phpmapscript.html#shapeobj" data-type="yenhancr" data-category="article" data-embed-url="" data-size="medium" dir="ltr" id="yui_3_16_0_ym19_1_1502378801080_12462" contenteditable="false"> <a href="http://mapserver.org/mapscript/php/phpmapscript.html#shapeobj" style="text-decoration:none !important; color: #000 !important" target="_blank" rel="noreferrer" id="yui_3_16_0_ym19_1_1502378801080_12463"> <table class="yahoo-compose-table-card" style="max-width:400px;" id="yui_3_16_0_ym19_1_1502378801080_12464" cellspacing="0" cellpadding="0" border="0"> <tbody id="yui_3_16_0_ym19_1_1502378801080_12465"><tr id="yui_3_16_0_ym19_1_1502378801080_12466"> <td id="yui_3_16_0_ym19_1_1502378801080_12467" width="400">  </td> </tr> </tbody></table> </a></div>The values array is an associative array with the attribute values for
this shape.  It is set only on shapes obtained from layer->getShape().
The key to the values in the array is the attribute name, e.g.<div id="yui_3_16_0_ym19_1_1502378801080_12479"><div id="yui_3_16_0_ym19_1_1502378801080_12480"><pre id="yui_3_16_0_ym19_1_1502378801080_12481"><span id="yui_3_16_0_ym19_1_1502378801080_12482"></span><span id="yui_3_16_0_ym19_1_1502378801080_12483">$population = $shape->values["Population"];</span>
</pre></div><div dir="ltr" id="yui_3_16_0_ym19_1_1502378801080_12484">
</div></div><div id="yui_3_16_0_ym19_1_1502378801080_12485"><span id="yui_3_16_0_ym19_1_1502378801080_12486">Taken from <br></span></div><div id="yui_3_16_0_ym19_1_1502378801080_12980"><span id="yui_3_16_0_ym19_1_1502378801080_12486"><br></span></div><div id="yui_3_16_0_ym19_1_1502378801080_12985" dir="ltr"><span id="yui_3_16_0_ym19_1_1502378801080_12486"><a href="http://mapserver.org/mapscript/php/phpmapscript.html#shapeobj" class="enhancr2_921a76ff-919f-e266-02be-4baa5b3405b6" id="yui_3_16_0_ym19_1_1502378801080_13019">PHP MapScript API — MapServer 7.0.6 documentation</a><br></span></div><div id="yui_3_16_0_ym19_1_1502378801080_13027"><br></div><div id="enhancr2_921a76ff-919f-e266-02be-4baa5b3405b6" class="yahoo-link-enhancr-card yahoo-link-enhancr-not-allow-cover ymail-preserve-class ymail-preserve-style" style="max-width:400px;font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;" data-url="http://mapserver.org/mapscript/php/phpmapscript.html#shapeobj" data-type="yenhancr" data-category="article" data-embed-url="" data-size="medium" dir="ltr" contenteditable="false"> <a href="http://mapserver.org/mapscript/php/phpmapscript.html#shapeobj" style="text-decoration:none !important; color: #000 !important" class="yahoo-enhancr-cardlink" target="_blank" rel="noreferrer" id="yui_3_16_0_ym19_1_1502378801080_13037"> <table class="card-wrapper" style="max-width:400px;" id="yui_3_16_0_ym19_1_1502378801080_13036" cellspacing="0" cellpadding="0" border="0"> <tbody id="yui_3_16_0_ym19_1_1502378801080_13035"><tr id="yui_3_16_0_ym19_1_1502378801080_13034"> <td id="yui_3_16_0_ym19_1_1502378801080_13033" width="400"> <table class="card-info" style="background:#fff;max-width:400px;border:1px solid #e0e4e9;border-bottom:3px solid #000000;" id="yui_3_16_0_ym19_1_1502378801080_13032" width="100%" cellspacing="0" cellpadding="0" border="0"> <tbody id="yui_3_16_0_ym19_1_1502378801080_13031"><tr id="yui_3_16_0_ym19_1_1502378801080_13030"> <td style="vertical-align:top;padding:16px 0 16px 12px;">  </td> <td style="vertical-align:middle;padding:16px 12px;width:99%;" id="yui_3_16_0_ym19_1_1502378801080_13029"> <h2 class="card-title" style="margin:0 0 4px 0;font-size:16px;font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;word-break:break-word;" id="yui_3_16_0_ym19_1_1502378801080_13028">PHP MapScript API — MapServer 7.0.6 documentation</h2>  <div class="card-description" style="font-size:11px;line-height:15px;color:#999;word-break:break-word;"></div> </td> <td class="card-share-container"></td> </tr> </tbody></table> </td> </tr> </tbody></table> </a></div><div><br></div><div id="yui_3_16_0_ym19_1_1502378801080_13176"><span id="yui_3_16_0_ym19_1_1502378801080_12486"><br id="yui_3_16_0_ym19_1_1502378801080_12487"></span></div><div id="yui_3_16_0_ym19_1_1502378801080_12488"><span id="yui_3_16_0_ym19_1_1502378801080_12489">Cheers</span></div><div id="yui_3_16_0_ym19_1_1502378801080_12490"><span id="yui_3_16_0_ym19_1_1502378801080_12491"><br id="yui_3_16_0_ym19_1_1502378801080_12492"></span></div><div dir="ltr" id="yui_3_16_0_ym19_1_1502378801080_12493"><span id="yui_3_16_0_ym19_1_1502378801080_12494"><a href="http://www.linkedin.com/in/cruizch" id="yui_3_16_0_ym19_1_1502378801080_12495">Carlos Ruiz</a><br id="yui_3_16_0_ym19_1_1502378801080_12496"></span></div><div id="yui_3_16_0_ym19_1_1502378801080_12497"><br id="yui_3_16_0_ym19_1_1502378801080_12498"></div><div class="yahoo-link-enhancr-card  ymail-preserve-class ymail-preserve-style" style="max-width:400px;font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;" data-url="http://www.linkedin.com/in/cruizch" data-type="yenhancr" data-category="article" data-embed-url="" data-size="medium" dir="ltr" id="yui_3_16_0_ym19_1_1502378801080_12499" contenteditable="false"> <a href="http://www.linkedin.com/in/cruizch" style="text-decoration:none !important; color: #000 !important;" target="_blank" rel="noreferrer" id="yui_3_16_0_ym19_1_1502378801080_12500"> <table class="yahoo-ignore-table" style="max-width:400px;" id="yui_3_16_0_ym19_1_1502378801080_12501" cellspacing="0" cellpadding="0" border="0"> <tbody id="yui_3_16_0_ym19_1_1502378801080_12502"><tr id="yui_3_16_0_ym19_1_1502378801080_12503"> <td id="yui_3_16_0_ym19_1_1502378801080_12504" width="400"> <table class="yahoo-ignore-table" style="max-width:400px;" id="yui_3_16_0_ym19_1_1502378801080_12505" width="100%" cellspacing="0" cellpadding="0" border="0"> <tbody id="yui_3_16_0_ym19_1_1502378801080_12506"><tr id="yui_3_16_0_ym19_1_1502378801080_12507"> <td style="background:#000 url('https://s.yimg.com/vv//api/res/1.2/jxomgo.89LCoBhuRqqJLdQ--/YXBwaWQ9bWFpbDtmaT1maWxsO2g9MjAwO3c9NDAw/https://media.licdn.com/mpr/mpr/shrinknp_200_200/p/3/000/124/223/3db14ba.jpg.cf.jpg') no-repeat center center;background-size:cover;min-height:200px;position:relative;" id="yui_3_16_0_ym19_1_1502378801080_12508" valign="top" bgcolor="#000000" background="https://s.yimg.com/vv//api/res/1.2/jxomgo.89LCoBhuRqqJLdQ--/YXBwaWQ9bWFpbDtmaT1maWxsO2g9MjAwO3c9NDAw/https://media.licdn.com/mpr/mpr/shrinknp_200_200/p/3/000/124/223/3db14ba.jpg.cf.jpg">  <table class="yahoo-ignore-table" valign="top" style="width:100%;" id="yui_3_16_0_ym19_1_1502378801080_12509" cellspacing="0" cellpadding="0" border="0"> <tbody id="yui_3_16_0_ym19_1_1502378801080_12510"><tr id="yui_3_16_0_ym19_1_1502378801080_12511"> <td style="background:transparent url('https://s.yimg.com/nq/storm/assets/enhancrV2/12/overlay-tile.png') repeat left top;min-height:200px;" id="yui_3_16_0_ym19_1_1502378801080_12512" valign="top" bgcolor="transparent" background="https://s.yimg.com/nq/storm/assets/enhancrV2/12/overlay-tile.png">  <table class="yahoo-ignore-table" style="width:100%;min-height:185px;min-height:185px;" id="yui_3_16_0_ym19_1_1502378801080_12513" height="185"> <tbody id="yui_3_16_0_ym19_1_1502378801080_12514"><tr id="yui_3_16_0_ym19_1_1502378801080_12515"> <td style="text-align:left;text-align:left;padding:15px 0 0 15px;vertical-align:top;" id="yui_3_16_0_ym19_1_1502378801080_12516">  </td> <td style="text-align:right;padding:15px 15px 0 0;vertical-align:top;" id="yui_3_16_0_ym19_1_1502378801080_12517"> <div id="yui_3_16_0_ym19_1_1502378801080_12518"></div> </td> </tr> </tbody></table>  </td> </tr> </tbody></table> </td> </tr> <tr id="yui_3_16_0_ym19_1_1502378801080_12519"> <td id="yui_3_16_0_ym19_1_1502378801080_12520"> <table class="yahoo-ignore-table" style="background:#fff;position:relative;z-index:2;width:95%;max-width:380px;border:1px solid #e0e4e9;border-bottom:3px solid #0077b5;margin-top:-40px;margin-left:auto;margin-right:auto;" id="yui_3_16_0_ym19_1_1502378801080_12521" cellspacing="0" cellpadding="0" border="0" align="center"> <tbody id="yui_3_16_0_ym19_1_1502378801080_12522"><tr id="yui_3_16_0_ym19_1_1502378801080_12523"> <td style="background-color:#ffffff;padding:16px 0 16px 12px;vertical-align:top;" id="yui_3_16_0_ym19_1_1502378801080_12524"> <img class="card-object-1 yahoo-ignore-inline-image ymail-preserve-class" src="https://s.yimg.com/nq/storm/assets/enhancrV2/23/logos/linkedin.png" style="min-width:32px;border:1px solid #e0e4e9;margin-top:3px;" data-id="8f4ebd83-0208-300a-1652-9710b901fa3e" id="yui_3_16_0_ym19_1_1502378801080_12525" height="32">  </td> <td style="vertical-align:middle;padding:16px 12px;width:99%;" id="yui_3_16_0_ym19_1_1502378801080_12526"> <h2 style="font-size: 16px; line-height:19px; margin:0 0 4px 0;font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;word-break:break-word;" id="yui_3_16_0_ym19_1_1502378801080_12527">Carlos Ruiz</h2>  <div style="font-size:11px;line-height:15px;color:#999;word-break:break-word;" id="yui_3_16_0_ym19_1_1502378801080_12528">View Carlos Ruiz’s professional profile on LinkedIn. LinkedIn is the world's largest business network, helpi...</div> </td> <td style="text-align:right;padding:16px 12px 16px 0;" id="yui_3_16_0_ym19_1_1502378801080_12529">  </td> </tr> </tbody></table> </td> </tr> </tbody></table> </td> </tr> </tbody></table> </a></div><div id="yui_3_16_0_ym19_1_1502378801080_12530"><br id="yui_3_16_0_ym19_1_1502378801080_12531"></div><div class="qtdSeparateBR"><br><br></div><div class="yahoo_quoted" id="yui_3_16_0_ym19_1_1502378801080_12314" style="display: block;">  <div style="font-family: Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 13px;" id="yui_3_16_0_ym19_1_1502378801080_12313"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;" id="yui_3_16_0_ym19_1_1502378801080_12312"> <div dir="ltr" id="yui_3_16_0_ym19_1_1502378801080_12311"> <font id="yui_3_16_0_ym19_1_1502378801080_12316" size="2" face="Arial"> <hr id="yui_3_16_0_ym19_1_1502378801080_12315" size="1"> <b><span style="font-weight:bold;">From:</span></b> swathi v <swathiv.mca@gmail.com><br> <b><span style="font-weight: bold;">To:</span></b> mapserver-users@lists.osgeo.org <br> <b><span style="font-weight: bold;">Sent:</span></b> Thursday, August 10, 2017 3:34 AM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [mapserver-users] Getting attributes from a shapefile from     Mapscript/PhP (Mapserver)<br> </font> </div> <div class="y_msg_container" id="yui_3_16_0_ym19_1_1502378801080_12552"><br><div id="yiv5763153420"><div id="yui_3_16_0_ym19_1_1502378801080_12557"><div dir="ltr" id="yui_3_16_0_ym19_1_1502378801080_12556"><div id="yui_3_16_0_ym19_1_1502378801080_12555"><div id="yui_3_16_0_ym19_1_1502378801080_12554"><div id="yui_3_16_0_ym19_1_1502378801080_12553">Hi,<br clear="none"><br clear="none"></div>Thank you. Now, I am able to retrieve the layer attributes using the getItems() method.<br clear="none"><br clear="none"></div>Now I want to retrieve the values under each attribute for that layer.<br clear="none"><br clear="none"></div>For example, want to retrieve the values under the attribute, Name of a layer by name "states".<br clear="none"><div><br clear="none"><div>Thanks & Regards, <br clear="none"></div><div class="yiv5763153420gmail-m_4017168431355418168gmail_signature">- swathi.m</div></div></div><div class="yiv5763153420gmail_extra"><br clear="none"><div class="yiv5763153420yqt1303230575" id="yiv5763153420yqt12986"><div class="yiv5763153420gmail_quote">On Thu, Aug 3, 2017 at 3:47 PM, swathi v <span dir="ltr"><<a rel="nofollow" shape="rect" ymailto="mailto:swathiv.mca@gmail.com" target="_blank" href="mailto:swathiv.mca@gmail.com">swathiv.mca@gmail.com</a>></span> wrote:<br clear="none"><blockquote class="yiv5763153420gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div dir="ltr"><div><div><div>Hi,<br clear="none"><br clear="none"></div>I have a shapefile/vector file as Layer in the .map file. <br clear="none"><br clear="none"></div>Now, I want to get all the attributes of that shapefile in my Mapscript/PhP and display them on the browser.<br clear="none"><br clear="none"></div>For example, a shapefile has the attributes as Name, Type, Width. Now I want to get these attributes from that layer dynamically from my PhP/Mapscript code.<br clear="none"><div><div><div><br clear="all"><div>So please let me know how to get attributes from a shapefile from Mapscript/PhP.</div><div><br clear="none"></div><div><br clear="none"></div><div>Thanks & Regards, <br clear="none"></div><div><div class="yiv5763153420m_4017168431355418168gmail_signature">- swathi.m</div>
</div></div></div></div></div>
</blockquote></div></div><br clear="none"><br clear="all"><br clear="none">-- <br clear="none"><div class="yiv5763153420gmail_signature">- swathi.m</div>
</div></div></div><div class="yqt1303230575" id="yqt73552">_______________________________________________<br clear="none">mapserver-users mailing list<br clear="none"><a shape="rect" ymailto="mailto:mapserver-users@lists.osgeo.org" href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a><br clear="none"><a shape="rect" href="https://lists.osgeo.org/mailman/listinfo/mapserver-users" target="_blank">https://lists.osgeo.org/mailman/listinfo/mapserver-users</a></div><br><br></div> </div> </div>  </div></div></body></html>