The changes to the geos are neither documented nor send somewhere for future use. The implemented functions force users to create polygons without holes (there is no argument for the holes). In case the default geos library is used, an error informs the user that the geometry type she is using is not the correct one. My change in geos added this geometry type. Best, Foteini On 08/14/2014 12:00 PM, developers-list-request@monetdb.org wrote:
Send developers-list mailing list submissions to developers-list@monetdb.org
To subscribe or unsubscribe via the World Wide Web, visit https://www.monetdb.org/mailman/listinfo/developers-list or, via email, send a message with subject or body 'help' to developers-list-request@monetdb.org
You can reach the person managing the list at developers-list-owner@monetdb.org
When replying, please edit your Subject line so it is more specific than "Re: Contents of developers-list digest..."
Today's Topics:
1. Re: MonetDB: geo - MakePolygon/Polygon implmentation. Works only for... (Stefan Manegold)
----------------------------------------------------------------------
Message: 1 Date: Wed, 13 Aug 2014 14:00:47 +0200 (CEST) From: Stefan Manegold
To: developers-list@monetdb.org Subject: Re: MonetDB: geo - MakePolygon/Polygon implmentation. Works only for... Message-ID: <1961125276.5600498.1407931247727.JavaMail.zimbra@cwi.nl> Content-Type: text/plain; charset=utf-8 Thanks!
purely out of curiosity:
- are there checks & warnings/ error messages in place for not (trying) to use it for polygons with holes, as well as a (configure) check whether the geos library provides the required functionality?
- are the changes to the geos module documented (at least as "diff" with reference to which code version it applies), or have these changes even been send "up-stream" to have them by default included in a future version of the library?
Thanks! Stefan
----- Original Message -----
Changeset: 4d4c6ce1a817 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4d4c6ce1a817 Modified Files: geom/monetdb5/geom.c geom/monetdb5/geom.mal geom/sql/40_geom.sql Branch: geo Log Message:
MakePolygon/Polygon implmentation. Works only for polygons without holes. Changes to geos library were necessary so, it will not work with standard geos library.
diffs (80 lines):
diff --git a/geom/monetdb5/geom.c b/geom/monetdb5/geom.c --- a/geom/monetdb5/geom.c +++ b/geom/monetdb5/geom.c @@ -600,7 +600,7 @@ str geom_2_geom(wkb** resWKB, wkb **valu int valueType = 0;
int valueSRID = (*valueWKB)->srid; -//fprintf(stderr, "in geom_2_geom\n"); + /* get the geosGeometry from the wkb */ geosGeometry = wkb2geos(*valueWKB); /* get the number of coordinates the geometry has */ @@ -784,7 +784,7 @@ wkb* geos2wkb(const GEOSGeometry* geosGe geomWKB->srid = GEOSGetSRID(geosGeometry); memcpy(&geomWKB->data, w, wkbLen); GEOSFree(w); - + return geomWKB; }
@@ -1944,13 +1944,13 @@ str wkbMakePolygon(wkb** out, wkb** exte }
externalGeometry = wkb2geos(*external); - if ((GEOSGeomTypeId(externalGeometry)+1) != wkbLineString) { + if ((GEOSGeomTypeId(externalGeometry)+1) != wkbLinearRing) { *out = wkb_nil; GEOSGeom_destroy(externalGeometry); - throw(MAL, "geom.Polygon", "Geometries should be LineStrings"); + throw(MAL, "geom.Polygon", "Geometries should be LinearRings"); }
- if(internalBAT_id == NULL) { + if(*internalBAT_id == 0) { geosGeometry = GEOSGeom_createPolygon(externalGeometry, NULL, 0); if(geosGeometry == NULL) { GEOSGeom_destroy(externalGeometry); diff --git a/geom/monetdb5/geom.mal b/geom/monetdb5/geom.mal --- a/geom/monetdb5/geom.mal +++ b/geom/monetdb5/geom.mal @@ -289,14 +289,14 @@ function MakeEnvelope(xmin:dbl, ymin:dbl return x; end MakeEnvelope;
-#function MakePolygon(external:wkb) :wkb; -# x := Polygon(external, NULL, 0); -# return x; -#end MakePolygon; -#function MakePolygon(external:wkb, srid:int) :wkb; -# x := Polygon(external, NULL, srid); -# return x; -#end MakePolygon; +function MakePolygon(external:wkb) :wkb; + x := Polygon(external, nil:bat, 0); + return x; +end MakePolygon; +function MakePolygon(external:wkb, srid:int) :wkb; + x := Polygon(external, nil:bat, srid); + return x; +end MakePolygon; #function MakePolygon(external:wkb, internal:bat[:oid,:wkb]) :wkb; # x := Polygon(external, internal, 0); # return x; diff --git a/geom/sql/40_geom.sql b/geom/sql/40_geom.sql --- a/geom/sql/40_geom.sql +++ b/geom/sql/40_geom.sql @@ -4070,9 +4070,9 @@ CREATE FUNCTION ST_MakePointM(x double, --CREATE FUNCTION ST_LineFromMultiPoint(pointGeom Geometry) RETURNS Geometry external name geom."LineFromMultiPoint"; --gets mutlipoint returns linestring CREATE FUNCTION ST_MakeEnvelope(xmin double, ymin double, xmax double, ymax double, srid integer) RETURNS Geometry external name geom."MakeEnvelope"; CREATE FUNCTION ST_MakeEnvelope(xmin double, ymin double, xmax double, ymax double) RETURNS Geometry external name geom."MakeEnvelope"; ---CREATE FUNCTION ST_MakePolygon(geom Geometry) RETURNS Geometry external name geom."MakePolygon"; --gets linestring ---CREATE FUNCTION ST_MakePolygon(outerGeom Geometry, interiorGeoms Geometry[]) RETURNS Geometry external name geom."MakePolygon"; --gets linestrings ---CREATE FUNCTION ST_Polygon(geom Geometry, srid integer) RETURNS Geometry external name geom."MakePolygon"; --gets linestring +CREATE FUNCTION ST_MakePolygon(geom Geometry) RETURNS Geometry external name geom."MakePolygon"; --gets linestring +--CREATE FUNCTION ST_MakePolygon(outerGeom Geometry, interiorGeoms table(g Geometry)) RETURNS Geometry external name geom."MakePolygon"; --gets linestrings +CREATE FUNCTION ST_Polygon(geom Geometry, srid integer) RETURNS Geometry external name geom."MakePolygon"; --gets linestring CREATE FUNCTION ST_MakeBox2D(lowLeftPointGeom Geometry, upRightPointGeom Geometry) RETURNS mbr external name geom."MakeBox2D"; --gets 2d points --CREATE FUNCTION ST_3DMakeBox(lowLeftPointGeom Geometry, upRightPointGeom Geometry) RETURNS mbr external name geom."MakeBox3D"; --gets 3d points
_______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list