3.1.9 • Published 11 months ago

leaflet-ellipsis v3.1.9

Weekly downloads
-
License
-
Repository
github
Last release
11 months ago

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/leaflet@1.7.1/dist/leaflet.css"
/>
<script src="https://unpkg.com/leaflet@1.7.1/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

NameDescription
pathIdid of the path
timestampIdid of the timestamp
styleid of a style or an object describing it
zoommax native zoomlevel of the layer.
tokentoken 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

NameDescription
pathIdId of the path
timestampIdId of the timestamp
styleid of a style or an object describing it
onFeatureClickA function to run on feature click, with as argument the clicked feature
onFeatureHoverA function to run on feature hover, with as argument the clicked feature and the event
tokenToken of the user
filterA property filter to use
zoommax native zoomlevel of the layer, if not given uses the zoom as specified in the layer metadata.
pageSizeSize to retreive per step. Default 25, max 3000.
maxMbPerTileThe maximum mb to load per tile. Default 16mb.
maxRenderTilesThe number of tiles to render in the view. Default 100.
maxFeaturesPerTileThe maximum number of features to load per tile. Default 200.
useMarkersIf set to true, points will be displayed as markers. Default false.
loadAllBoolean 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.

3.1.7

12 months ago

3.1.6

12 months ago

3.1.5

12 months ago

3.1.4

1 year ago

3.1.9

11 months ago

3.1.8

11 months ago

3.1.3

2 years ago

3.1.2

2 years ago

3.1.1

3 years ago

3.1.0

3 years ago

3.0.0

3 years ago