Skip to content
This repository has been archived by the owner on Mar 8, 2023. It is now read-only.

Commit

Permalink
HARP-10648: Add a test for polygons touching the tile border.
Browse files Browse the repository at this point in the history
The test demonstrates the issues that harp.gl has when
stroking polygons with edges at the tile border.

Signed-off-by: Roberto Raggi <roberto.raggi@here.com>
  • Loading branch information
robertoraggi committed Jun 23, 2020
1 parent e1c4a9b commit 3baa616
Showing 1 changed file with 50 additions and 1 deletion.
51 changes: 50 additions & 1 deletion test/rendering/GeoJsonDataRendering.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// tslint:disable:only-arrow-functions
// Mocha discourages using arrow functions, see https://mochajs.org/#arrow-functions

import { GeoJson, Light, StyleSet, Theme } from "@here/harp-datasource-protocol";
import { FeatureCollection, GeoJson, Light, StyleSet, Theme } from "@here/harp-datasource-protocol";
import { LookAtParams, MapView, MapViewEventNames } from "@here/harp-mapview";
import { GeoJsonTiler } from "@here/harp-mapview-decoder/index-worker";
import { GeoJsonDataProvider, OmvDataSource } from "@here/harp-omv-datasource";
Expand Down Expand Up @@ -238,4 +238,53 @@ describe("MapView + OmvDataSource + GeoJsonDataProvider rendering test", functio
}
});
});

it("renders geometry touching the tile border", async function() {
this.timeout(5000);

const geoJson: FeatureCollection = {
type: "FeatureCollection",
features: [
{
type: "Feature",
properties: {
"fill-color": "rgb(255,255,0)",
"stroke-color": "#000"
},
geometry: {
type: "Polygon",
coordinates: [
[
[0, 51.5],
[0.01, 51.5],
[0, 51.49],
[0, 51.5]
]
]
}
}
]
};

const ourStyle: StyleSet = [
{
when: ["==", ["geometry-type"], "Polygon"],
technique: "fill",
color: ["get", "fill-color"],
lineColor: ["get", "stroke-color"],
lineWidth: 1
}
];

await geoJsonTest({
mochaTest: this,
testImageName: "geojson-stroke-polygons-at-tile-border",
theme: { lights, styles: { geojson: ourStyle } },
geoJson,
lookAt: {
target: [0, 51.5],
zoomLevel: 13.4
}
});
});
});

0 comments on commit 3baa616

Please sign in to comment.