bilaldursun1 / nettopologysuite

Automatically exported from code.google.com/p/nettopologysuite
0 stars 0 forks source link

Spatialite. Strange situation with MultiPoint embedded in GeometryCollection. #132

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hello.

I'm using the latest version of nettopologysuite.

There is problem with MultiPoint embedded in GeometryCollection.

 List<IPoint> geom = new List<IPoint>();
 foreach (var point in Points)
 {
    geom.Add(new Point(point.X, point.Y));
 }
  var mPoint = new NetTopologySuite.Geometries.MultiPoint(geom.ToArray());
  geometry = new GeometryCollection(new[] { mPoint });
  geometry.SRID = 4326;

 Entity entity= new Entity {Geometry = GaiaGeoWriter.Write(geometry), Name = fileName};

For this sitautions spatialite function GeometryType() returns  NULL,
and, for example, AsGeoJson return 
{"type":"GeometryCollection","geometries":[]}.

If I use LineString or Points with GeoCollection than everything is fine.
Here is thread in Spatialite group - 
https://groups.google.com/forum/?fromgroups=#!topic/spatialite-users/lphu8HeAGz8
.

Original issue reported on code.google.com by sharov.a...@gmail.com on 20 Nov 2012 at 4:35

GoogleCodeExporter commented 9 years ago
It seems to me that GaiaGeoReader and GaiaGeoWrite are in sync.
They can read and write the geometries.

But spatialite-gui (thus libSpatiaLite) fail to create those geometries.
Don't know if this is a design choice/known limitation or really needs to be 
fixed.

Whatsoever, you should be able to recover your geometries using GaiaGeoReader. 
If you want to stick to GeometryCollections, be sure to only add single 
geometry types.

Original comment by felix.ob...@netcologne.de on 21 Nov 2012 at 1:36

GoogleCodeExporter commented 9 years ago
As Sandro Furieri pointed out, Spatialite only accepts simple geometries in 
GeometryCollections.

Therefore I will (asap) change the GaiaGeoReader/-Writer classes to respect 
that design decision.

Original comment by felix.ob...@netcologne.de on 21 Nov 2012 at 3:00