Add geometry to SHP

14 messages Options
Embed this post
Permalink
sekko970

Add geometry to SHP

Reply Threaded More More options
Print post
Permalink
I tryng to add a point to an existing SHP data connection in ASP.Net application, using MG API.

Dim dataSource as String = "Library://.../MySHP.FeatureSource"
Dim dataSourceId As New MgResourceIdentifier(dataSource)

Dim MyProps As New MgPropertyCollection()
Dim agfRW As New MgAgfReaderWriter()
Dim geomFactory As New MgGeometryFactory

Dim myPoint As MgPoint = geomFactory.CreatePoint(geomFactory.CreateCoordinateXY(X, Y))

'ID
Dim IDProp As New MgInt32Property("FeatID", IDValue)
MyProps.Add(IDProp)

'MyProp
Dim MyProp As New MgDoubleProperty("MyProp", MyPropValue)
MyProps.Add(MyProp)

'Geometry
Dim geomReader As MgByteReader = agfRW.Write(myPoint)
Dim geometryProp As New MgGeometryProperty("Geometry", geomReader)
MyProps.Add(geometryProp)

Dim propCollection As New MgBatchPropertyCollection()
propCollection.Add(MyProps)

Dim commands As New MgFeatureCommandCollection()
commands.Add(New MgInsertFeatures(MyFeatureName, propCollection))

Dim res As MgPropertyCollection = featureSrvc.UpdateFeatures(dataSourceId, commands, False)
ReleaseReader(res, commands)

In ReleaseReader, I have the following error:
Unable to cast object of type 'OSGeo.MapGuide.MgStringProperty' to type 'OSGeo.MapGuide.MgFeatureProperty'.

In fact, res has only one property of type MgStringProperty: but why?

Have you any idea where is the error?
Thanks, Fabio
Jackie Ng

Re: Add geometry to SHP

Reply Threaded More More options
Print post
Permalink
What does your ReleaseReader() look like?

If it's from the samples, it's supposed to close any open MgFeatureReaders that may exist in the result returned from MgFeatureService.UpdateFeatures()

- Jackie

sekko970 wrote:
I tryng to add a point to an existing SHP data connection in ASP.Net application, using MG API.

Dim dataSource as String = "Library://.../MySHP.FeatureSource"
Dim dataSourceId As New MgResourceIdentifier(dataSource)

Dim MyProps As New MgPropertyCollection()
Dim agfRW As New MgAgfReaderWriter()
Dim geomFactory As New MgGeometryFactory

Dim myPoint As MgPoint = geomFactory.CreatePoint(geomFactory.CreateCoordinateXY(X, Y))

'ID
Dim IDProp As New MgInt32Property("FeatID", IDValue)
MyProps.Add(IDProp)

'MyProp
Dim MyProp As New MgDoubleProperty("MyProp", MyPropValue)
MyProps.Add(MyProp)

'Geometry
Dim geomReader As MgByteReader = agfRW.Write(myPoint)
Dim geometryProp As New MgGeometryProperty("Geometry", geomReader)
MyProps.Add(geometryProp)

Dim propCollection As New MgBatchPropertyCollection()
propCollection.Add(MyProps)

Dim commands As New MgFeatureCommandCollection()
commands.Add(New MgInsertFeatures(MyFeatureName, propCollection))

Dim res As MgPropertyCollection = featureSrvc.UpdateFeatures(dataSourceId, commands, False)
ReleaseReader(res, commands)

In ReleaseReader, I have the following error:
Unable to cast object of type 'OSGeo.MapGuide.MgStringProperty' to type 'OSGeo.MapGuide.MgFeatureProperty'.

In fact, res has only one property of type MgStringProperty: but why?

Have you any idea where is the error?
Thanks, Fabio
zspitzer

Re: Add geometry to SHP

Reply Threaded More More options
Print post
Permalink
what's in the string? it's probably an error string

if your feature source readonly?

http://trac.osgeo.org/mapguide/ticket/649

a very nasty annoying bug

z

On Fri, Nov 6, 2009 at 9:45 AM, Jackie Ng <[hidden email]> wrote:

>
> What does your ReleaseReader() look like?
>
> If it's from the samples, it's supposed to close any open MgFeatureReaders
> that may exist in the result returned from MgFeatureService.UpdateFeatures()
>
> - Jackie
>
>
> sekko970 wrote:
>>
>> I tryng to add a point to an existing SHP data connection in ASP.Net
>> application, using MG API.
>>
>> Dim dataSource as String = "Library://.../MySHP.FeatureSource"
>> Dim dataSourceId As New MgResourceIdentifier(dataSource)
>>
>> Dim MyProps As New MgPropertyCollection()
>> Dim agfRW As New MgAgfReaderWriter()
>> Dim geomFactory As New MgGeometryFactory
>>
>> Dim myPoint As MgPoint =
>> geomFactory.CreatePoint(geomFactory.CreateCoordinateXY(X, Y))
>>
>> 'ID
>> Dim IDProp As New MgInt32Property("FeatID", IDValue)
>> MyProps.Add(IDProp)
>>
>> 'MyProp
>> Dim MyProp As New MgDoubleProperty("MyProp", MyPropValue)
>> MyProps.Add(MyProp)
>>
>> 'Geometry
>> Dim geomReader As MgByteReader = agfRW.Write(myPoint)
>> Dim geometryProp As New MgGeometryProperty("Geometry", geomReader)
>> MyProps.Add(geometryProp)
>>
>> Dim propCollection As New MgBatchPropertyCollection()
>> propCollection.Add(MyProps)
>>
>> Dim commands As New MgFeatureCommandCollection()
>> commands.Add(New MgInsertFeatures(MyFeatureName, propCollection))
>>
>> Dim res As MgPropertyCollection = featureSrvc.UpdateFeatures(dataSourceId,
>> commands, False)
>> ReleaseReader(res, commands)
>>
>> In ReleaseReader, I have the following error:
>> Unable to cast object of type 'OSGeo.MapGuide.MgStringProperty' to type
>> 'OSGeo.MapGuide.MgFeatureProperty'.
>>
>> In fact, res has only one property of type MgStringProperty: but why?
>>
>> Have you any idea where is the error?
>> Thanks, Fabio
>>
>>
>
> --
> View this message in context: http://n2.nabble.com/Add-geometry-to-SHP-tp3953583p3955574.html
> Sent from the MapGuide Users mailing list archive at Nabble.com.
> _______________________________________________
> mapguide-users mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>



--
Zac Spitzer
Solution Architect / Director
Ennoble Consultancy Australia
http://www.ennoble.com.au
http://zacster.blogspot.com
+61 405 847 168
_______________________________________________
mapguide-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/mapguide-users
Dejan Gregor

Re: Add geometry to SHP

Reply Threaded More More options
Print post
Permalink
Dear Fabio,

you are saying that with the exsiting FDO it is possible to add geometry to a SHP?

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.

Best regards,
Dejan

On Fri, Nov 6, 2009 at 00:29, Zac Spitzer <[hidden email]> wrote:
what's in the string? it's probably an error string

if your feature source readonly?

http://trac.osgeo.org/mapguide/ticket/649

a very nasty annoying bug

z

On Fri, Nov 6, 2009 at 9:45 AM, Jackie Ng <[hidden email]> wrote:
>
> What does your ReleaseReader() look like?
>
> If it's from the samples, it's supposed to close any open MgFeatureReaders
> that may exist in the result returned from MgFeatureService.UpdateFeatures()
>
> - Jackie
>
>
> sekko970 wrote:
>>
>> I tryng to add a point to an existing SHP data connection in ASP.Net
>> application, using MG API.
>>
>> Dim dataSource as String = "Library://.../MySHP.FeatureSource"
>> Dim dataSourceId As New MgResourceIdentifier(dataSource)
>>
>> Dim MyProps As New MgPropertyCollection()
>> Dim agfRW As New MgAgfReaderWriter()
>> Dim geomFactory As New MgGeometryFactory
>>
>> Dim myPoint As MgPoint =
>> geomFactory.CreatePoint(geomFactory.CreateCoordinateXY(X, Y))
>>
>> 'ID
>> Dim IDProp As New MgInt32Property("FeatID", IDValue)
>> MyProps.Add(IDProp)
>>
>> 'MyProp
>> Dim MyProp As New MgDoubleProperty("MyProp", MyPropValue)
>> MyProps.Add(MyProp)
>>
>> 'Geometry
>> Dim geomReader As MgByteReader = agfRW.Write(myPoint)
>> Dim geometryProp As New MgGeometryProperty("Geometry", geomReader)
>> MyProps.Add(geometryProp)
>>
>> Dim propCollection As New MgBatchPropertyCollection()
>> propCollection.Add(MyProps)
>>
>> Dim commands As New MgFeatureCommandCollection()
>> commands.Add(New MgInsertFeatures(MyFeatureName, propCollection))
>>
>> Dim res As MgPropertyCollection = featureSrvc.UpdateFeatures(dataSourceId,
>> commands, False)
>> ReleaseReader(res, commands)
>>
>> In ReleaseReader, I have the following error:
>> Unable to cast object of type 'OSGeo.MapGuide.MgStringProperty' to type
>> 'OSGeo.MapGuide.MgFeatureProperty'.
>>
>> In fact, res has only one property of type MgStringProperty: but why?
>>
>> Have you any idea where is the error?
>> Thanks, Fabio
>>
>>
>
> --
> View this message in context: http://n2.nabble.com/Add-geometry-to-SHP-tp3953583p3955574.html
> Sent from the MapGuide Users mailing list archive at Nabble.com.
> _______________________________________________
> mapguide-users mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>



--
Zac Spitzer
Solution Architect / Director
Ennoble Consultancy Australia
http://www.ennoble.com.au
http://zacster.blogspot.com
+61 405 847 168
_______________________________________________


_______________________________________________
mapguide-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/mapguide-users
__

Dejan Gregor, MSc
GISc Researcher and Consultant

http://www.linkedin.com/in/dgregor 
Simon Pelicon

Re: Add geometry to SHP

Reply Threaded More More options
Print post
Permalink
Hi!

Here is sample in C# from my code using just  FDO .NET API. 
This inserts FEATURE in any FDO datasource specified in my FDO connection (m_Conn) like SHP,SDF, oracle ....


IInsert command = (IInsert)m_base.m_Conn.CreateCommand(CommandType.CommandType_Insert);
FgfGeometryFactory factory = new FgfGeometryFactory();
IDirectPosition position = factory.CreatePositionXYZ(X,Y, 0.0);
IPoint point = factory.CreatePoint(position);
command .PropertyValues.Add(new PropertyValue(GEOMETRY_COLUMN, new GeometryValue(factory.GetFgf(point))));
command .PropertyValues.Add(new PropertyValue(LAYER_COLUMN, new StringValue(bref.Layer)));
command .PropertyValues.Add(new PropertyValue(BLOCK_COLUMN, new StringValue(bref.Name)));
reader = command.Execute();
if (reader.ReadNext())
{
   
}

Simon


On Fri, Nov 6, 2009 at 8:27 AM, Dejan Gregor <[hidden email]> wrote:
Dear Fabio,

you are saying that with the exsiting FDO it is possible to add geometry to a SHP?

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.

Best regards,
Dejan

On Fri, Nov 6, 2009 at 00:29, Zac Spitzer <[hidden email]> wrote:
what's in the string? it's probably an error string

if your feature source readonly?

http://trac.osgeo.org/mapguide/ticket/649

a very nasty annoying bug

z

On Fri, Nov 6, 2009 at 9:45 AM, Jackie Ng <[hidden email]> wrote:
>
> What does your ReleaseReader() look like?
>
> If it's from the samples, it's supposed to close any open MgFeatureReaders
> that may exist in the result returned from MgFeatureService.UpdateFeatures()
>
> - Jackie
>
>
> sekko970 wrote:
>>
>> I tryng to add a point to an existing SHP data connection in ASP.Net
>> application, using MG API.
>>
>> Dim dataSource as String = "Library://.../MySHP.FeatureSource"
>> Dim dataSourceId As New MgResourceIdentifier(dataSource)
>>
>> Dim MyProps As New MgPropertyCollection()
>> Dim agfRW As New MgAgfReaderWriter()
>> Dim geomFactory As New MgGeometryFactory
>>
>> Dim myPoint As MgPoint =
>> geomFactory.CreatePoint(geomFactory.CreateCoordinateXY(X, Y))
>>
>> 'ID
>> Dim IDProp As New MgInt32Property("FeatID", IDValue)
>> MyProps.Add(IDProp)
>>
>> 'MyProp
>> Dim MyProp As New MgDoubleProperty("MyProp", MyPropValue)
>> MyProps.Add(MyProp)
>>
>> 'Geometry
>> Dim geomReader As MgByteReader = agfRW.Write(myPoint)
>> Dim geometryProp As New MgGeometryProperty("Geometry", geomReader)
>> MyProps.Add(geometryProp)
>>
>> Dim propCollection As New MgBatchPropertyCollection()
>> propCollection.Add(MyProps)
>>
>> Dim commands As New MgFeatureCommandCollection()
>> commands.Add(New MgInsertFeatures(MyFeatureName, propCollection))
>>
>> Dim res As MgPropertyCollection = featureSrvc.UpdateFeatures(dataSourceId,
>> commands, False)
>> ReleaseReader(res, commands)
>>
>> In ReleaseReader, I have the following error:
>> Unable to cast object of type 'OSGeo.MapGuide.MgStringProperty' to type
>> 'OSGeo.MapGuide.MgFeatureProperty'.
>>
>> In fact, res has only one property of type MgStringProperty: but why?
>>
>> Have you any idea where is the error?
>> Thanks, Fabio
>>
>>
>
> --
> View this message in context: http://n2.nabble.com/Add-geometry-to-SHP-tp3953583p3955574.html
> Sent from the MapGuide Users mailing list archive at Nabble.com.
> _______________________________________________
> mapguide-users mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>



--
Zac Spitzer
Solution Architect / Director
Ennoble Consultancy Australia
http://www.ennoble.com.au
http://zacster.blogspot.com
+61 405 847 168
_______________________________________________


_______________________________________________
mapguide-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/mapguide-users



_______________________________________________
mapguide-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/mapguide-users
Dejan Gregor

Re: Add geometry to SHP

Reply Threaded More More options
Print post
Permalink
Hello Simon,

thank you for the code sample! Did you need to develop any additional tools for adding features (e.g. edit tool)?

I am not a developer, but would really like to test this on adding new polygons (SHP) through the MGOS 2.x web client.

Thanks, I will try it out.

Dejan

On Fri, Nov 6, 2009 at 08:55, Simon Pelicon <[hidden email]> wrote:
Hi!

Here is sample in C# from my code using just  FDO .NET API. 
This inserts FEATURE in any FDO datasource specified in my FDO connection (m_Conn) like SHP,SDF, oracle ....


IInsert command = (IInsert)m_base.m_Conn.CreateCommand(CommandType.CommandType_Insert);
FgfGeometryFactory factory = new FgfGeometryFactory();
IDirectPosition position = factory.CreatePositionXYZ(X,Y, 0.0);
IPoint point = factory.CreatePoint(position);
command .PropertyValues.Add(new PropertyValue(GEOMETRY_COLUMN, new GeometryValue(factory.GetFgf(point))));
command .PropertyValues.Add(new PropertyValue(LAYER_COLUMN, new StringValue(bref.Layer)));
command .PropertyValues.Add(new PropertyValue(BLOCK_COLUMN, new StringValue(bref.Name)));
reader = command.Execute();
if (reader.ReadNext())
{
   
}

Simon


On Fri, Nov 6, 2009 at 8:27 AM, Dejan Gregor <[hidden email]> wrote:
Dear Fabio,

you are saying that with the exsiting FDO it is possible to add geometry to a SHP?

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.

Best regards,
Dejan

On Fri, Nov 6, 2009 at 00:29, Zac Spitzer <[hidden email]> wrote:
what's in the string? it's probably an error string

if your feature source readonly?

http://trac.osgeo.org/mapguide/ticket/649

a very nasty annoying bug

z

On Fri, Nov 6, 2009 at 9:45 AM, Jackie Ng <[hidden email]> wrote:
>
> What does your ReleaseReader() look like?
>
> If it's from the samples, it's supposed to close any open MgFeatureReaders
> that may exist in the result returned from MgFeatureService.UpdateFeatures()
>
> - Jackie
>
>
> sekko970 wrote:
>>
>> I tryng to add a point to an existing SHP data connection in ASP.Net
>> application, using MG API.
>>
>> Dim dataSource as String = "Library://.../MySHP.FeatureSource"
>> Dim dataSourceId As New MgResourceIdentifier(dataSource)
>>
>> Dim MyProps As New MgPropertyCollection()
>> Dim agfRW As New MgAgfReaderWriter()
>> Dim geomFactory As New MgGeometryFactory
>>
>> Dim myPoint As MgPoint =
>> geomFactory.CreatePoint(geomFactory.CreateCoordinateXY(X, Y))
>>
>> 'ID
>> Dim IDProp As New MgInt32Property("FeatID", IDValue)
>> MyProps.Add(IDProp)
>>
>> 'MyProp
>> Dim MyProp As New MgDoubleProperty("MyProp", MyPropValue)
>> MyProps.Add(MyProp)
>>
>> 'Geometry
>> Dim geomReader As MgByteReader = agfRW.Write(myPoint)
>> Dim geometryProp As New MgGeometryProperty("Geometry", geomReader)
>> MyProps.Add(geometryProp)
>>
>> Dim propCollection As New MgBatchPropertyCollection()
>> propCollection.Add(MyProps)
>>
>> Dim commands As New MgFeatureCommandCollection()
>> commands.Add(New MgInsertFeatures(MyFeatureName, propCollection))
>>
>> Dim res As MgPropertyCollection = featureSrvc.UpdateFeatures(dataSourceId,
>> commands, False)
>> ReleaseReader(res, commands)
>>
>> In ReleaseReader, I have the following error:
>> Unable to cast object of type 'OSGeo.MapGuide.MgStringProperty' to type
>> 'OSGeo.MapGuide.MgFeatureProperty'.
>>
>> In fact, res has only one property of type MgStringProperty: but why?
>>
>> Have you any idea where is the error?
>> Thanks, Fabio
>>
>>
>
> --
> View this message in context: http://n2.nabble.com/Add-geometry-to-SHP-tp3953583p3955574.html
> Sent from the MapGuide Users mailing list archive at Nabble.com.
> _______________________________________________
> mapguide-users mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>



--
Zac Spitzer
Solution Architect / Director
Ennoble Consultancy Australia
http://www.ennoble.com.au
http://zacster.blogspot.com
+61 405 847 168
_______________________________________________


_______________________________________________
mapguide-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/mapguide-users



_______________________________________________
mapguide-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/mapguide-users



_______________________________________________
mapguide-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/mapguide-users
__

Dejan Gregor, MSc
GISc Researcher and Consultant

http://www.linkedin.com/in/dgregor 
sekko970

Re: Add geometry to SHP

