<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
The "UpdateFeatures" call does not throw exceptions, <br>
even if the call fails, try to examine the return value, <br>
and search the mailing lists for the exact description.<br>
<pre class="moz-signature" cols="72">Regards, Kenneth Skovhede, GEOGRAF A/S
</pre>
<br>
<br>
Micho Gar skrev:
<blockquote
 cite="mid:5b9547fb0903020943j282c6918l4ffc67ec8f514dc2@mail.gmail.com"
 type="cite">Hi all, <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; <br>
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&acute;t appear. I leave with you the code
because I don&acute;t see anything bad.<br>
  <br>
MgUserInformation userInfo = new MgUserInformation(sessionId);<br>
MgSiteConnection siteConnection = new MgSiteConnection();<br>
siteConnection.Open(userInfo);<br>
  <br>
MgResourceService resourceService =
(MgResourceService)siteConnection.CreateService(MgServiceType.ResourceService);<br>
MgFeatureService featureService =
(MgFeatureService)siteConnection.CreateService(MgServiceType.FeatureService);<br>
  <br>
MgResourceIdentifier zonasFeatureId = new
MgResourceIdentifier("Library://ConectorGPS/Datos/poligonosZonas.FeatureSource");<br>
MgFeatureCommandCollection zonasComando = new
MgFeatureCommandCollection();<br>
  <br>
//Abrimos el mapa<br>
MgMap mapa = new MgMap();<br>
mapa.Open(resourceService, mapName);<br>
  <br>
//creamos la geometria<br>
MgGeometryFactory geometryFactory = new MgGeometryFactory();<br>
MgCoordinateCollection coordinateCollection = new
MgCoordinateCollection();<br>
//MgLinearRingCollection interiorRingCollection = new
MgLinearRingCollection();<br>
MgAgfReaderWriter geometryReaderWriter = new MgAgfReaderWriter();<br>
  <br>
int count = xCollection.length;<br>
for(int i=0; i&lt;count;i++)<br>
{<br>
&nbsp;&nbsp;&nbsp; Double x = Double.valueOf(xCollection[i]);<br>
&nbsp;&nbsp;&nbsp; Double y = Double.valueOf(yCollection[i]);<br>
&nbsp;&nbsp;&nbsp; MgCoordinate&nbsp; coordinate = geometryFactory.CreateCoordinateXY(x,y);<br>
&nbsp;&nbsp;&nbsp; coordinateCollection.Add(coordinate);<br>
}<br>
MgLinearRing exteriorRing =
geometryFactory.CreateLinearRing(coordinateCollection);<br>
MgPolygon polygon = geometryFactory.CreatePolygon(exteriorRing,null);<br>
MgByteReader geom = geometryReaderWriter.Write(polygon);<br>
  <br>
//creamos una coleccion de propiedades y la insertamos<br>
MgPropertyCollection propiedades = new MgPropertyCollection();<br>
propiedades.Add(new MgGeometryProperty("Geometry", geom));<br>
propiedades.Add(new MgStringProperty("ID", "zona1"));<br>
zonasComando.Add(new MgInsertFeatures("zonasCapa", propiedades));<br>
  <br>
featureService.UpdateFeatures(zonasFeatureId, zonasComando, false);<br>
  <br>
//capturamos la capa para salvar el mapa y refrescar<br>
MgLayerBase zonasCapa = mapa.GetLayers().GetItem("zonasCapa");<br>
zonasCapa.SetVisible(true);<br>
zonasCapa.ForceRefresh();<br>
mapa.Save(resourceService);&nbsp;&nbsp;&nbsp; <br>
out.println("finish");<br>
  <br>
  <br>
Thanks<br clear="all">
  <br>
-- <br>
# michogar<br>
# Analista Programador SIG<br>
# Ubuntu Linux Counter 462666<br>
  <br>
  <br>
  <br>
"Cuenta una leyenda que si reproduces un DVD de Windows Vista original
al rev&eacute;s se oye a Bill Gates entonando cantos sat&aacute;nicos... Pero eso no
es lo peor... Si lo reproduces del derecho... &iexcl;Se instala!."<br>
  <br>
  <br>
"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!. <br>
  <pre wrap="">
<hr size="4" width="90%">
_______________________________________________
mapguide-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:mapguide-users@lists.osgeo.org">mapguide-users@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/mapguide-users">http://lists.osgeo.org/mailman/listinfo/mapguide-users</a>
  </pre>
</blockquote>
</body>
</html>