How to use the @turf/bbox-polygon.default function in @turf/bbox-polygon

To help you get started, we’ve selected a few @turf/bbox-polygon examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mapbox / tile-reduce / src / cover.js View on Github external
function cover(options) {
  if (Array.isArray(options.tiles)) return zoomTiles(options.tiles, options.zoom);

  var area = options.bbox ? bboxPolygon(options.bbox).geometry :
    options.geojson ? options.geojson.geometry || options.geojson : null;

  return area ? tilecover.tiles(area, {min_zoom: options.zoom, max_zoom: options.zoom}) : null;
}
github hotosm / MapCampaigner / lambda_functions / process / make_pdf_grid / index.js View on Github external
async function main(event) {
    const response = await getS3File(event.campaign_uuid);
    const f = JSON.parse(response).features
    const options = {units:"meters"}
    const features = []
    for (let i = 0; i < f.length; i++) {
        const box = bbox(f[i]);
        const w = distance([box[0], box[1]],[box[2],box[1]],{units:"meters"})
        const h = distance([box[0], box[1]],[box[0],box[3]],{units:"meters"})
        const wDiff = 1000 - (w % 1000);
        const hDiff = 706 - (h % 706);
        const poly = bboxPolygon(box);
        const c = centerOfMass(poly);
        const maxY = destination(c,(50 + h + hDiff)/2, 0, options).geometry.coordinates[1];
        const minY = destination(c,(50 +h + hDiff)/2, 180,options).geometry.coordinates[1];
        const maxX = destination(c,(50 + w + wDiff)/2, 90,options).geometry.coordinates[0];
        const minX = destination(c,(50 + w + wDiff)/2, -90,options).geometry.coordinates[0];
        const grid = rectangleGrid([minX, minY, maxX, maxY], 1000, 706, {units:"meters"});
        for (let j=0; j
github geosolutions-it / MapStore2 / web / client / utils / CoordinatesUtils.js View on Github external
const getPolygonFromExtent = (extent) => {
    if (extent) {
        if (extent.hasOwnProperty('geometry') && extent.geometry.type === "Polygon") {
            return extent;
        }
        return bboxPolygon(extent);
    }
    return null;
};
/**
github digidem / mapbox-map-image-export / lib / map_image_stream.js View on Github external
function mapImageStream (map, dim, bbox, origBbox, debug) {
  if (debug) {
    const geojson = {
      type: 'FeatureCollection',
      features: [
        bboxPolygon(bbox, { id: 0 }),
        bboxPolygon(origBbox, { id: 1 })
      ]
    }
    try {
      map.addSource('bbox', { type: 'geojson', data: geojson })
    } catch (e) {
      map.getSource('bbox').setData(geojson)
    }

    if (!map.getLayer('orig-bbox')) {
      map.addLayer(origBboxLayer).addLayer(tileBboxLayer)
    }
  }

  if (map.__mmie_processing) throw Error('map instance is currently processing')
  map.__mmie_processing = true
  var inprogress = false
github digidem / mapbox-map-image-export / lib / map_image_stream.js View on Github external
function mapImageStream (map, dim, bbox, origBbox, debug) {
  if (debug) {
    const geojson = {
      type: 'FeatureCollection',
      features: [
        bboxPolygon(bbox, { id: 0 }),
        bboxPolygon(origBbox, { id: 1 })
      ]
    }
    try {
      map.addSource('bbox', { type: 'geojson', data: geojson })
    } catch (e) {
      map.getSource('bbox').setData(geojson)
    }

    if (!map.getLayer('orig-bbox')) {
      map.addLayer(origBboxLayer).addLayer(tileBboxLayer)
    }
  }

  if (map.__mmie_processing) throw Error('map instance is currently processing')
  map.__mmie_processing = true
github koopjs / winnow / src / geometry / transform-array.js View on Github external
module.exports = function (array) {
  return bboxPolygon(array).geometry
}

@turf/bbox-polygon

turf bbox-polygon module

MIT
Latest version published 3 years ago

Package Health Score

89 / 100
Full package analysis

Popular @turf/bbox-polygon functions