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

Document SpreadsheetLayers and spin out Leaflet.SpreadsheetLayer as a stand-alone Leaflet library #121

Open
jywarren opened this issue Feb 20, 2019 · 4 comments

Comments

@jywarren
Copy link
Member

jywarren commented Feb 20, 2019

@kevinzluo made a fantastic component for this library which really deserves to be its own Leaflet Plugin. Let's do it!

See a recent minimal Leaflet plugin I created here for reference: https://github.com/publiclab/leaflet-multispectral

Read more here: https://github.com/publiclab/leaflet-environmental-layers/blob/master/src/util/googleSpreadsheetLayer.js

We could make it in this repository: https://github.com/publiclab/leaflet-spreadsheet

I made a test spreadsheet here: https://docs.google.com/spreadsheets/d/14BvU3mEqvI8moLp0vANc7jeEvb0mnmYvH4I0GkwVsiU/edit#gid=0

Docs could be as follows, roughly:


### Spreadsheet-based layers

We can source locations from a spreadsheet in a format like this:

| Title  | Latitude | Longitude   | Notes             |
|--------|----------|-------------|-------------------|
| First	 | 29.671282 | -95.17829  | The first marker  |
| Second | 29.760371 | -95.504828 | The second marker |
| Third  | 29.917755 | -95.283494 | The third marker  |

The layer is constructed like this:

\```js
var layer = L.SpreadsheetLayer({
  url: 'https://docs.google.com/spreadsheets/d/14BvU3mEqvI8moLp0vANc7jeEvb0mnmYvH4I0GkwVsiU/edit?usp=sharing', // String url of data sheet
  lat: 'Latitude', // name of latitude column
  lon: 'Longitude', // name of longitude column
  columns: ['Title', 'Notes'], // Array of column names to be used
  generatePopup: function() {
    // function used to create content of popups
  },
  // imageOptions: // optional, defaults to blank
  // sheetNum: // optional, defaults to 0 (first sheet)
});
layer.addTo(map);
\```

Read more here: https://github.com/publiclab/leaflet-environmental-layers/blob/master/src/util/googleSpreadsheetLayer.js

There are other libraries that do parts of this, but I still think this is an elegant and flexible implementation that's worth spinning out:

@jywarren jywarren added help wanted Extra attention is needed Javascript labels Feb 20, 2019
@jywarren
Copy link
Member Author

Note that I'm having trouble instantiating a new layer... not sure why it's not working. @kevinzluo why does this have to be a LayerGroup?

@kevinzluo
Copy link
Contributor

kevinzluo commented Feb 20, 2019 via email

@grvsachdeva
Copy link
Member

No issue @kevinzluo, we understand your situation and you are most welcome to contribute anytime, as per your convenience. Thanks!

@jywarren
Copy link
Member Author

jywarren commented Feb 21, 2019 via email

@jywarren jywarren changed the title Spin out Leaflet.SpreadsheetLayer as a stand-alone Leaflet library Document SpreadsheetLayers and spin out Leaflet.SpreadsheetLayer as a stand-alone Leaflet library Jan 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants