[mapguide-users] Inserting features in PostGIS fails

isca mapguide2007 at gmail.com
Mon Aug 11 10:15:07 EDT 2008


Hello,

I am trying to insert features into PostGIS, but for some reason this does
not seem to work. Please find below a snippet of the code I am using:

Dim geometryFactory As New MgGeometryFactory
        Dim coordinateCollection As New MgCoordinateCollection()
        Dim wktReaderWriter As New MgWktReaderWriter()
        Dim coordinate As MgCoordinate =
geometryFactory.CreateCoordinateXY(159102, 213063)
        coordinateCollection.Add(coordinate)
        Dim coordinate2 As MgCoordinate =
geometryFactory.CreateCoordinateXY(157745, 218564)
        coordinateCollection.Add(coordinate2)

        Dim geometry As MgLineString =
geometryFactory.CreateLineString(coordinateCollection)

        Dim commands As New MgFeatureCommandCollection
        Dim properties As New MgPropertyCollection
        Dim agfReaderWriter As New MgAgfReaderWriter
        Dim agfByteStream = agfReaderWriter.Write(geometry)
        Dim geomprop As New MgGeometryProperty("the_geom", agfByteStream)
        properties.Add(geomprop)
        Dim insertcommand As New MgInsertFeatures("FdoPostGIS:lines",
properties)
        commands.Add(insertcommand)
        featureService.UpdateFeatures(New
MgResourceIdentifier("Library://lines.FeatureSource"), commands, False)

My table has only an id (autogenerated) and geometry column in it. The first
time there is no error shown but also no feature is inserted. When I look
into the GetFdoCacheInfo function, there is one cached connection which is
still in use. The second time I execute the function I get an "Please try
your operation later as the resource was busy" error. I have already tried
to disable caching for the PostGis provider but without result.

As I do not use any FeatureReader at this point it can also not having to do
with a featurereader that is not closed.

I am using PostgreSQL 8.2 and PostGIS 1.3.3.

In the past I was succesfull in implementing editing capabilities on both
SDF and SHP files.

Could someone point me out what might be wrong ? Is there an easy way to
debug the Mapguide code without having to compile the whole code myself ?



-- 
View this message in context: http://www.nabble.com/Inserting-features-in-PostGIS-fails-tp18926671p18926671.html
Sent from the MapGuide Users mailing list archive at Nabble.com.



More information about the mapguide-users mailing list