GithubHelp home page GithubHelp logo

Comments (3)

mbloch avatar mbloch commented on June 2, 2024

It sounds like you're saving your data as GeoJSON, yes? In 2016, a standards committee removed the crs property from GeoJSON and decided that GeoJSON should only use EPSG:4326 coordinates. Mapshaper lets
you export non-EPSG:4326 data, but as you pointed out, the CRS information does not get saved.

If you want to use mapshaper to import GeoJSON that uses EPSG:3857 coordinates, you can use the -proj command to tell mapshaper what CRS to use, like this:

mapshaper webmercator_data.geojson -proj init=EPSG:3857 ...

I'm not inclined to add a non-standard CRS property to mapshaper's output, if you really need to include CRS info with the file, then you can export as Shapefile or you can export to mapshaper's "snapshot" format, by saving to a file with the .msx suffix.

from mapshaper.

NMC92 avatar NMC92 commented on June 2, 2024

I understand, thanks for telling me. EPSG:4326 being the standard projection explains a lot of things.
And yes, I mean a GEOJSON. I was mostly just trying to understand why things are the way they are. Thank you!
P.S.: () -> Comments

As a last thing, is there any way to run this batch of commands on the console version of mapshaper? What I'm trying do achieve here is to get rid of polyline and points layers(since exporting data on overpass-turbo.eu is giving me additional stuff other than polygons). Thank you!

Batch(Edited):
mapshaper -i country.geojson \
-drop(Points layer) \
-drop target=2(Possible polylines layer) \
-filter 'tags.admin_level == 2' name=2 no-replace(filter out country polygon to its own layer) \
-target 1(change active layer to layer to clip) \
-clip 2(clip layer to the country polygon's layer) \
-merge-layers target 1,2 \
-proj webmercator \
-o countryEdited.geojson format=geojson \
-o countryEdited.json format=json \
-o countryEdited.svg format=svg

-- Edit: I found out I can do one of the things I wanted, meaning move the country polygon to its layer. Also, the following command works perfectly on the mapshaper website but when run on the terminal it can't find layer '2'(even though it can on the website) and stops the execution:

-drop -drop target=2 -filter 'tags.admin_level == 2' name=2 no-replace -target 1 -clip 2 -merge-layers target 1,2 -proj webmercator -o countryEdited.geojson format=geojson -o countryEdited.json format=json -o countryEdited.svg format=svg

from mapshaper.

NMC92 avatar NMC92 commented on June 2, 2024

I got it, after tweaking the code to fit my needs:
mapshaper -i countryCode.geojson -filter 'tags.admin_level == 2' name=country no-replace target=__id_1 -clip country target=__id_1 -proj webmercator -o force countryCode.geojson target=__id_1 format=geojson -o force countryCode-init.json target=__id_1 format=json -o force countryCode.svg target=__id_1 format=svg

As an added note, it would be useful to name your layers individually, should your -i file have multiple layers. Something like "name=(name1,name2,name3)" in the case of 3 layers in your file.

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.