1.0.1 • Published 7 years ago

ol-geojson-vt v1.0.1

Weekly downloads
27
License
ISC
Repository
github
Last release
7 years ago

ol-geojson-vt

OpenLayers source class for loading GeoJSON as vector tiles. This makes it possible to render large geospatial datasets on the browser side without a server.

This library utilizes the geojson-vt library to enable efficient slicing of GeoJSON data into vector tiles on the fly.

Example:

import ol from 'openlayers'
import GeoJSONVectorTileSource from 'ol-geojson-vt'

const map = new ol.Map({
  layers: [
    new ol.layer.VectorTile({
      source: new GeoJSONVectorTileSource({
        data: {
          "type": "FeatureCollection",
          "features": [
            {
              "type": "Feature",
              "geometry": {
                "type": "Point",
                "coordinates": [0, 0]
              }
            }
          ]
        }
      })
    })
  ],
  view: new ol.View({
    center: [0, 0],
    zoom: 3
  })
})

Install

npm install ol-geojson-vt --save

Development

  1. git clone https://github.com/notnotse/ol-geojson-vt.git
  2. cd ol-geojson-vt
  3. npm install
  4. npm start
  5. http://localhost:3000/