Giter VIP home page Giter VIP logo

Comments (4)

lautarodapin-magoya avatar lautarodapin-magoya commented on May 27, 2024

I change the code because ii read the the input filies must be a arraybuffer to
but i get the same error

 const files = [...e.target.files];
        const buffers = await Promise.all(files.map((file) => fileRead(file)));
        const input = files.reduce((acc, curr, i) => {
            acc[curr.name] = buffers[i];
            return acc;
        }, {});
        const names = files.map((file) => file.name).join(' -i ');
        const cmd = `${files.map((file) => `-i ${file.name}`).join(' ')} -o  format=geojson`;
        console.log({cmd, input});
        // mapshaper.runCommands(`${files.map((file) => `-i ${file.name}`).join(' ')} -o geojson.json format=geojson`);
        mapshaper.applyCommands(cmd, input, (err, output) => {
            console.log(err);
            console.log(output);
        });

from mapshaper.

mbloch avatar mbloch commented on May 27, 2024

I see... you want to use the JS api in a web browser. The -i command doesn't work in the console of the mapshaper web UI, which is why I added the error message that you're seeing. I'll try to get this fixed for you in the next release. Thanks for filing this issue :)

from mapshaper.

lautarodapin-magoya avatar lautarodapin-magoya commented on May 27, 2024

thanks for the fast response! @mbloch how the https://mapshaper.org/ works? i try to search in the source code how it does it, but i couldn't solve it

from mapshaper.

mbloch avatar mbloch commented on May 27, 2024

Hi, I think that I fixed the problem that you were having using applyCommands in the browser. You can try v0.6.51, which I just published.

https://mapshaper.org just serves a static web page, it's the same page as index.html in the www/ folder of the github repo. Mapshaper will mostly work if you open the index.html file in a web browser.

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.