Reply Threaded More More options
Print post
Permalink
In reply to this post by Jackie Ng
Hi Jackie,
yes, the ReleaseReader is from the samples.


Jackie Ng wrote:
What does your ReleaseReader() look like?

If it's from the samples, it's supposed to close any open MgFeatureReaders that may exist in the result returned from MgFeatureService.UpdateFeatures()

- Jackie

sekko970 wrote:
I tryng to add a point to an existing SHP data connection in ASP.Net application, using MG API.

Dim dataSource as String = "Library://.../MySHP.FeatureSource"
Dim dataSourceId As New MgResourceIdentifier(dataSource)

Dim MyProps As New MgPropertyCollection()
Dim agfRW As New MgAgfReaderWriter()
Dim geomFactory As New MgGeometryFactory

Dim myPoint As MgPoint = geomFactory.CreatePoint(geomFactory.CreateCoordinateXY(X, Y))

'ID
Dim IDProp As New MgInt32Property("FeatID", IDValue)
MyProps.Add(IDProp)

'MyProp
Dim MyProp As New MgDoubleProperty("MyProp", MyPropValue)
MyProps.Add(MyProp)

'Geometry
Dim geomReader As MgByteReader = agfRW.Write(myPoint)
Dim geometryProp As New MgGeometryProperty("Geometry", geomReader)
MyProps.Add(geometryProp)

Dim propCollection As New MgBatchPropertyCollection()
propCollection.Add(MyProps)

Dim commands As New MgFeatureCommandCollection()
commands.Add(New MgInsertFeatures(MyFeatureName, propCollection))

Dim res As MgPropertyCollection = featureSrvc.UpdateFeatures(dataSourceId, commands, False)
ReleaseReader(res, commands)

In ReleaseReader, I have the following error:
Unable to cast object of type 'OSGeo.MapGuide.MgStringProperty' to type 'OSGeo.MapGuide.MgFeatureProperty'.

In fact, res has only one property of type MgStringProperty: but why?

Have you any idea where is the error?
Thanks, Fabio
sekko970

Re: Add geometry to SHP

Reply Threaded More More options
Print post
Permalink
In reply to this post by Simon Pelicon
Hi Simon,
what I have to do to include in my ASP.NET project FDO .NET API?


Simon Pelicon wrote:
Hi!

Here is sample in C# from my code using just  FDO .NET API.
This inserts FEATURE in any FDO datasource specified in my FDO connection
(m_Conn) like SHP,SDF, oracle ....


IInsert command =
(IInsert)m_base.m_Conn.CreateCommand(CommandType.CommandType_Insert);
FgfGeometryFactory factory = new FgfGeometryFactory();
IDirectPosition position = factory.CreatePositionXYZ(X,Y, 0.0);
IPoint point = factory.CreatePoint(position);
command .PropertyValues.Add(new PropertyValue(GEOMETRY_COLUMN, new
GeometryValue(factory.GetFgf(point))));
command .PropertyValues.Add(new PropertyValue(LAYER_COLUMN, new
StringValue(bref.Layer)));
command .PropertyValues.Add(new PropertyValue(BLOCK_COLUMN, new
StringValue(bref.Name)));
reader = command.Execute();
if (reader.ReadNext())
{

}

Simon


On Fri, Nov 6, 2009 at 8:27 AM, Dejan Gregor <dejan.gregor@gmail.com> wrote:

> Dear Fabio,
>
> you are saying that with the exsiting FDO it is possible to add geometry to
> a SHP?
>
> 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.
>
> Best regards,
> Dejan
>
> On Fri, Nov 6, 2009 at 00:29, Zac Spitzer <zac.spitzer@gmail.com> wrote:
>
>> what's in the string? it's probably an error string
>>
>> if your feature source readonly?
>>
>> http://trac.osgeo.org/mapguide/ticket/649
>>
>> a very nasty annoying bug
>>
>> z
>>
>> On Fri, Nov 6, 2009 at 9:45 AM, Jackie Ng <jumpinjackie@gmail.com> wrote:
>> >
>> > What does your ReleaseReader() look like?
>> >
>> > If it's from the samples, it's supposed to close any open
>> MgFeatureReaders
>> > that may exist in the result returned from
>> MgFeatureService.UpdateFeatures()
>> >
>> > - Jackie
>> >
>> >
>> > sekko970 wrote:
>> >>
>> >> I tryng to add a point to an existing SHP data connection in ASP.Net
>> >> application, using MG API.
>> >>
>> >> Dim dataSource as String = "Library://.../MySHP.FeatureSource"
>> >> Dim dataSourceId As New MgResourceIdentifier(dataSource)
>> >>
>> >> Dim MyProps As New MgPropertyCollection()
>> >> Dim agfRW As New MgAgfReaderWriter()
>> >> Dim geomFactory As New MgGeometryFactory
>> >>
>> >> Dim myPoint As MgPoint =
>> >> geomFactory.CreatePoint(geomFactory.CreateCoordinateXY(X, Y))
>> >>
>> >> 'ID
>> >> Dim IDProp As New MgInt32Property("FeatID", IDValue)
>> >> MyProps.Add(IDProp)
>> >>
>> >> 'MyProp
>> >> Dim MyProp As New MgDoubleProperty("MyProp", MyPropValue)
>> >> MyProps.Add(MyProp)
>> >>
>> >> 'Geometry
>> >> Dim geomReader As MgByteReader = agfRW.Write(myPoint)
>> >> Dim geometryProp As New MgGeometryProperty("Geometry", geomReader)
>> >> MyProps.Add(geometryProp)
>> >>
>> >> Dim propCollection As New MgBatchPropertyCollection()
>> >> propCollection.Add(MyProps)
>> >>
>> >> Dim commands As New MgFeatureCommandCollection()
>> >> commands.Add(New MgInsertFeatures(MyFeatureName, propCollection))
>> >>
>> >> Dim res As MgPropertyCollection =
>> featureSrvc.UpdateFeatures(dataSourceId,
>> >> commands, False)
>> >> ReleaseReader(res, commands)
>> >>
>> >> In ReleaseReader, I have the following error:
>> >> Unable to cast object of type 'OSGeo.MapGuide.MgStringProperty' to type
>> >> 'OSGeo.MapGuide.MgFeatureProperty'.
>> >>
>> >> In fact, res has only one property of type MgStringProperty: but why?
>> >>
>> >> Have you any idea where is the error?
>> >> Thanks, Fabio
>> >>
>> >>
>> >
>> > --
>> > View this message in context:
>> http://n2.nabble.com/Add-geometry-to-SHP-tp3953583p3955574.html
>> > Sent from the MapGuide Users mailing list archive at Nabble.com.
>> > _______________________________________________
>> > mapguide-users mailing list
>> > mapguide-users@lists.osgeo.org
>> > http://lists.osgeo.org/mailman/listinfo/mapguide-users
>> >
>>
>>
>>
>> --
>> Zac Spitzer
>> Solution Architect / Director
>> Ennoble Consultancy Australia
>> http://www.ennoble.com.au
>> http://zacster.blogspot.com
>> +61 405 847 168
>> _______________________________________________
>> mapguide-users mailing list
>> mapguide-users@lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>>
>
>
> _______________________________________________
> mapguide-users mailing list
> mapguide-users@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>
>

_______________________________________________
mapguide-users mailing list
mapguide-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users
Simon Pelicon

Re: Add geometry to SHP

Reply Threaded More More options
Print post
Permalink
Hi!

Add references to this files:

OSGeo.FDO.dll
OSGeo.FDO.Geometry.dll
OSGeo.FDO.Common.dll
OSGeo.FDO.Spatial.dll

simon

On Fri, Nov 6, 2009 at 9:41 AM, sekko970 <[hidden email]> wrote:

Hi Simon,
what I have to do to include in my ASP.NET project FDO .NET API?



Simon Pelicon wrote:
>
> Hi!
>
> Here is sample in C# from my code using just  FDO .NET API.
> This inserts FEATURE in any FDO datasource specified in my FDO connection
> (m_Conn) like SHP,SDF, oracle ....
>
>
> IInsert command =
> (IInsert)m_base.m_Conn.CreateCommand(CommandType.CommandType_Insert);
> FgfGeometryFactory factory = new FgfGeometryFactory();
> IDirectPosition position = factory.CreatePositionXYZ(X,Y, 0.0);
> IPoint point = factory.CreatePoint(position);
> command .PropertyValues.Add(new PropertyValue(GEOMETRY_COLUMN, new
> GeometryValue(factory.GetFgf(point))));
> command .PropertyValues.Add(new PropertyValue(LAYER_COLUMN, new
> StringValue(bref.Layer)));
> command .PropertyValues.Add(new PropertyValue(BLOCK_COLUMN, new
> StringValue(bref.Name)));
> reader = command.Execute();
> if (reader.ReadNext())
> {
>
> }
>
> Simon
>
>
> On Fri, Nov 6, 2009 at 8:27 AM, Dejan Gregor <[hidden email]>
> wrote:
>
>> Dear Fabio,
>>
>> you are saying that with the exsiting FDO it is possible to add geometry
>> to
>> a SHP?
>>
>> 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.
>>
>> Best regards,
>> Dejan
>>
>> On Fri, Nov 6, 2009 at 00:29, Zac Spitzer <[hidden email]> wrote:
>>
>>> what's in the string? it's probably an error string
>>>
>>> if your feature source readonly?
>>>
>>> http://trac.osgeo.org/mapguide/ticket/649
>>>
>>> a very nasty annoying bug
>>>
>>> z
>>>
>>> On Fri, Nov 6, 2009 at 9:45 AM, Jackie Ng <[hidden email]>
>>> wrote:
>>> >
>>> > What does your ReleaseReader() look like?
>>> >
>>> > If it's from the samples, it's supposed to close any open
>>> MgFeatureReaders
>>> > that may exist in the result returned from
>>> MgFeatureService.UpdateFeatures()
>>> >
>>> > - Jackie
>>> >
>>> >
>>> > sekko970 wrote:
>>> >>
>>> >> I tryng to add a point to an existing SHP data connection in ASP.Net
>>> >> application, using MG API.
>>> >>
>>> >> Dim dataSource as String = "Library://.../MySHP.FeatureSource"
>>> >> Dim dataSourceId As New MgResourceIdentifier(dataSource)
>>> >>
>>> >> Dim MyProps As New MgPropertyCollection()
>>> >> Dim agfRW As New MgAgfReaderWriter()
>>> >> Dim geomFactory As New MgGeometryFactory
>>> >>
>>> >> Dim myPoint As MgPoint =
>>> >> geomFactory.CreatePoint(geomFactory.CreateCoordinateXY(X, Y))
>>> >>
>>> >> 'ID
>>> >> Dim IDProp As New MgInt32Property("FeatID", IDValue)
>>> >> MyProps.Add(IDProp)
>>> >>
>>> >> 'MyProp
>>> >> Dim MyProp As New MgDoubleProperty("MyProp", MyPropValue)
>>> >> MyProps.Add(MyProp)
>>> >>
>>> >> 'Geometry
>>> >> Dim geomReader As MgByteReader = agfRW.Write(myPoint)
>>> >> Dim geometryProp As New MgGeometryProperty("Geometry", geomReader)
>>> >> MyProps.Add(geometryProp)
>>> >>
>>> >> Dim propCollection As New MgBatchPropertyCollection()
>>> >> propCollection.Add(MyProps)
>>> >>
>>> >> Dim commands As New MgFeatureCommandCollection()
>>> >> commands.Add(New MgInsertFeatures(MyFeatureName, propCollection))
>>> >>
>>> >> Dim res As MgPropertyCollection =
>>> featureSrvc.UpdateFeatures(dataSourceId,
>>> >> commands, False)
>>> >> ReleaseReader(res, commands)
>>> >>
>>> >> In ReleaseReader, I have the following error:
>>> >> Unable to cast object of type 'OSGeo.MapGuide.MgStringProperty' to
>>> type
>>> >> 'OSGeo.MapGuide.MgFeatureProperty'.
>>> >>
>>> >> In fact, res has only one property of type MgStringProperty: but why?
>>> >>
>>> >> Have you any idea where is the error?
>>> >> Thanks, Fabio
>>> >>
>>> >>
>>> >
>>> > --
>>> > View this message in context:
>>> http://n2.nabble.com/Add-geometry-to-SHP-tp3953583p3955574.html
>>> > Sent from the MapGuide Users mailing list archive at Nabble.com.
>>> > _______________________________________________
>>> > mapguide-users mailing list
>>> > [hidden email]
>>> > http://lists.osgeo.org/mailman/listinfo/mapguide-users
>>> >
>>>
>>>
>>>
>>> --
>>> Zac Spitzer
>>> Solution Architect / Director
>>> Ennoble Consultancy Australia
>>> http://www.ennoble.com.au
>>> http://zacster.blogspot.com
>>> +61 405 847 168
>>> _______________________________________________
>>> mapguide-users mailing list
>>> [hidden email]
>>> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>>>
>>
>>
>> _______________________________________________
>> mapguide-users mailing list
>> [hidden email]
>> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>>
>>
>
> _______________________________________________
> mapguide-users mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>
>

--
View this message in context: http://n2.nabble.com/Add-geometry-to-SHP-tp3953583p3957522.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
_______________________________________________
mapguide-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/mapguide-users


_______________________________________________
mapguide-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/mapguide-users
sekko970

Re: Add geometry to SHP

Reply Threaded More More options
Print post
Permalink
Ok for
OSGeo.FDO.dll
OSGeo.FDO.Geometry.dll
OSGeo.FDO.Common.dll

but if I try to create a reference to OSGeo.FDO.Spatial.dll, I have the following error:
no type libraries were found in the component.

(FDOSpatial.dll is already in my project bin folder).

f.



Simon Pelicon wrote:
Hi!

Add references to this files:

OSGeo.FDO.dll
OSGeo.FDO.Geometry.dll
OSGeo.FDO.Common.dll
OSGeo.FDO.Spatial.dll

simon

On Fri, Nov 6, 2009 at 9:41 AM, sekko970
<fabio.franceschini@techneteam.it>wrote:

>
> Hi Simon,
> what I have to do to include in my ASP.NET project FDO .NET API?
>
>
>
> Simon Pelicon wrote:
> >
> > Hi!
> >
> > Here is sample in C# from my code using just  FDO .NET API.
> > This inserts FEATURE in any FDO datasource specified in my FDO connection
> > (m_Conn) like SHP,SDF, oracle ....
> >
> >
> > IInsert command =
> > (IInsert)m_base.m_Conn.CreateCommand(CommandType.CommandType_Insert);
> > FgfGeometryFactory factory = new FgfGeometryFactory();
> > IDirectPosition position = factory.CreatePositionXYZ(X,Y, 0.0);
> > IPoint point = factory.CreatePoint(position);
> > command .PropertyValues.Add(new PropertyValue(GEOMETRY_COLUMN, new
> > GeometryValue(factory.GetFgf(point))));
> > command .PropertyValues.Add(new PropertyValue(LAYER_COLUMN, new
> > StringValue(bref.Layer)));
> > command .PropertyValues.Add(new PropertyValue(BLOCK_COLUMN, new
> > StringValue(bref.Name)));
> > reader = command.Execute();
> > if (reader.ReadNext())
> > {
> >
> > }
> >
> > Simon
> >
> >
> > On Fri, Nov 6, 2009 at 8:27 AM, Dejan Gregor <dejan.gregor@gmail.com>
> > wrote:
> >
> >> Dear Fabio,
> >>
> >> you are saying that with the exsiting FDO it is possible to add geometry
> >> to
> >> a SHP?
> >>
> >> 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.
> >>
> >> Best regards,
> >> Dejan
> >>
> >> On Fri, Nov 6, 2009 at 00:29, Zac Spitzer <zac.spitzer@gmail.com>
> wrote:
> >>
> >>> what's in the string? it's probably an error string
> >>>
> >>> if your feature source readonly?
> >>>
> >>> http://trac.osgeo.org/mapguide/ticket/649
> >>>
> >>> a very nasty annoying bug
> >>>
> >>> z
> >>>
> >>> On Fri, Nov 6, 2009 at 9:45 AM, Jackie Ng <jumpinjackie@gmail.com>
> >>> wrote:
> >>> >
> >>> > What does your ReleaseReader() look like?
> >>> >
> >>> > If it's from the samples, it's supposed to close any open
> >>> MgFeatureReaders
> >>> > that may exist in the result returned from
> >>> MgFeatureService.UpdateFeatures()
> >>> >
> >>> > - Jackie
> >>> >
> >>> >
> >>> > sekko970 wrote:
> >>> >>
> >>> >> I tryng to add a point to an existing SHP data connection in ASP.Net
> >>> >> application, using MG API.
> >>> >>
> >>> >> Dim dataSource as String = "Library://.../MySHP.FeatureSource"
> >>> >> Dim dataSourceId As New MgResourceIdentifier(dataSource)
> >>> >>
> >>> >> Dim MyProps As New MgPropertyCollection()
> >>> >> Dim agfRW As New MgAgfReaderWriter()
> >>> >> Dim geomFactory As New MgGeometryFactory
> >>> >>
> >>> >> Dim myPoint As MgPoint =
> >>> >> geomFactory.CreatePoint(geomFactory.CreateCoordinateXY(X, Y))
> >>> >>
> >>> >> 'ID
> >>> >> Dim IDProp As New MgInt32Property("FeatID", IDValue)
> >>> >> MyProps.Add(IDProp)
> >>> >>
> >>> >> 'MyProp
> >>> >> Dim MyProp As New MgDoubleProperty("MyProp", MyPropValue)
> >>> >> MyProps.Add(MyProp)
> >>> >>
> >>> >> 'Geometry
> >>> >> Dim geomReader As MgByteReader = agfRW.Write(myPoint)
> >>> >> Dim geometryProp As New MgGeometryProperty("Geometry", geomReader)
> >>> >> MyProps.Add(geometryProp)
> >>> >>
> >>> >> Dim propCollection As New MgBatchPropertyCollection()
> >>> >> propCollection.Add(MyProps)
> >>> >>
> >>> >> Dim commands As New MgFeatureCommandCollection()
> >>> >> commands.Add(New MgInsertFeatures(MyFeatureName, propCollection))
> >>> >>
> >>> >> Dim res As MgPropertyCollection =
> >>> featureSrvc.UpdateFeatures(dataSourceId,
> >>> >> commands, False)
> >>> >> ReleaseReader(res, commands)
> >>> >>
> >>> >> In ReleaseReader, I have the following error:
> >>> >> Unable to cast object of type 'OSGeo.MapGuide.MgStringProperty' to
> >>> type
> >>> >> 'OSGeo.MapGuide.MgFeatureProperty'.
> >>> >>
> >>> >> In fact, res has only one property of type MgStringProperty: but
> why?
> >>> >>
> >>> >> Have you any idea where is the error?
> >>> >> Thanks, Fabio
> >>> >>
> >>> >>
> >>> >
> >>> > --
> >>> > View this message in context:
> >>> http://n2.nabble.com/Add-geometry-to-SHP-tp3953583p3955574.html
> >>> > Sent from the MapGuide Users mailing list archive at Nabble.com.
> >>> > _______________________________________________
> >>> > mapguide-users mailing list
> >>> > mapguide-users@lists.osgeo.org
> >>> > http://lists.osgeo.org/mailman/listinfo/mapguide-users
> >>> >
> >>>
> >>>
> >>>
> >>> --
> >>> Zac Spitzer
> >>> Solution Architect / Director
> >>> Ennoble Consultancy Australia
> >>> http://www.ennoble.com.au
> >>> http://zacster.blogspot.com
> >>> +61 405 847 168
> >>> _______________________________________________
> >>> mapguide-users mailing list
> >>> mapguide-users@lists.osgeo.org
> >>> http://lists.osgeo.org/mailman/listinfo/mapguide-users
> >>>
> >>
> >>
> >> _______________________________________________
> >> mapguide-users mailing list
> >> mapguide-users@lists.osgeo.org
> >> http://lists.osgeo.org/mailman/listinfo/mapguide-users
> >>
> >>
> >
> > _______________________________________________
> > mapguide-users mailing list
> > mapguide-users@lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/mapguide-users
> >
> >
>
> --
> View this message in context:
> http://n2.nabble.com/Add-geometry-to-SHP-tp3953583p3957522.html
> Sent from the MapGuide Users mailing list archive at Nabble.com.
> _______________________________________________
> mapguide-users mailing list
> mapguide-users@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>

