Thanks you very well My code wasn't working because i've forgotten the layer.open() and layer.close() methods regards
----------------------------------------- Xavier Mauclaire ------------------------------------------------------- -----Message d'origine----- De : Szekeres Tamás [mailto:[EMAIL PROTECTED] Envoyé : jeudi 4 mai 2006 11:48 À : [EMAIL PROTECTED] Cc : [email protected] Objet : Re: mapscript ShapeObj object with postgis layers with c# Hi, Here is a sample code should work for the postgis layers as well: private void DumpResults(layerObj layer) { resultCacheMemberObj res; shapeObj feature; using (resultCacheObj results = layer.getResults()) { if (results != null && results.numresults > 0) { // extracting the features found layer.open(); for (int j=0; j < results.numresults; j++) { res = results.getResult(j); feature = layer.getFeature(res.shapeindex, res.tileindex); if (feature != null) { Trace.WriteLine(layer.name + " (" + feature.index + ")"); for (int i = 0; i < feature.numvalues; i++) { Trace.WriteLine(layer.getItem(i) + "=" + feature.getValue(i)); } } } layer.close(); } } } public void QueryByShape(shapeObj shape) { if (shape != null) { Trace.WriteLine("The query shape is not specified."); return; } try { if (shape.type == MS_SHAPE_TYPE.MS_SHAPE_POLYGON) { map.queryByShape(shape); layerObj layer; for (int i = 0; i < map.numlayers; i++) { layer = map.getLayer(i); if (layer.status != mapscript.MS_OFF) { DumpResults(layer); } } } else { Trace.WriteLine("The query shape must be a polygon."); } } catch (Exception e) { Trace.WriteLine("QueryByShape error: " + e.Message); } } Best Regards, Tamas On Thu, 4 May 2006 09:48:51 +0200, Xavier Mauclaire <[EMAIL PROTECTED]> wrote: >Hi >I'm developping with VS 2003 for windows and mono with c# plateform > >i may have a question cencerning the shapeobj object : Can i use this object >with objects coming from Postgis Layers ? > >If yes how can i get attributes values (all values are empty ) ? > >May the function like querybyshape using data from postgis be retunring >wrong result (Numresults is wrong) . is there any problems with postgis >layer ? >On the other hand i may be mistaken using this function :-) > >Any help will be appreciated > >regards > > >----------------------------------------- > >Xavier Mauclaire > >------------------------------------------------------- > > > > > > ____________________________________________________________________________ ___ Anyák napja - ugye nem felejti el? http://www.bookline.hu/control/shlist?id=60&affiliate=freanykar2482 __________ Information NOD32 1.1519 (20060504) __________ Ce message a ete verifie par NOD32 Antivirus System. http://www.nod32.com
