Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ebocher committed Sep 16, 2024
1 parent 6119c42 commit eb8c920
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ abstract class AbstractOSMToolsTest {
('POINT(0 10)', 3),('POINT(10 10)', 4);
CREATE TABLE ${prefix}_way_node(id_way int, id_node int, node_order int);
INSERT INTO ${prefix}_way_node VALUES(1, 1, 1),(1, 2, 2),(1, 3, 3),
(1, 4, 4),(1, 1, 5);
INSERT INTO ${prefix}_way_node VALUES(1, 1, 1),(1, 2, 2),(1, 4, 3),
(1, 5, 4),(1, 1, 5);
CREATE TABLE ${prefix}_way(id_way int);
INSERT INTO ${prefix}_way VALUES(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ class TransformTest extends AbstractOSMToolsTest {
@Test
void extractWaysAsPolygonsTest() {
def prefix = "OSM_" + uuid()
def epsgCode = 2453
def epsgCode = 4326
def tags = [building: "house"]
def columnsToKeep = ["water", "building"]

Expand Down Expand Up @@ -562,13 +562,13 @@ class TransformTest extends AbstractOSMToolsTest {
def tags = ["building"]
String outputTableName = OSMTools.Transform.toPolygons(ds, prefix, 4326, tags)
assertEquals 6, ds.firstRow("select count(*) as count from ${outputTableName} where ST_NumInteriorRings(the_geom) > 0").count as int
assertEquals 1032, ds.firstRow("select count(*) as count from ${outputTableName} where ST_NumInteriorRings(the_geom) = 0").count as int
assertEquals 1028, ds.firstRow("select count(*) as count from ${outputTableName} where ST_NumInteriorRings(the_geom) = 0").count as int

//Create landuse layer
tags = ["landuse": ["farmland", "forest", "grass", "meadow", "orchard", "vineyard", "village_green", "allotments"],]
outputTableName = OSMTools.Transform.toPolygons(ds, prefix, 4326, tags)
assertEquals 131, ds.firstRow("select count(*) as count from ${outputTableName}").count as int
assertEquals 123, ds.firstRow("select count(*) as count from ${outputTableName} where \"landuse\"='grass'").count as int
assertEquals 130, ds.firstRow("select count(*) as count from ${outputTableName}").count as int
assertEquals 122, ds.firstRow("select count(*) as count from ${outputTableName} where \"landuse\"='grass'").count as int

//Create urban areas layer
tags = ["landuse": [
Expand All @@ -579,8 +579,8 @@ class TransformTest extends AbstractOSMToolsTest {
]]
outputTableName = OSMTools.Transform.toPolygons(ds, prefix, 4326, tags)

assertEquals 6, ds.firstRow("select count(*) as count from ${outputTableName}").count as int
assertEquals 4, ds.firstRow("select count(*) as count from ${outputTableName} where \"landuse\"='residential'").count as int
assertEquals 5, ds.firstRow("select count(*) as count from ${outputTableName}").count as int
assertEquals 3, ds.firstRow("select count(*) as count from ${outputTableName} where \"landuse\"='residential'").count as int

}

Expand Down

0 comments on commit eb8c920

Please sign in to comment.