MIcho,
Please, open http://gis.supranet.hr/mapguide/mapagent/index.html click on Resource->GetResourceContent Maybe your feature source is set to rtead only. I had the same problem in past couple of days. From: [email protected] [mailto:[email protected]] On Behalf Of Micho Gar Sent: Monday, March 02, 2009 6:44 PM To: MapGuide Users Mail List Subject: [mapguide-users] Polygon are not recorded in feature Hi all, I have a code that should save the polygons in the feature source after using the Digitize. In principle I do not give any error, but when reviewing the shp the polygon don´t appear. I leave with you the code because I don´t see anything bad. MgUserInformation userInfo = new MgUserInformation(sessionId); MgSiteConnection siteConnection = new MgSiteConnection(); siteConnection.Open(userInfo); MgResourceService resourceService = (MgResourceService)siteConnection.CreateService(MgServiceType.ResourceService); MgFeatureService featureService = (MgFeatureService)siteConnection.CreateService(MgServiceType.FeatureService); MgResourceIdentifier zonasFeatureId = new MgResourceIdentifier("Library://ConectorGPS/Datos/poligonosZonas.FeatureSource"); MgFeatureCommandCollection zonasComando = new MgFeatureCommandCollection(); //Abrimos el mapa MgMap mapa = new MgMap(); mapa.Open(resourceService, mapName); //creamos la geometria MgGeometryFactory geometryFactory = new MgGeometryFactory(); MgCoordinateCollection coordinateCollection = new MgCoordinateCollection(); //MgLinearRingCollection interiorRingCollection = new MgLinearRingCollection(); MgAgfReaderWriter geometryReaderWriter = new MgAgfReaderWriter(); int count = xCollection.length; for(int i=0; i<count;i++) { Double x = Double.valueOf(xCollection[i]); Double y = Double.valueOf(yCollection[i]); MgCoordinate coordinate = geometryFactory.CreateCoordinateXY(x,y); coordinateCollection.Add(coordinate); } MgLinearRing exteriorRing = geometryFactory.CreateLinearRing(coordinateCollection); MgPolygon polygon = geometryFactory.CreatePolygon(exteriorRing,null); MgByteReader geom = geometryReaderWriter.Write(polygon); //creamos una coleccion de propiedades y la insertamos MgPropertyCollection propiedades = new MgPropertyCollection(); propiedades.Add(new MgGeometryProperty("Geometry", geom)); propiedades.Add(new MgStringProperty("ID", "zona1")); zonasComando.Add(new MgInsertFeatures("zonasCapa", propiedades)); featureService.UpdateFeatures(zonasFeatureId, zonasComando, false); //capturamos la capa para salvar el mapa y refrescar MgLayerBase zonasCapa = mapa.GetLayers().GetItem("zonasCapa"); zonasCapa.SetVisible(true); zonasCapa.ForceRefresh(); mapa.Save(resourceService); out.println("finish"); Thanks -- # michogar # Analista Programador SIG # Ubuntu Linux Counter 462666 "Cuenta una leyenda que si reproduces un DVD de Windows Vista original al revés se oye a Bill Gates entonando cantos satánicos... Pero eso no es lo peor... Si lo reproduces del derecho... ¡Se instala!." "It has a legend that if you play an original Windows Vista DVD backwards to hear Bill Gates Satanic chanting songs ... But that's not the worst ... If you play it right ... It installs!.
_______________________________________________ mapguide-users mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/mapguide-users
