[mapguide-users] Polygon are not recorded in feature

Micho Gar michogar at gmail.com
Wed Mar 4 11:22:34 EST 2009


Thanks to all,

this the XML for this resource

<FeatureSource xsi:noNamespaceSchemaLocation="FeatureSource-1.0.0.xsd">
<Provider>OSGeo.SHP</Provider>
-
<Parameter>
<Name>DefaultFileLocation</Name>
<Value>%MG_DATA_PATH_ALIAS[datos]%poligonos/zonas.shp</Value>
</Parameter>
-
<Parameter>
<Name>TemporaryFileLocation</Name>
<Value>%MG_DATA_PATH_ALIAS[datos]%temp/</Value>
</Parameter>
</FeatureSource>

I am still looking for that these days I could not get it.






2009/3/3 Ivan Milicevic <Ivan.Milicevic at supranet.hr>

>  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:* mapguide-users-bounces at lists.osgeo.org [mailto:
> mapguide-users-bounces at lists.osgeo.org] *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
> mapguide-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>
>


-- 
# 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!.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapguide-users/attachments/20090304/8a102cea/attachment.html


More information about the mapguide-users mailing list