| 1 | using System;
|
|---|
| 2 | using System.Collections.Generic;
|
|---|
| 3 | using System.Text;
|
|---|
| 4 | using OSGeo.MapServer;
|
|---|
| 5 |
|
|---|
| 6 | namespace mssql2008Test
|
|---|
| 7 | {
|
|---|
| 8 | class Program
|
|---|
| 9 | {
|
|---|
| 10 | static void Main(string[] args)
|
|---|
| 11 | {
|
|---|
| 12 | mapObj map = new mapObj(@"E:\projects\mssql2008\bin\test2008.map");
|
|---|
| 13 | layerObj layer = map.getLayer(0);
|
|---|
| 14 | layer.queryByAttributes(map, null, "((ID=26124) or (ID=35906))", 1);
|
|---|
| 15 |
|
|---|
| 16 | using (resultCacheObj results = layer.getResults())
|
|---|
| 17 | {
|
|---|
| 18 | if (results != null && results.numresults > 0)
|
|---|
| 19 | {
|
|---|
| 20 | // extracting the features found
|
|---|
| 21 | layer.open();
|
|---|
| 22 |
|
|---|
| 23 | resultCacheMemberObj res;
|
|---|
| 24 | shapeObj shape;
|
|---|
| 25 |
|
|---|
| 26 | System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding();
|
|---|
| 27 |
|
|---|
| 28 | for (int j = 0; j < results.numresults; j++)
|
|---|
| 29 | {
|
|---|
| 30 | res = results.getResult(j);
|
|---|
| 31 | shape = layer.getFeature(res.shapeindex, res.tileindex);
|
|---|
| 32 | if (shape != null)
|
|---|
| 33 | {
|
|---|
| 34 | Console.WriteLine("\nFeature, OID=" + res.shapeindex);
|
|---|
| 35 |
|
|---|
| 36 | for (int k = 0; k < layer.numitems; k++)
|
|---|
| 37 | {
|
|---|
| 38 | Console.WriteLine(" " + layer.getItem(k) + " = " + shape.getValue(k));
|
|---|
| 39 | }
|
|---|
| 40 | }
|
|---|
| 41 | }
|
|---|
| 42 | layer.close();
|
|---|
| 43 | }
|
|---|
| 44 | }
|
|---|
| 45 | }
|
|---|
| 46 | }
|
|---|
| 47 | }
|
|---|