GithubHelp home page GithubHelp logo

geometry:null about mapshaper HOT 6 CLOSED

makc avatar makc commented on May 19, 2024
geometry:null

from mapshaper.

Comments (6)

makc avatar makc commented on May 19, 2024

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.

mbloch avatar mbloch commented on May 19, 2024

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.

makc avatar makc commented on May 19, 2024

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.

makc avatar makc commented on May 19, 2024

Well, you could always split Hawaii in the source and then merge it back... so I guess go for area check 👍

from mapshaper.

mbloch avatar mbloch commented on May 19, 2024

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.

makc avatar makc commented on May 19, 2024

This actually worked very good :) Andorra is now very small triangle, but it exists.

from mapshaper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.