_______________________________________________
mapguide-users mailing list
mapguide-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users
Simon Pelicon

Re: Add geometry to SHP

Reply Threaded More More options
Print post
Permalink
You have all this files (also  OSGeo.FDO.Spatial.dll ) in FDO Windows SDK.
download link:

simon

On Fri, Nov 6, 2009 at 10:58 AM, sekko970 <[hidden email]> wrote:

Ok for
OSGeo.FDO.dll
OSGeo.FDO.Geometry.dll
OSGeo.FDO.Common.dll

but if I try to create a reference to OSGeo.FDO.Spatial.dll, I have the
following error:
no type libraries were found in the component.

(FDOSpatial.dll is already in my project bin folder).

f.




Simon Pelicon wrote:
>
> Hi!
>
> Add references to this files:
>
> OSGeo.FDO.dll
> OSGeo.FDO.Geometry.dll
> OSGeo.FDO.Common.dll
> OSGeo.FDO.Spatial.dll
>
> simon
>
> On Fri, Nov 6, 2009 at 9:41 AM, sekko970
> <[hidden email]>wrote:
>
>>
>> Hi Simon,
>> what I have to do to include in my ASP.NET project FDO .NET API?
>>
>>
>>
>> Simon Pelicon wrote:
>> >
>> > Hi!
>> >
>> > Here is sample in C# from my code using just  FDO .NET API.
>> > This inserts FEATURE in any FDO datasource specified in my FDO
>> connection
>> > (m_Conn) like SHP,SDF, oracle ....
>> >
>> >
>> > IInsert command =
>> > (IInsert)m_base.m_Conn.CreateCommand(CommandType.CommandType_Insert);
>> > FgfGeometryFactory factory = new FgfGeometryFactory();
>> > IDirectPosition position = factory.CreatePositionXYZ(X,Y, 0.0);
>> > IPoint point = factory.CreatePoint(position);
>> > command .PropertyValues.Add(new PropertyValue(GEOMETRY_COLUMN, new
>> > GeometryValue(factory.GetFgf(point))));
>> > command .PropertyValues.Add(new PropertyValue(LAYER_COLUMN, new
>> > StringValue(bref.Layer)));
>> > command .PropertyValues.Add(new PropertyValue(BLOCK_COLUMN, new
>> > StringValue(bref.Name)));
>> > reader = command.Execute();
>> > if (reader.ReadNext())
>> > {
>> >
>> > }
>> >
>> > Simon
>> >
>> >
>> > On Fri, Nov 6, 2009 at 8:27 AM, Dejan Gregor <[hidden email]>
>> > wrote:
>> >
>> >> Dear Fabio,
>> >>
>> >> you are saying that with the exsiting FDO it is possible to add
>> geometry
>> >> to
>> >> a SHP?
>> >>
>> >> 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.
>> >>
>> >> Best regards,
>> >> Dejan
>> >>
>> >> On Fri, Nov 6, 2009 at 00:29, Zac Spitzer <[hidden email]>
>> wrote:
>> >>
>> >>> what's in the string? it's probably an error string
>> >>>
>> >>> if your feature source readonly?
>> >>>
>> >>> http://trac.osgeo.org/mapguide/ticket/649
>> >>>
>> >>> a very nasty annoying bug
>> >>>
>> >>> z
>> >>>
>> >>> On Fri, Nov 6, 2009 at 9:45 AM, Jackie Ng <[hidden email]>
>> >>> wrote:
>> >>> >
>> >>> > What does your ReleaseReader() look like?
>> >>> >
>> >>> > If it's from the samples, it's supposed to close any open
>> >>> MgFeatureReaders
>> >>> > that may exist in the result returned from
>> >>> MgFeatureService.UpdateFeatures()
>> >>> >
>> >>> > - Jackie
>> >>> >
>> >>> >
>> >>> > sekko970 wrote:
>> >>> >>
>> >>> >> I tryng to add a point to an existing SHP data connection in
>> ASP.Net
>> >>> >> application, using MG API.
>> >>> >>
>> >>> >> Dim dataSource as String = "Library://.../MySHP.FeatureSource"
>> >>> >> Dim dataSourceId As New MgResourceIdentifier(dataSource)
>> >>> >>
>> >>> >> Dim MyProps As New MgPropertyCollection()
>> >>> >> Dim agfRW As New MgAgfReaderWriter()
>> >>> >> Dim geomFactory As New MgGeometryFactory
>> >>> >>
>> >>> >> Dim myPoint As MgPoint =
>> >>> >> geomFactory.CreatePoint(geomFactory.CreateCoordinateXY(X, Y))
>> >>> >>
>> >>> >> 'ID
>> >>> >> Dim IDProp As New MgInt32Property("FeatID", IDValue)
>> >>> >> MyProps.Add(IDProp)
>> >>> >>
>> >>> >> 'MyProp
>> >>> >> Dim MyProp As New MgDoubleProperty("MyProp", MyPropValue)
>> >>> >> MyProps.Add(MyProp)
>> >>> >>
>> >>> >> 'Geometry
>> >>> >> Dim geomReader As MgByteReader = agfRW.Write(myPoint)
>> >>> >> Dim geometryProp As New MgGeometryProperty("Geometry", geomReader)
>> >>> >> MyProps.Add(geometryProp)
>> >>> >>
>> >>> >> Dim propCollection As New MgBatchPropertyCollection()
>> >>> >> propCollection.Add(MyProps)
>> >>> >>
>> >>> >> Dim commands As New MgFeatureCommandCollection()
>> >>> >> commands.Add(New MgInsertFeatures(MyFeatureName, propCollection))
>> >>> >>
>> >>> >> Dim res As MgPropertyCollection =
>> >>> featureSrvc.UpdateFeatures(dataSourceId,
>> >>> >> commands, False)
>> >>> >> ReleaseReader(res, commands)
>> >>> >>
>> >>> >> In ReleaseReader, I have the following error:
>> >>> >> Unable to cast object of type 'OSGeo.MapGuide.MgStringProperty' to
>> >>> type
>> >>> >> 'OSGeo.MapGuide.MgFeatureProperty'.
>> >>> >>
>> >>> >> In fact, res has only one property of type MgStringProperty: but
>> why?
>> >>> >>
>> >>> >> Have you any idea where is the error?
>> >>> >> Thanks, Fabio
>> >>> >>
>> >>> >>
>> >>> >
>> >>> > --
>> >>> > View this message in context:
>> >>> http://n2.nabble.com/Add-geometry-to-SHP-tp3953583p3955574.html
>> >>> > Sent from the MapGuide Users mailing list archive at Nabble.com.
>> >>> > _______________________________________________
>> >>> > mapguide-users mailing list
>> >>> > [hidden email]
>> >>> > http://lists.osgeo.org/mailman/listinfo/mapguide-users
>> >>> >
>> >>>
>> >>>
>> >>>
>> >>> --
>> >>> Zac Spitzer
>> >>> Solution Architect / Director
>> >>> Ennoble Consultancy Australia
>> >>> http://www.ennoble.com.au
>> >>> http://zacster.blogspot.com
>> >>> +61 405 847 168
>> >>> _______________________________________________
>> >>> mapguide-users mailing list
>> >>> [hidden email]
>> >>> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>> >>>
>> >>
>> >>
>> >> _______________________________________________
>> >> mapguide-users mailing list
>> >> [hidden email]
>> >> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>> >>
>> >>
>> >
>> > _______________________________________________
>> > mapguide-users mailing list
>> > [hidden email]
>> > http://lists.osgeo.org/mailman/listinfo/mapguide-users
>> >
>> >
>>
>> --
>> View this message in context:
>> http://n2.nabble.com/Add-geometry-to-SHP-tp3953583p3957522.html
>> Sent from the MapGuide Users mailing list archive at Nabble.com.
>> _______________________________________________
>> mapguide-users mailing list
>> [hidden email]
>> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>>
>
> _______________________________________________
> mapguide-users mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>
>

--
View this message in context: http://n2.nabble.com/Add-geometry-to-SHP-tp3953583p3957821.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
_______________________________________________
mapguide-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/mapguide-users


_______________________________________________
mapguide-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/mapguide-users
sekko970

Re: Add geometry to SHP

