-
-
Notifications
You must be signed in to change notification settings - Fork 717
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rendering of self-intersect polygon is inconsistant & not good form #1830
Comments
Can you check older versions? I don't think this issue was introduced recently. |
Thanks for you quick answer ! I also think that the problem is not recent. Geojson is agnostic to coordinates from Features ¹. But they are some "problems":
Sources |
Why not use a multipolygon in this case? |
Sometimes I've not the choice. If I get a Geojson with this format, I want have possibility to display correctly, without manual changes. With Leaflet, I didn't ask myself the question. Ideally, I wish I didn't have to worry about it 😅 |
Ideally I agree. You have two options here: fix the geometry, or send a PR to fix the code here. |
Yeah, for the moment I will fix the geometry with Turf. Thanks |
First, I thank everyone participating in maplibre developing project.
I also consider fixing the self intersecting is the first step towards solution.
I've also reported this case at the geojson-vt project. In this case, I hope maplibre will display the form that is not self intersecting, becase the original geojson is as well. The code blow is how I got the self intersecting WKT using the geojson that is not self intersecting. A20-070402_46_AmamiIslands_kasari_10_28.4441_129.6784.txt map.addSource('amami', {
type: 'geojson',
data: './geojson/A20-070402_46_AmamiIslands_kasari.json',
},);
map.addLayer({
id: 'amami_polygon',
type: 'fill',
source: 'amami',
paint: {
'fill-color': "rgb(255,0,0)",
'fill-opacity': 0.5,
'fill-outline-color': "rgb(0,0,255)",
'fill-antialias': true,
},
});
// get WKT
map.on('click', 'amami_polygon', function (e) {
const coordinates = e.features[0].geometry.coordinates[0];
let cood = "POLYGON((";
for (let i = 0; i < coordinates.length; i++) {
cood+= coordinates[i][0] + (' ') + coordinates[i][1] + ',';
}
cood += "))";
console.log(cood);
}
); |
maplibre-gl-js version:
2.3.0
Problem description
For self-intersect polygons, we have 2 problems:
Steps to Trigger Behavior
Draw a polygon with self intersection.
Example:
Link to Demonstration
JSfiddle example
Expected Behavior
Actual Behavior
The text was updated successfully, but these errors were encountered: