Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preload samples to choose in the Mapshaper GUI #511

Closed
ThomasG77 opened this issue Nov 4, 2021 · 1 comment
Closed

Preload samples to choose in the Mapshaper GUI #511

ThomasG77 opened this issue Nov 4, 2021 · 1 comment

Comments

@ThomasG77
Copy link

ThomasG77 commented Nov 4, 2021

I was looking at this 4 year old video https://www.youtube.com/watch?v=X-CGAS4YaPA and I've seen you displayed a panel on top of "Drop files here or select from a folder" panel when using the GUI e.g
Mapshaper custom GUI with samples

Is it an included function I'm not aware, a custom dev? I consider the function useful for things like workshop, hence the question.

@ThomasG77
Copy link
Author

ThomasG77 commented Nov 10, 2021

Ok. Found out how to. Feel free to make a feedback if any better approach

Prepare required deps

git clone https://github.com/mbloch/mapshaper.git
cd mapshaper
npm i
npm run build

Copy www directory to use as standalone

cp -r www/ somewhere/
cd somewhere/www
echo "mapshaper.manifest = {
  catalog: {
    cols: 3,
    title: 'Demo Datasets catalog',
    items: [{
      title: 'Sample One',
      subtitle: 'Populated places',
      files: [
        'https://d2ad6b4ur7yvpq.cloudfront.net/naturalearth-3.3.0/ne_50m_populated_places.geojson'
      ]
    }, {
      title: 'Sample Two',
      subtitle: 'Countries',
      url: '',
      files: [
        'https://d2ad6b4ur7yvpq.cloudfront.net/naturalearth-3.3.0/ne_50m_admin_0_countries.geojson'
      ]
    }, {
      title: 'Sample Three',
      subtitle: 'French admin boundaries called departements',
      url: '',
      files: [
        'https://labs.webgeodatavore.com/partage/DEPARTEMENT.zip'
      ]
    }]
  }
};" >| manifest.js

Run the directory from an http server. Here we use a standalone Node.js based, but you can choose your own mileage if any preference

npm i http-server
http-server

Open http://127.0.0.1:8080/ and see below result

Sélection_563

For third party reading the comment, for other approaches, don't forget the wiki https://github.com/mbloch/mapshaper/wiki/Web-Interface

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant