Hello Simon,<div><br></div><div>thank you for the code sample! Did you need to develop any additional tools for adding features (e.g. edit tool)?</div><div><br></div><div>I am not a developer, but would really like to test this on adding new polygons (SHP) through the MGOS 2.x web client.</div>
<div><br></div><div>Thanks, I will try it out.</div><div><br></div><div>Dejan<br><br><div class="gmail_quote">On Fri, Nov 6, 2009 at 08:55, Simon Pelicon <span dir="ltr"><<a href="mailto:simon@sl-king.com">simon@sl-king.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div>Hi!</div><div><br></div><div>Here is sample in C# from my code using just FDO .NET API. </div><div>This inserts FEATURE in any FDO datasource specified in my FDO connection (m_Conn) like SHP,SDF, oracle ....</div>
<div>
<br></div><div><br></div>IInsert command = (IInsert)m_base.m_Conn.CreateCommand(CommandType.CommandType_Insert);<div><div>FgfGeometryFactory factory = new FgfGeometryFactory();</div><div>IDirectPosition position = factory.CreatePositionXYZ(X,Y, 0.0);</div>
<div>IPoint point = factory.CreatePoint(position);</div><div>command .PropertyValues.Add(new PropertyValue(GEOMETRY_COLUMN, new GeometryValue(factory.GetFgf(point))));</div><div><div>command .PropertyValues.Add(new PropertyValue(LAYER_COLUMN, new StringValue(bref.Layer)));</div>
<div>command .PropertyValues.Add(new PropertyValue(BLOCK_COLUMN, new StringValue(bref.Name)));</div><div><div>reader = command.Execute();</div><div>if (reader.ReadNext())</div><div>{</div><div> </div></div></div><div>}</div>
<div><br></div><font color="#888888"><div>Simon</div></font><div><div></div><div class="h5"><div><br></div><br><div class="gmail_quote">On Fri, Nov 6, 2009 at 8:27 AM, Dejan Gregor <span dir="ltr"><<a href="mailto:dejan.gregor@gmail.com" target="_blank">dejan.gregor@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dear Fabio,<div><br></div><div>you are saying that with the exsiting FDO it is possible to add geometry to a SHP?</div>
<div><br></div><div>Do you have a sample code for MGOS 2.x also for the interface or maybe a whole project/sln? I am not a programmer, but would like just to test this functionality in MapGuide.</div>
<div><br></div><div>Best regards,</div><div>Dejan<br><br><div class="gmail_quote">On Fri, Nov 6, 2009 at 00:29, Zac Spitzer <span dir="ltr"><<a href="mailto:zac.spitzer@gmail.com" target="_blank">zac.spitzer@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">what's in the string? it's probably an error string<br>
<br>
if your feature source readonly?<br>
<br>
<a href="http://trac.osgeo.org/mapguide/ticket/649" target="_blank">http://trac.osgeo.org/mapguide/ticket/649</a><br>
<br>
a very nasty annoying bug<br>
<font color="#888888"><br>
z<br>
</font><div><div></div><div><br>
On Fri, Nov 6, 2009 at 9:45 AM, Jackie Ng <<a href="mailto:jumpinjackie@gmail.com" target="_blank">jumpinjackie@gmail.com</a>> wrote:<br>
><br>
> What does your ReleaseReader() look like?<br>
><br>
> If it's from the samples, it's supposed to close any open MgFeatureReaders<br>
> that may exist in the result returned from MgFeatureService.UpdateFeatures()<br>
><br>
> - Jackie<br>
><br>
><br>
> sekko970 wrote:<br>
>><br>
>> I tryng to add a point to an existing SHP data connection in ASP.Net<br>
>> application, using MG API.<br>
>><br>
>> Dim dataSource as String = "Library://.../MySHP.FeatureSource"<br>
>> Dim dataSourceId As New MgResourceIdentifier(dataSource)<br>
>><br>
>> Dim MyProps As New MgPropertyCollection()<br>
>> Dim agfRW As New MgAgfReaderWriter()<br>
>> Dim geomFactory As New MgGeometryFactory<br>
>><br>
>> Dim myPoint As MgPoint =<br>
>> geomFactory.CreatePoint(geomFactory.CreateCoordinateXY(X, Y))<br>
>><br>
>> 'ID<br>
>> Dim IDProp As New MgInt32Property("FeatID", IDValue)<br>
>> MyProps.Add(IDProp)<br>
>><br>
>> 'MyProp<br>
>> Dim MyProp As New MgDoubleProperty("MyProp", MyPropValue)<br>
>> MyProps.Add(MyProp)<br>
>><br>
>> 'Geometry<br>
>> Dim geomReader As MgByteReader = agfRW.Write(myPoint)<br>
>> Dim geometryProp As New MgGeometryProperty("Geometry", geomReader)<br>
>> MyProps.Add(geometryProp)<br>
>><br>
>> Dim propCollection As New MgBatchPropertyCollection()<br>
>> propCollection.Add(MyProps)<br>
>><br>
>> Dim commands As New MgFeatureCommandCollection()<br>
>> commands.Add(New MgInsertFeatures(MyFeatureName, propCollection))<br>
>><br>
>> Dim res As MgPropertyCollection = featureSrvc.UpdateFeatures(dataSourceId,<br>
>> commands, False)<br>
>> ReleaseReader(res, commands)<br>
>><br>
>> In ReleaseReader, I have the following error:<br>
>> Unable to cast object of type 'OSGeo.MapGuide.MgStringProperty' to type<br>
>> 'OSGeo.MapGuide.MgFeatureProperty'.<br>
>><br>
>> In fact, res has only one property of type MgStringProperty: but why?<br>
>><br>
>> Have you any idea where is the error?<br>
>> Thanks, Fabio<br>
>><br>
>><br>
><br>
> --<br>
> View this message in context: <a href="http://n2.nabble.com/Add-geometry-to-SHP-tp3953583p3955574.html" target="_blank">http://n2.nabble.com/Add-geometry-to-SHP-tp3953583p3955574.html</a><br>
> Sent from the MapGuide Users mailing list archive at Nabble.com.<br>
> _______________________________________________<br>
> mapguide-users mailing list<br>
> <a href="mailto:mapguide-users@lists.osgeo.org" target="_blank">mapguide-users@lists.osgeo.org</a><br>
> <a href="http://lists.osgeo.org/mailman/listinfo/mapguide-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/mapguide-users</a><br>
><br>
<br>
<br>
<br>
</div></div><div>--<br>
Zac Spitzer<br>
Solution Architect / Director<br>
Ennoble Consultancy Australia<br>
<a href="http://www.ennoble.com.au" target="_blank">http://www.ennoble.com.au</a><br>
<a href="http://zacster.blogspot.com" target="_blank">http://zacster.blogspot.com</a><br>
+61 405 847 168<br>
_______________________________________________<br>
</div><div><div></div><div>mapguide-users mailing list<br>
<a href="mailto:mapguide-users@lists.osgeo.org" target="_blank">mapguide-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/mapguide-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/mapguide-users</a><br>
</div></div></blockquote></div><br></div>
<br>_______________________________________________<br>
mapguide-users mailing list<br>
<a href="mailto:mapguide-users@lists.osgeo.org" target="_blank">mapguide-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/mapguide-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/mapguide-users</a><br>
<br></blockquote></div><br></div></div></div>
<br>_______________________________________________<br>
mapguide-users mailing list<br>
<a href="mailto:mapguide-users@lists.osgeo.org">mapguide-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/mapguide-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/mapguide-users</a><br>
<br></blockquote></div><br></div>