mbloch / mapshaper

Tools for editing Shapefile, GeoJSON, TopoJSON and CSV files
http://mapshaper.org
Other
3.73k stars 532 forks source link

Winkel tripel produces weird effects with world-covering geojson input #471

Closed matkoniecz closed 3 years ago

matkoniecz commented 3 years ago

Worldwide geojson (quoted below and visualised at https://gist.github.com/matkoniecz/55734c7fcfbe0966de9214afd1a51149 ) in Winkel Tripel projection has wrong proportions.

https://gist.github.com/matkoniecz/55734c7fcfbe0966de9214afd1a51149 also has svg produced by process below and one generated from natural earth 110m ocean data and working fine.

mapshaper -quiet -i combine-files 'world.geojson' -style fill=#6666ff -proj 'wintri' -o 'test.svg'

Produces image in really weird proportions (800 x 1222). What completely mismatches what I would expect from worldwide bbox in Winkel tripel projection.

Curiously, WIkel tripel projected Natural Earth data is perfectly fine, while this geojson behaves like it was projected in Web Mercator.

screen06

Sorry for bothering you, but I am starting to suspect that there may be a bug here (though it is more likely that I am misunderstanding something).

Geojson input seems valid and I am confused what may be wrong in this command.

{
    "type": "FeatureCollection",
    "features": [{
        "type": "Feature",
        "geometry": {
            "type": "Polygon",
            "coordinates": [
                [
                    [-179, -89],
                    [179, -89],
                    [179, 89],
                    [-179, 89],
                    [-179, -89]
                ]
            ]
        },
        "properties": {}
    }]
}
mbloch commented 3 years ago

The -proj command's default behavior is to just project the vertex points of your shapes. So if your input is a rectangle, your output is going to be a rectangle too. You have to use the densify option to add additional points to make the nice curves that you want. -proj wintri densify is what you want.

matkoniecz commented 3 years ago

Thanks! I will need to think how to apply to root cause


I produce multiple SVG with mapshaper - for example one with label, one with lines (roads), one with water etc. To ensure that all are covering the same area I am putting points in corners. (otherwise label with be generated just with nearby areas and mergng svgs into one is no longer possible)

It stopped working with worldwide wintri, I will need to figure out how to solve it. densify seems to be not working on points (obviously). Replace it with polygon where densify will work and remove it manually on final step before laser cutting?