Reply Threaded More More options
Print post
Permalink
I have already downloaded all the dll for FDO Windows SDK, but 3.4 version.
f.


Simon Pelicon wrote:
You have all this files (also  OSGeo.FDO.Spatial.dll ) in FDO Windows SDK.
download link:
http://fdo.osgeo.org/content/fdo-331-downloads

<http://fdo.osgeo.org/content/fdo-331-downloads>simon

On Fri, Nov 6, 2009 at 10:58 AM, sekko970
<fabio.franceschini@techneteam.it>wrote:

>
> Ok for
> OSGeo.FDO.dll
> OSGeo.FDO.Geometry.dll
> OSGeo.FDO.Common.dll
>
> but if I try to create a reference to OSGeo.FDO.Spatial.dll, I have the
> following error:
> no type libraries were found in the component.
>
> (FDOSpatial.dll is already in my project bin folder).
>
> f.
>
>
>
>
> Simon Pelicon wrote:
> >
> > Hi!
> >
> > Add references to this files:
> >
> > OSGeo.FDO.dll
> > OSGeo.FDO.Geometry.dll
> > OSGeo.FDO.Common.dll
> > OSGeo.FDO.Spatial.dll
> >
> > simon
> >
> > On Fri, Nov 6, 2009 at 9:41 AM, sekko970
> > <fabio.franceschini@techneteam.it>wrote:
> >
> >>
> >> Hi Simon,
> >> what I have to do to include in my ASP.NET project FDO .NET API?
> >>
> >>
> >>
> >> Simon Pelicon wrote:
> >> >
> >> > Hi!
> >> >
> >> > Here is sample in C# from my code using just  FDO .NET API.
> >> > This inserts FEATURE in any FDO datasource specified in my FDO
> >> connection
> >> > (m_Conn) like SHP,SDF, oracle ....
> >> >
> >> >
> >> > IInsert command =
> >> > (IInsert)m_base.m_Conn.CreateCommand(CommandType.CommandType_Insert);
> >> > FgfGeometryFactory factory = new FgfGeometryFactory();
> >> > IDirectPosition position = factory.CreatePositionXYZ(X,Y, 0.0);
> >> > IPoint point = factory.CreatePoint(position);
> >> > command .PropertyValues.Add(new PropertyValue(GEOMETRY_COLUMN, new
> >> > GeometryValue(factory.GetFgf(point))));
> >> > command .PropertyValues.Add(new PropertyValue(LAYER_COLUMN, new
> >> > StringValue(bref.Layer)));
> >> > command .PropertyValues.Add(new PropertyValue(BLOCK_COLUMN, new
> >> > StringValue(bref.Name)));
> >> > reader = command.Execute();
> >> > if (reader.ReadNext())
> >> > {
> >> >
> >> > }
> >> >
> >> > Simon
> >> >
> >> >
> >> > On Fri, Nov 6, 2009 at 8:27 AM, Dejan Gregor <dejan.gregor@gmail.com>
> >> > wrote:
> >> >
> >> >> Dear Fabio,
> >> >>
> >> >> you are saying that with the exsiting FDO it is possible to add
> >> geometry
> >> >> to
> >> >> a SHP?
> >> >>
> >> >> 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.
> >> >>
> >> >> Best regards,
> >> >> Dejan
> >> >>
> >> >> On Fri, Nov 6, 2009 at 00:29, Zac Spitzer <zac.spitzer@gmail.com>
> >> wrote:
> >> >>
> >> >>> what's in the string? it's probably an error string
> >> >>>
> >> >>> if your feature source readonly?
> >> >>>
> >> >>> http://trac.osgeo.org/mapguide/ticket/649
> >> >>>
> >> >>> a very nasty annoying bug
> >> >>>
> >> >>> z
> >> >>>
> >> >>> On Fri, Nov 6, 2009 at 9:45 AM, Jackie Ng <jumpinjackie@gmail.com>
> >> >>> wrote:
> >> >>> >
> >> >>> > What does your ReleaseReader() look like?
> >> >>> >
> >> >>> > If it's from the samples, it's supposed to close any open
> >> >>> MgFeatureReaders
> >> >>> > that may exist in the result returned from
> >> >>> MgFeatureService.UpdateFeatures()
> >> >>> >
> >> >>> > - Jackie
> >> >>> >
> >> >>> >
> >> >>> > sekko970 wrote:
> >> >>> >>
> >> >>> >> I tryng to add a point to an existing SHP data connection in
> >> ASP.Net
> >> >>> >> application, using MG API.
> >> >>> >>
> >> >>> >> Dim dataSource as String = "Library://.../MySHP.FeatureSource"
> >> >>> >> Dim dataSourceId As New MgResourceIdentifier(dataSource)
> >> >>> >>
> >> >>> >> Dim MyProps As New MgPropertyCollection()
> >> >>> >> Dim agfRW As New MgAgfReaderWriter()
> >> >>> >> Dim geomFactory As New MgGeometryFactory
> >> >>> >>
> >> >>> >> Dim myPoint As MgPoint =
> >> >>> >> geomFactory.CreatePoint(geomFactory.CreateCoordinateXY(X, Y))
> >> >>> >>
> >> >>> >> 'ID
> >> >>> >> Dim IDProp As New MgInt32Property("FeatID", IDValue)
> >> >>> >> MyProps.Add(IDProp)
> >> >>> >>
> >> >>> >> 'MyProp
> >> >>> >> Dim MyProp As New MgDoubleProperty("MyProp", MyPropValue)
> >> >>> >> MyProps.Add(MyProp)
> >> >>> >>
> >> >>> >> 'Geometry
> >> >>> >> Dim geomReader As MgByteReader = agfRW.Write(myPoint)
> >> >>> >> Dim geometryProp As New MgGeometryProperty("Geometry",
> geomReader)
> >> >>> >> MyProps.Add(geometryProp)
> >> >>> >>
> >> >>> >> Dim propCollection As New MgBatchPropertyCollection()
> >> >>> >> propCollection.Add(MyProps)
> >> >>> >>
> >> >>> >> Dim commands As New MgFeatureCommandCollection()
> >> >>> >> commands.Add(New MgInsertFeatures(MyFeatureName, propCollection))
> >> >>> >>
> >> >>> >> Dim res As MgPropertyCollection =
> >> >>> featureSrvc.UpdateFeatures(dataSourceId,
> >> >>> >> commands, False)
> >> >>> >> ReleaseReader(res, commands)
> >> >>> >>
> >> >>> >> In ReleaseReader, I have the following error:
> >> >>> >> Unable to cast object of type 'OSGeo.MapGuide.MgStringProperty'
> to
> >> >>> type
> >> >>> >> 'OSGeo.MapGuide.MgFeatureProperty'.
> >> >>> >>
> >> >>> >> In fact, res has only one property of type MgStringProperty: but
> >> why?
> >> >>> >>
> >> >>> >> Have you any idea where is the error?
> >> >>> >> Thanks, Fabio
> >> >>> >>
> >> >>> >>
> >> >>> >
> >> >>> > --
> >> >>> > View this message in context:
> >> >>> http://n2.nabble.com/Add-geometry-to-SHP-tp3953583p3955574.html
> >> >>> > Sent from the MapGuide Users mailing list archive at Nabble.com.
> >> >>> > _______________________________________________
> >> >>> > mapguide-users mailing list
> >> >>> > mapguide-users@lists.osgeo.org
> >> >>> > http://lists.osgeo.org/mailman/listinfo/mapguide-users
> >> >>> >
> >> >>>
> >> >>>
> >> >>>
> >> >>> --
> >> >>> Zac Spitzer
> >> >>> Solution Architect / Director
> >> >>> Ennoble Consultancy Australia
> >> >>> http://www.ennoble.com.au
> >> >>> http://zacster.blogspot.com
> >> >>> +61 405 847 168
> >> >>> _______________________________________________
> >> >>> mapguide-users mailing list
> >> >>> mapguide-users@lists.osgeo.org
> >> >>> http://lists.osgeo.org/mailman/listinfo/mapguide-users
> >> >>>
> >> >>
> >> >>
> >> >> _______________________________________________
> >> >> mapguide-users mailing list
> >> >> mapguide-users@lists.osgeo.org
> >> >> http://lists.osgeo.org/mailman/listinfo/mapguide-users
> >> >>
> >> >>
> >> >
> >> > _______________________________________________
> >> > mapguide-users mailing list
> >> > mapguide-users@lists.osgeo.org
> >> > http://lists.osgeo.org/mailman/listinfo/mapguide-users
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >> http://n2.nabble.com/Add-geometry-to-SHP-tp3953583p3957522.html
> >> Sent from the MapGuide Users mailing list archive at Nabble.com.
> >> _______________________________________________
> >> mapguide-users mailing list
> >> mapguide-users@lists.osgeo.org
> >> http://lists.osgeo.org/mailman/listinfo/mapguide-users
> >>
> >
> > _______________________________________________
> > mapguide-users mailing list
> > mapguide-users@lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/mapguide-users
> >
> >
>
> --
> View this message in context:
> http://n2.nabble.com/Add-geometry-to-SHP-tp3953583p3957821.html
> Sent from the MapGuide Users mailing list archive at Nabble.com.
> _______________________________________________
> mapguide-users mailing list
> mapguide-users@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>

_______________________________________________
mapguide-users mailing list
mapguide-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users
sekko970

Re: Add geometry to SHP

Reply Threaded More More options
Print post
Permalink
The problem is that I cannot include FDOSpatial.dll in my project.
In fact, if I try to create a reference to OSGeo.FDO.Spatial.dll, I have the
following error:

no type libraries were found in the component
(FDOSpatial.dll is already in my project bin folder).

f.


sekko970 wrote:
I have already downloaded all the dll for FDO Windows SDK, but 3.4 version.
f.


Simon Pelicon wrote:
You have all this files (also  OSGeo.FDO.Spatial.dll ) in FDO Windows SDK.
download link:
http://fdo.osgeo.org/content/fdo-331-downloads

<http://fdo.osgeo.org/content/fdo-331-downloads>simon

On Fri, Nov 6, 2009 at 10:58 AM, sekko970
<fabio.franceschini@techneteam.it>wrote:

>
> Ok for
> OSGeo.FDO.dll
> OSGeo.FDO.Geometry.dll
> OSGeo.FDO.Common.dll
>
> but if I try to create a reference to OSGeo.FDO.Spatial.dll, I have the
> following error:
> no type libraries were found in the component.
>
> (FDOSpatial.dll is already in my project bin folder).
>
> f.
>
>
>
>
> Simon Pelicon wrote:
> >
> > Hi!
> >
> > Add references to this files:
> >
> > OSGeo.FDO.dll
> > OSGeo.FDO.Geometry.dll
> > OSGeo.FDO.Common.dll
> > OSGeo.FDO.Spatial.dll
> >
> > simon
> >
> > On Fri, Nov 6, 2009 at 9:41 AM, sekko970
> > <fabio.franceschini@techneteam.it>wrote:
> >
> >>
> >> Hi Simon,
> >> what I have to do to include in my ASP.NET project FDO .NET API?
> >>
> >>
> >>
> >> Simon Pelicon wrote:
> >> >
> >> > Hi!
> >> >
> >> > Here is sample in C# from my code using just  FDO .NET API.
> >> > This inserts FEATURE in any FDO datasource specified in my FDO
> >> connection
> >> > (m_Conn) like SHP,SDF, oracle ....
> >> >
> >> >
> >> > IInsert command =
> >> > (IInsert)m_base.m_Conn.CreateCommand(CommandType.CommandType_Insert);
> >> > FgfGeometryFactory factory = new FgfGeometryFactory();
> >> > IDirectPosition position = factory.CreatePositionXYZ(X,Y, 0.0);
> >> > IPoint point = factory.CreatePoint(position);
> >> > command .PropertyValues.Add(new PropertyValue(GEOMETRY_COLUMN, new
> >> > GeometryValue(factory.GetFgf(point))));
> >> > command .PropertyValues.Add(new PropertyValue(LAYER_COLUMN, new
> >> > StringValue(bref.Layer)));
> >> > command .PropertyValues.Add(new PropertyValue(BLOCK_COLUMN, new
> >> > StringValue(bref.Name)));
> >> > reader = command.Execute();
> >> > if (reader.ReadNext())
> >> > {
> >> >
> >> > }
> >> >
> >> > Simon
> >> >
> >> >
> >> > On Fri, Nov 6, 2009 at 8:27 AM, Dejan Gregor <dejan.gregor@gmail.com>
> >> > wrote:
> >> >
> >> >> Dear Fabio,
> >> >>
> >> >> you are saying that with the exsiting FDO it is possible to add
> >> geometry
> >> >> to
> >> >> a SHP?
> >> >>
> >> >> 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.
> >> >>
> >> >> Best regards,
> >> >> Dejan
> >> >>
> >> >> On Fri, Nov 6, 2009 at 00:29, Zac Spitzer <zac.spitzer@gmail.com>
> >> wrote:
> >> >>
> >> >>> what's in the string? it's probably an error string
> >> >>>
> >> >>> if your feature source readonly?
> >> >>>
> >> >>> http://trac.osgeo.org/mapguide/ticket/649
> >> >>>
> >> >>> a very nasty annoying bug
> >> >>>
> >> >>> z
> >> >>>
> >> >>> On Fri, Nov 6, 2009 at 9:45 AM, Jackie Ng <jumpinjackie@gmail.com>
> >> >>> wrote:
> >> >>> >
> >> >>> > What does your ReleaseReader() look like?
> >> >>> >
> >> >>> > If it's from the samples, it's supposed to close any open
> >> >>> MgFeatureReaders
> >> >>> > that may exist in the result returned from
> >> >>> MgFeatureService.UpdateFeatures()
> >> >>> >
> >> >>> > - Jackie
> >> >>> >
> >> >>> >
> >> >>> > sekko970 wrote:
> >> >>> >>
> >> >>> >> I tryng to add a point to an existing SHP data connection in
> >> ASP.Net
> >> >>> >> application, using MG API.
> >> >>> >>
> >> >>> >> Dim dataSource as String = "Library://.../MySHP.FeatureSource"
> >> >>> >> Dim dataSourceId As New MgResourceIdentifier(dataSource)
> >> >>> >>
> >> >>> >> Dim MyProps As New MgPropertyCollection()
> >> >>> >> Dim agfRW As New MgAgfReaderWriter()
> >> >>> >> Dim geomFactory As New MgGeometryFactory
> >> >>> >>
> >> >>> >> Dim myPoint As MgPoint =
> >> >>> >> geomFactory.CreatePoint(geomFactory.CreateCoordinateXY(X, Y))
> >> >>> >>
> >> >>> >> 'ID
> >> >>> >> Dim IDProp As New MgInt32Property("FeatID", IDValue)
> >> >>> >> MyProps.Add(IDProp)
> >> >>> >>
> >> >>> >> 'MyProp
> >> >>> >> Dim MyProp As New MgDoubleProperty("MyProp", MyPropValue)
> >> >>> >> MyProps.Add(MyProp)
> >> >>> >>
> >> >>> >> 'Geometry
> >> >>> >> Dim geomReader As MgByteReader = agfRW.Write(myPoint)
> >> >>> >> Dim geometryProp As New MgGeometryProperty("Geometry",
> geomReader)
> >> >>> >> MyProps.Add(geometryProp)
> >> >>> >>
> >> >>> >> Dim propCollection As New MgBatchPropertyCollection()
> >> >>> >> propCollection.Add(MyProps)
> >> >>> >>
> >> >>> >> Dim commands As New MgFeatureCommandCollection()
> >> >>> >> commands.Add(New MgInsertFeatures(MyFeatureName, propCollection))
> >> >>> >>
> >> >>> >> Dim res As MgPropertyCollection =
> >> >>> featureSrvc.UpdateFeatures(dataSourceId,
> >> >>> >> commands, False)
> >> >>> >> ReleaseReader(res, commands)
> >> >>> >>
> >> >>> >> In ReleaseReader, I have the following error:
> >> >>> >> Unable to cast object of type 'OSGeo.MapGuide.MgStringProperty'
> to
> >> >>> type
> >> >>> >> 'OSGeo.MapGuide.MgFeatureProperty'.
> >> >>> >>
> >> >>> >> In fact, res has only one property of type MgStringProperty: but
> >> why?
> >> >>> >>
> >> >>> >> Have you any idea where is the error?
> >> >>> >> Thanks, Fabio
> >> >>> >>
> >> >>> >>
> >> >>> >
> >> >>> > --
> >> >>> > View this message in context:
> >> >>> http://n2.nabble.com/Add-geometry-to-SHP-tp3953583p3955574.html
> >> >>> > Sent from the MapGuide Users mailing list archive at Nabble.com.
> >> >>> > _______________________________________________
> >> >>> > mapguide-users mailing list
> >> >>> > mapguide-users@lists.osgeo.org
> >> >>> > http://lists.osgeo.org/mailman/listinfo/mapguide-users
> >> >>> >
> >> >>>
> >> >>>
> >> >>>
> >> >>> --
> >> >>> Zac Spitzer
> >> >>> Solution Architect / Director
> >> >>> Ennoble Consultancy Australia
> >> >>> http://www.ennoble.com.au
> >> >>> http://zacster.blogspot.com
> >> >>> +61 405 847 168
> >> >>> _______________________________________________
> >> >>> mapguide-users mailing list
> >> >>> mapguide-users@lists.osgeo.org
> >> >>> http://lists.osgeo.org/mailman/listinfo/mapguide-users
> >> >>>
> >> >>
> >> >>
> >> >> _______________________________________________
> >> >> mapguide-users mailing list
> >> >> mapguide-users@lists.osgeo.org
> >> >> http://lists.osgeo.org/mailman/listinfo/mapguide-users
> >> >>
> >> >>
> >> >
> >> > _______________________________________________
> >> > mapguide-users mailing list
> >> > mapguide-users@lists.osgeo.org
> >> > http://lists.osgeo.org/mailman/listinfo/mapguide-users
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >> http://n2.nabble.com/Add-geometry-to-SHP-tp3953583p3957522.html
> >> Sent from the MapGuide Users mailing list archive at Nabble.com.
> >> _______________________________________________
> >> mapguide-users mailing list
> >> mapguide-users@lists.osgeo.org
> >> http://lists.osgeo.org/mailman/listinfo/mapguide-users
> >>
> >
> > _______________________________________________
> > mapguide-users mailing list
> > mapguide-users@lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/mapguide-users
> >
> >
>
> --
> View this message in context:
> http://n2.nabble.com/Add-geometry-to-SHP-tp3953583p3957821.html
> Sent from the MapGuide Users mailing list archive at Nabble.com.
> _______________________________________________
> mapguide-users mailing list
> mapguide-users@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>

_______________________________________________
mapguide-users mailing list
mapguide-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users
sekko970

Re: Add geometry to SHP

Reply Threaded More More options
Print post
Permalink
Hi Simon,
I have solved the problem.

After your valuable help to add feature to SHP file using FDO API, I ask you to help me again :-)

I need to create the shape file programmatically: have you an example to make it using FDO API?


Thanks a lot,
F.


sekko970 wrote:
The problem is that I cannot include FDOSpatial.dll in my project.
In fact, if I try to create a reference to OSGeo.FDO.Spatial.dll, I have the
following error:

no type libraries were found in the component
(FDOSpatial.dll is already in my project bin folder).

f.


sekko970 wrote:
I have already downloaded all the dll for FDO Windows SDK, but 3.4 version.
f.


Simon Pelicon wrote:
You have all this files (also  OSGeo.FDO.Spatial.dll ) in FDO Windows SDK.
download link:
http://fdo.osgeo.org/content/fdo-331-downloads

<http://fdo.osgeo.org/content/fdo-331-downloads>simon

On Fri, Nov 6, 2009 at 10:58 AM, sekko970
<fabio.franceschini@techneteam.it>wrote:

>
> Ok for
> OSGeo.FDO.dll
> OSGeo.FDO.Geometry.dll
> OSGeo.FDO.Common.dll
>
> but if I try to create a reference to OSGeo.FDO.Spatial.dll, I have the
> following error:
> no type libraries were found in the component.
>
> (FDOSpatial.dll is already in my project bin folder).
>
> f.
>
>
>
>
> Simon Pelicon wrote:
> >
> > Hi!
> >
> > Add references to this files:
> >
> > OSGeo.FDO.dll
> > OSGeo.FDO.Geometry.dll
> > OSGeo.FDO.Common.dll
> > OSGeo.FDO.Spatial.dll
> >
> > simon
> >
> > On Fri, Nov 6, 2009 at 9:41 AM, sekko970
> > <fabio.franceschini@techneteam.it>wrote:
> >
> >>
> >> Hi Simon,
> >> what I have to do to include in my ASP.NET project FDO .NET API?
> >>
> >>
> >>
> >> Simon Pelicon wrote:
> >> >
> >> > Hi!
> >> >
> >> > Here is sample in C# from my code using just  FDO .NET API.
> >> > This inserts FEATURE in any FDO datasource specified in my FDO
> >> connection
> >> > (m_Conn) like SHP,SDF, oracle ....
> >> >
> >> >
> >> > IInsert command =
> >> > (IInsert)m_base.m_Conn.CreateCommand(CommandType.CommandType_Insert);
> >> > FgfGeometryFactory factory = new FgfGeometryFactory();
> >> > IDirectPosition position = factory.CreatePositionXYZ(X,Y, 0.0);
> >> > IPoint point = factory.CreatePoint(position);
> >> > command .PropertyValues.Add(new PropertyValue(GEOMETRY_COLUMN, new
> >> > GeometryValue(factory.GetFgf(point))));
> >> > command .PropertyValues.Add(new PropertyValue(LAYER_COLUMN, new
> >> > StringValue(bref.Layer)));
> >> > command .PropertyValues.Add(new PropertyValue(BLOCK_COLUMN, new
> >> > StringValue(bref.Name)));
> >> > reader = command.Execute();
> >> > if (reader.ReadNext())
> >> > {
> >> >
> >> > }
> >> >
> >> > Simon
> >> >
> >> >
> >> > On Fri, Nov 6, 2009 at 8:27 AM, Dejan Gregor <dejan.gregor@gmail.com>
> >> > wrote:
> >> >
> >> >> Dear Fabio,
> >> >>
> >> >> you are saying that with the exsiting FDO it is possible to add
> >> geometry
> >> >> to
> >> >> a SHP?
> >> >>
> >> >> 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.
> >> >>
> >> >> Best regards,
> >> >> Dejan
> >> >>
> >> >> On Fri, Nov 6, 2009 at 00:29, Zac Spitzer <zac.spitzer@gmail.com>
> >> wrote:
> >> >>
> >> >>> what's in the string? it's probably an error string
> >> >>>
> >> >>> if your feature source readonly?
> >> >>>
> >> >>> http://trac.osgeo.org/mapguide/ticket/649
> >> >>>
> >> >>> a very nasty annoying bug
> >> >>>
> >> >>> z
> >> >>>
> >> >>> On Fri, Nov 6, 2009 at 9:45 AM, Jackie Ng <jumpinjackie@gmail.com>
> >> >>> wrote:
> >> >>> >
> >> >>> > What does your ReleaseReader() look like?
> >> >>> >
> >> >>> > If it's from the samples, it's supposed to close any open
> >> >>> MgFeatureReaders
> >> >>> > that may exist in the result returned from
> >> >>> MgFeatureService.UpdateFeatures()
> >> >>> >
> >> >>> > - Jackie
> >> >>> >
> >> >>> >
> >> >>> > sekko970 wrote:
> >> >>> >>
> >> >>> >> I tryng to add a point to an existing SHP data connection in
> >> ASP.Net
> >> >>> >> application, using MG API.
> >> >>> >>
> >> >>> >> Dim dataSource as String = "Library://.../MySHP.FeatureSource"
> >> >>> >> Dim dataSourceId As New MgResourceIdentifier(dataSource)
> >> >>> >>
> >> >>> >> Dim MyProps As New MgPropertyCollection()
> >> >>> >> Dim agfRW As New MgAgfReaderWriter()
> >> >>> >> Dim geomFactory As New MgGeometryFactory
> >> >>> >>
> >> >>> >> Dim myPoint As MgPoint =
> >> >>> >> geomFactory.CreatePoint(geomFactory.CreateCoordinateXY(X, Y))
> >> >>> >>
> >> >>> >> 'ID
> >> >>> >> Dim IDProp As New MgInt32Property("FeatID", IDValue)
> >> >>> >> MyProps.Add(IDProp)
> >> >>> >>
> >> >>> >> 'MyProp
> >> >>> >> Dim MyProp As New MgDoubleProperty("MyProp", MyPropValue)
> >> >>> >> MyProps.Add(MyProp)
> >> >>> >>
> >> >>> >> 'Geometry
> >> >>> >> Dim geomReader As MgByteReader = agfRW.Write(myPoint)
> >> >>> >> Dim geometryProp As New MgGeometryProperty("Geometry",
> geomReader)
> >> >>> >> MyProps.Add(geometryProp)
> >> >>> >>
> >> >>> >> Dim propCollection As New MgBatchPropertyCollection()
> >> >>> >> propCollection.Add(MyProps)
> >> >>> >>
> >> >>> >> Dim commands As New MgFeatureCommandCollection()
> >> >>> >> commands.Add(New MgInsertFeatures(MyFeatureName, propCollection))
> >> >>> >>
> >> >>> >> Dim res As MgPropertyCollection =
> >> >>> featureSrvc.UpdateFeatures(dataSourceId,
> >> >>> >> commands, False)
> >> >>> >> ReleaseReader(res, commands)
> >> >>> >>
> >> >>> >> In ReleaseReader, I have the following error:
> >> >>> >> Unable to cast object of type 'OSGeo.MapGuide.MgStringProperty'
> to
> >> >>> type
> >> >>> >> 'OSGeo.MapGuide.MgFeatureProperty'.
> >> >>> >>
> >> >>> >> In fact, res has only one property of type MgStringProperty: but
> >> why?
> >> >>> >>
> >> >>> >> Have you any idea where is the error?
> >> >>> >> Thanks, Fabio
> >> >>> >>
> >> >>> >>
> >> >>> >
> >> >>> > --
> >> >>> > View this message in context:
> >> >>> http://n2.nabble.com/Add-geometry-to-SHP-tp3953583p3955574.html
> >> >>> > Sent from the MapGuide Users mailing list archive at Nabble.com.
> >> >>> > _______________________________________________
> >> >>> > mapguide-users mailing list
> >> >>> > mapguide-users@lists.osgeo.org
> >> >>> > http://lists.osgeo.org/mailman/listinfo/mapguide-users
> >> >>> >
> >> >>>
> >> >>>
> >> >>>
> >> >>> --
> >> >>> Zac Spitzer
> >> >>> Solution Architect / Director
> >> >>> Ennoble Consultancy Australia
> >> >>> http://www.ennoble.com.au
> >> >>> http://zacster.blogspot.com
> >> >>> +61 405 847 168
> >> >>> _______________________________________________
> >> >>> mapguide-users mailing list
> >> >>> mapguide-users@lists.osgeo.org
> >> >>> http://lists.osgeo.org/mailman/listinfo/mapguide-users
> >> >>>
> >> >>
> >> >>
> >> >> _______________________________________________
> >> >> mapguide-users mailing list
> >> >> mapguide-users@lists.osgeo.org
> >> >> http://lists.osgeo.org/mailman/listinfo/mapguide-users
> >> >>
> >> >>
> >> >
> >> > _______________________________________________
> >> > mapguide-users mailing list
> >> > mapguide-users@lists.osgeo.org
> >> > http://lists.osgeo.org/mailman/listinfo/mapguide-users
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >> http://n2.nabble.com/Add-geometry-to-SHP-tp3953583p3957522.html
> >> Sent from the MapGuide Users mailing list archive at Nabble.com.
> >> _______________________________________________
> >> mapguide-users mailing list
> >> mapguide-users@lists.osgeo.org
> >> http://lists.osgeo.org/mailman/listinfo/mapguide-users
> >>
> >
> > _______________________________________________
> > mapguide-users mailing list
> > mapguide-users@lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/mapguide-users
> >
> >
>
> --
> View this message in context:
> http://n2.nabble.com/Add-geometry-to-SHP-tp3953583p3957821.html
> Sent from the MapGuide Users mailing list archive at Nabble.com.
> _______________________________________________
> mapguide-users mailing list
> mapguide-users@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>

_______________________________________________
mapguide-users mailing list
mapguide-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users