XElement gml = XElement.Parse(
@"<features><feature fid=""142"" featuretype=""school"" description=""A middle school"">
<polygon name=""extent"" srsname=""epsg:27354"">
<linestring name=""extent"" srsname=""epsg:27354"">
<cdata>
491888.999999459,5458045.99963358 491904.999999458,5458044.99963358
491908.999999462,5458064.99963358 491924.999999461,5458064.99963358
491925.999999462,5458079.99963359 491977.999999466,5458120.9996336
491953.999999466,5458017.99963357 </cdata>
</linestring>
</polygon>
</feature><feature fid=""143"" featuretype=""house"" description=""a house"">
<polygon name=""extent"" srsname=""epsg:27354"">
<linestring name=""extent"" srsname=""epsg:27354"">
<cdata>
491888.999999459,5458045.99963358 491904.999999458,5458044.99963358
491908.999999462,5458064.99963358 491924.999999461,5458064.99963358
491925.999999462,5458079.99963359 491977.999999466,5458120.9996336
491953.999999466,5458017.99963357 </cdata>
</linestring>
</polygon>
</feature></features>");
//Seleziono la feature con fid = 143
var query = from p in gml.Elements("feature") where (int)p.Attribute("fid") == 143 select p;
//visualizzo i suoi attributi
foreach (var rec in query)
Console.WriteLine("Feature: type:{0} - description: {1}", rec.Attribute("featureType").Value, rec.Attribute("Description").Value);
Nessun commento:
Posta un commento