Comments (6)
I have found the checkbox :) But it is not really what I would like to keep, it keeps every single island. It makes no sense in case of Chile for example...
from mapshaper.
Thanks for writing. I agree it's generally not useful to retain all of the parts of a multi-part shape. I've been planning to update the "prevent shape removal" option so that it retains the part with the largest original area and allows other parts to disappear at high simplification. Would that be preferable to you?
from mapshaper.
So far I tried
MapShaper.calcPointRetentionData = function(shapes, retainedPointCounts, arcCounts) {
Utils.forEach(shapes, function(shape, shapeId) {
if (!shape) return;
var l = 0, a;
for (var i=0, n=shape.length; i<n; i++) {
var arcs = shape[i];
// if a part has 3 or more arcs, assume it won't collapse...
// TODO: look into edge cases where this isn't true
if (arcs.length <= 2) { // && pathData[pathId].isPrimary) {
if (l < arcs.length) {
l = arcs.length; a = arcs;
}
}
}
if (a) {
MapShaper.calcRetainedCountsForRing(a, retainedPointCounts, arcCounts);
}
});
return retainedPointCounts;
};
but it has bad effects such as continental Greece disappearing while leaving Crete there, for example. Also whole single-island states like Cuba disappear any way, probably because they start as complex shape originally.
I think the area check would be great, but might not be enough in the end, too. While helping the above Greece and Cube problem, it will do nothing for disappearing Hawaii, for example.
from mapshaper.
Well, you could always split Hawaii in the source and then merge it back... so I guess go for area check 👍
from mapshaper.
I pushed an update (41fe109) that changes the behavior of the "prevent shape removal" option so that it only protects the largest ring of multi-ring polygon features. I just added a comment to issue #14 with an explanation.
from mapshaper.
This actually worked very good :) Andorra is now very small triangle, but it exists.
from mapshaper.
Related Issues (20)
- 1 degree x 1 degree graticule and source units HOT 1
- Warn when exporting SVG paths with more than 32,000 vertices
- light blue paths and performance HOT 3
- Memory usage almost 4x size of input geojson file HOT 4
- Filter lines still create polygons HOT 5
- When hovering mouse over feature and scrolling, fill color freaks out HOT 1
- Point layers and data layers do not show up HOT 2
- Cannot convert between WGS84 and Webmercator after converting and saving data as EPSG:3857. HOT 3
- Error on simplifying GeoJSON file HOT 11
- Javascript error related to polygon editing causes GUI to crash HOT 1
- There is an issue when you import a shapefile HOT 2
- Clip command removes Features visually but not from exported file. HOT 4
- Sticky hand HOT 1
- snap effects multiples layers HOT 1
- geojson from points HOT 2
- Export failed Export failed for an unknown reason HOT 3
- topojson files in power bi HOT 2
- Problem in drawing polygon and importing snapshot file HOT 4
- Export to Shape File Not working HOT 12
- Bug: can't open snapshot file I created on mapshaper.org HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mapshaper.