npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

leaflet-ellipsis

v3.1.9

Published

Use Ellipsis Drive layers in leaflet projects.

Downloads

49

Readme

Installing the library

All releases of this package are listed in the release list on github here. To install this library, simply find the latest .js file in there, and put it in the directory of your project.

Import the ellipsis library in leaflet project

with script tags

<!-- Import leaflet -->
<link
  rel="stylesheet"
  href="https://unpkg.com/[email protected]/dist/leaflet.css"
/>
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
<!-- Import ellipsis library -->
<script src="https://github.com/ellipsis-drive/ellipsis-js-util/releases/download/1.1.0/ellipsis-js-util-1.1.0.js"></script>
<script src="https://github.com/ellipsis-drive/leaflet-package/releases/download/3.1.0/leaflet-ellipsis-3.1.0.js"></script>

with npm npm install leaflet-ellipsis

Add an ellipsis-drive map to leaflet map

Example

const map = L.map("map", {
  center: [51.505, -0.09],
  zoom: 13,
});

// Raster layer
new leafletEllipsis.EllipsisRasterLayer({
  pathId: pathId, timestampId:timestampId, style:styleId, zoom:zoom  token: yourToken,
}).addTo(map);

// Vector layer
new leafletEllipsis.EllipsisVectorLayer({
  pathId: pathId,
  token: yourToken,
}).addTo(map);

The timestampId and style are required for raster layers, you can use AsyncEllipsisRasterLayer in order to make use of defaults suggested by the server.

const createEllipsisRasterLayer = async () => {
  const someRaster = await leafletEllipsis.AsyncEllipsisRasterLayer({
    pathId: pathId,
  });
  someRaster.addTo(map);
};

createEllipsisRasterLayer();

In this case only the pathId is required.

Obtaining tokens

To use layers that are not set to public or link sharing you need to pass a token as a parameter. See here for how to obtain such a token.

RasterLayer options

| Name | Description | | ----------- | ---------------------------------------- | | pathId | id of the path | | timestampId | id of the timestamp | | style | id of a style or an object describing it | | zoom | max native zoomlevel of the layer. | | token | token of the user |

note for the style object, refer to this documentation about it.

A raster layer is equiped with a getColor function. You can use this function to get the pixel values of a certain point. The input should be an object with properties lat and lng both as float.

In this example the raster value of the layer is logged on mouse hover:

const layer = new EllipsisRasterLayer({
  pathId: "552c92e8-8422-46eb-bb55-1eb39e18eee9",
  timestampId: "a19ef596-c48b-479e-87f5-b808cf6fb4d3",
  style: "5b2deacd-a1e3-4b3f-b53a-ae05a0c7fd8d",
  zoom: 14,
});

map.on("mousemove", function (event) {
  var a = layer.getColor(event.latlng);
  console.log("A", a);

});

layer.addTo(map);

VectorLayer options

| Name | Description | | ------------------ | ------------------------------------------------------------------------ | | pathId | Id of the path | | timestampId | Id of the timestamp | | style | id of a style or an object describing it | | onFeatureClick | A function to run on feature click, with as argument the clicked feature | | onFeatureHover | A function to run on feature hover, with as argument the clicked feature and the event | | token | Token of the user | | filter | A property filter to use | | zoom | max native zoomlevel of the layer, if not given uses the zoom as specified in the layer metadata. | | pageSize | Size to retreive per step. Default 25, max 3000. | | maxMbPerTile | The maximum mb to load per tile. Default 16mb. | | maxRenderTiles | The number of tiles to render in the view. Default 100. | | maxFeaturesPerTile | The maximum number of features to load per tile. Default 200. | | useMarkers | If set to true, points will be displayed as markers. Default false. | | loadAll | Boolean whehter to keep loading features indefinitely. Default false. |

note for the style object, refer to this documentation about it.

EllipsisApi functions

EllipsisApi.getPath description

parameters | name | description | | -- | -- | | pathId | The id of the path. | | user | (Optional) An user object which can contain a token like user: {token: mytoken} |

return value It returns JSON, which contains metadata of the the specified path in your drive.