How to use CURVEPOLYGON,COMPOUNDCURVE from PostGIS in NetTopologySuite ?

514 views
Skip to first unread message

Jean-Marc De Neyer

unread,
May 13, 2015, 3:12:47 PM5/13/15
to nettopol...@googlegroups.com
Using NetTopologySuite.IO.PostGisReader I try to create a NetTopologySuite.Geometries.Geometry (or a GeoAPI.Geometries.IGeometry)

I have that :
        public void LotFromArchive(string nolot)
       
{
           
string lotsql = string.Format(@"SELECT nouv_lot, st_srid(geom) AS srid, st_astext(geom) AS wnt, st_asbinary(geom) AS wnb FROM lots WHERE nouv_lot = '{0}';", nolot);

           
NpgsqlConnection conn = new NpgsqlConnection(connexionString);

           
using (Npgsql.NpgsqlDataAdapter adapter = new Npgsql.NpgsqlDataAdapter(lotsql, conn))
           
{
                conn
.Open();
               
System.Data.DataSet ds2 = new System.Data.DataSet();
                adapter
.Fill(ds2,"lots");
                conn
.Close();
               
NetTopologySuite.IO.PostGisReader pgReader = new NetTopologySuite.IO.PostGisReader();

               
if (ds2.Tables.Count > 0)
               
{
                   
foreach (System.Data.DataRow dr in ds2.Tables[0].Rows)
                   
{
                       
this.GeometrieFromWNB((byte[])dr["wnb"], (int)dr["srid"]);

                       
NetTopologySuite.Features.Feature feature = new NetTopologySuite.Features.Feature();
                        pgReader
.Read((byte[])dr["wnb"]);
                       
GeoAPI.Geometries.IGeometry Geom = pgReader.Read((byte[])dr["wnb"]);
                   
}
               
}
           
}
       
}


If dr["wnt"] = "POLYGON((215644.2216 5360088.222,215651.46 5360069.7822,215670.2543 5360075.8526,215663.2397 5360094.3951,215644.2216 5360088.222))"
it works fine
but if  dr["wnt"] = "CURVEPOLYGON(COMPOUNDCURVE((215644.2216 5360088.222,215651.46 5360069.7822),(215651.46 5360069.7822,215670.2543 5360075.8526),(215670.2543 5360075.8526,215663.2397 5360094.3951),(215663.2397 5360094.3951,215644.2216 5360088.222)))"
I receive the argument exception "Geometry type not recognized. GeometryCode: 10" on line "pgReader.Read((byte[])dr["wnb"]);"
The problem seems to comes from the CURVEPOLYGON(COMPOUNDCURVE but how to do to use curvepolygon and coupoundcurve from PostGIS in NetTopologySuite ?

Thanks,
JM


Diego Guidi

unread,
May 14, 2015, 2:29:26 AM5/14/15
to nettopol...@googlegroups.com, jmden...@gmail.com
CURVEPOLYGON isnt'a valid WKT string, at least for OpenGIS Simple Feature Specifications, the one that NTS supports.

Christoph Spoerri

unread,
Sep 11, 2015, 11:46:37 AM9/11/15
to NetTopologySuite, jmden...@gmail.com
Hi there,

are there any plans to support curves in the near future? We are actually in the need for this geometry type and are wondering, if we could also provide some help with the work if it would speed up the development for supporting true curves.

Cheers, Chris

Diego Guidi

unread,
Sep 11, 2015, 1:35:52 PM9/11/15
to NetTopologySuite, jmden...@gmail.com
are there any plans to support curves in the near future? We are actually in the need for this geometry type and are wondering, if we could also provide some help with the work if it would speed up the development for supporting true curves.

NTS is a "close" port of Java JTS, and AFAIK there are no plans in JTS to implement curve geometries.
But you should ask for this in the mailing list: https://lists.sourceforge.net/lists/listinfo/jts-topo-suite-user

Reply all
Reply to author
Forward
0 new messages