Changeset: f2dbd19053bc for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/f2dbd19053bc
Modified Files:
geom/monetdb5/geom.c
sql/backends/monet5/vaults/shp/75_shp.sql
sql/backends/monet5/vaults/shp/shp.c
Branch: geo-update
Log Message:
Fixes for shpload and multi-geometry fix on geographic distance.
diffs (100 lines):
diff --git a/geom/monetdb5/geom.c b/geom/monetdb5/geom.c
--- a/geom/monetdb5/geom.c
+++ b/geom/monetdb5/geom.c
@@ -557,33 +557,23 @@ static double geoDistanceSingle(GEOSGeom
return INT_MAX;
}
-//TODO Check if the GetGeometryN works for a single Geometry (not on
collections) for the case where one is a collection and the other is not
static double geoDistanceInternal(GEOSGeom a, GEOSGeom b)
{
int numGeomsA = GEOSGetNumGeometries(a), numGeomsB =
GEOSGetNumGeometries(b);
- if (numGeomsA == 1 && numGeomsB == 1)
- {
- //Single geometry
- return geoDistanceSingle(a, b);
- }
- else
- {
- //Geometry collection
- double distance, min_distance = INT_MAX;
- GEOSGeometry *geo1, *geo2;
- for (int i = 0; i < numGeomsA; i++)
+ double distance, min_distance = INT_MAX;
+ GEOSGeometry *geo1, *geo2;
+ for (int i = 0; i < numGeomsA; i++)
+ {
+ geo1 = (GEOSGeometry *)GEOSGetGeometryN((const GEOSGeometry
*)a, i);
+ for (int j = 0; j < numGeomsB; j++)
{
- geo1 = (GEOSGeometry *)GEOSGetGeometryN((const
GEOSGeometry *)a64l, i);
- for (int j = 0; j < numGeomsB; j++)
- {
- geo2 = (GEOSGeometry *)GEOSGetGeometryN((const
GEOSGeometry *)b, j);
- distance = geoDistanceSingle(geo1, geo2);
- if (distance < min_distance)
- min_distance = distance;
- }
+ geo2 = (GEOSGeometry *)GEOSGetGeometryN((const
GEOSGeometry *)b, j);
+ distance = geoDistanceSingle(geo1, geo2);
+ if (distance < min_distance)
+ min_distance = distance;
}
- return min_distance;
- }
+ }
+ return min_distance;
}
/* Calculates the distance, in meters, between two geographic geometries with
latitude/longitude coordinates */
@@ -593,9 +583,7 @@ str wkbDistanceGeographic(dbl *out, wkb
GEOSGeom ga, gb;
err = wkbGetComplatibleGeometries(a, b, &ga, &gb);
if (ga && gb)
- {
(*out) = geoDistanceInternal(ga, gb);
- }
GEOSGeom_destroy(ga);
GEOSGeom_destroy(gb);
diff --git a/sql/backends/monet5/vaults/shp/75_shp.sql
b/sql/backends/monet5/vaults/shp/75_shp.sql
--- a/sql/backends/monet5/vaults/shp/75_shp.sql
+++ b/sql/backends/monet5/vaults/shp/75_shp.sql
@@ -4,4 +4,4 @@
--
-- Copyright 1997 - July 2008 CWI, August 2008 - 2021 MonetDB B.V.
-create procedure SHPload(fname string, tablename string) external name
shp.load;
+create procedure shpload(fname string, tablename string) external name
shp.load;
diff --git a/sql/backends/monet5/vaults/shp/shp.c
b/sql/backends/monet5/vaults/shp/shp.c
--- a/sql/backends/monet5/vaults/shp/shp.c
+++ b/sql/backends/monet5/vaults/shp/shp.c
@@ -304,6 +304,9 @@ str loadSHPtable(mvc *m, sql_schema *sch
char *nameToLowerCase = NULL;
int i;
+ BAT *pos = NULL;
+ sqlstore *store;
+
/* SHP-level descriptor */
OGRFieldDefnH hFieldDefn;
OGRFeatureH feature;
@@ -468,8 +471,7 @@ str loadSHPtable(mvc *m, sql_schema *sch
if (rc != GDK_SUCCEED)
goto unfree;
}
- sqlstore *store = m->session->tr->store;
- BAT *pos = NULL;
+ store = m->session->tr->store;
/* finalise the BATs */
pos = store->storage_api.claim_tab(m->session->tr, data_table,
BATcount(colsBAT[0]));
if (!pos)
@@ -484,7 +486,7 @@ str loadSHPtable(mvc *m, sql_schema *sch
}
}
bat_destroy(pos);
-
+ return msg;
unfree:
for (i = 0; i < colsNum; i++)
{
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list