add immoweb ui
This commit is contained in:
parent
7e8c79d3d1
commit
151da16c27
266 changed files with 264879 additions and 0 deletions
20
immoweb/node_modules/@turf/meta/LICENSE
generated
vendored
Normal file
20
immoweb/node_modules/@turf/meta/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017 TurfJS
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
403
immoweb/node_modules/@turf/meta/README.md
generated
vendored
Normal file
403
immoweb/node_modules/@turf/meta/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,403 @@
|
|||
# @turf/meta
|
||||
|
||||
# coordEach
|
||||
|
||||
Iterate over coordinates in any GeoJSON object, similar to Array.forEach()
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `layer` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** any GeoJSON object
|
||||
- `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** a method that takes (currentCoords, currentIndex)
|
||||
- `excludeWrapCoord` **\[[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)]** whether or not to include
|
||||
the final coordinate of LinearRings that wraps the ring in its iteration. (optional, default `false`)
|
||||
|
||||
**Examples**
|
||||
|
||||
```javascript
|
||||
var features = {
|
||||
"type": "FeatureCollection",
|
||||
"features": [
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [26, 37]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [36, 53]
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
turf.coordEach(features, function (currentCoords, currentIndex) {
|
||||
//=currentCoords
|
||||
//=currentIndex
|
||||
});
|
||||
```
|
||||
|
||||
# coordReduce
|
||||
|
||||
Reduce coordinates in any GeoJSON object, similar to Array.reduce()
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `layer` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** any GeoJSON object
|
||||
- `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** a method that takes (previousValue, currentCoords, currentIndex)
|
||||
- `initialValue` **\[Any]** Value to use as the first argument to the first call of the callback.
|
||||
- `excludeWrapCoord` **\[[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)]** whether or not to include
|
||||
the final coordinate of LinearRings that wraps the ring in its iteration. (optional, default `false`)
|
||||
|
||||
**Examples**
|
||||
|
||||
```javascript
|
||||
var features = {
|
||||
"type": "FeatureCollection",
|
||||
"features": [
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [26, 37]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [36, 53]
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
turf.coordReduce(features, function (previousValue, currentCoords, currentIndex) {
|
||||
//=previousValue
|
||||
//=currentCoords
|
||||
//=currentIndex
|
||||
return currentCoords;
|
||||
});
|
||||
```
|
||||
|
||||
Returns **Any** The value that results from the reduction.
|
||||
|
||||
# propEach
|
||||
|
||||
Iterate over properties in any GeoJSON object, similar to Array.forEach()
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `layer` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** any GeoJSON object
|
||||
- `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** a method that takes (currentProperties, currentIndex)
|
||||
|
||||
**Examples**
|
||||
|
||||
```javascript
|
||||
var features = {
|
||||
"type": "FeatureCollection",
|
||||
"features": [
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {"foo": "bar"},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [26, 37]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {"hello": "world"},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [36, 53]
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
turf.propEach(features, function (currentProperties, currentIndex) {
|
||||
//=currentProperties
|
||||
//=currentIndex
|
||||
});
|
||||
```
|
||||
|
||||
# propReduce
|
||||
|
||||
Reduce properties in any GeoJSON object into a single value,
|
||||
similar to how Array.reduce works. However, in this case we lazily run
|
||||
the reduction, so an array of all properties is unnecessary.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `layer` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** any GeoJSON object
|
||||
- `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** a method that takes (previousValue, currentProperties, currentIndex)
|
||||
- `initialValue` **\[Any]** Value to use as the first argument to the first call of the callback.
|
||||
|
||||
**Examples**
|
||||
|
||||
```javascript
|
||||
var features = {
|
||||
"type": "FeatureCollection",
|
||||
"features": [
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {"foo": "bar"},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [26, 37]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {"hello": "world"},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [36, 53]
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
turf.propReduce(features, function (previousValue, currentProperties, currentIndex) {
|
||||
//=previousValue
|
||||
//=currentProperties
|
||||
//=currentIndex
|
||||
return currentProperties
|
||||
});
|
||||
```
|
||||
|
||||
Returns **Any** The value that results from the reduction.
|
||||
|
||||
# featureEach
|
||||
|
||||
Iterate over features in any GeoJSON object, similar to
|
||||
Array.forEach.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `layer` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** any GeoJSON object
|
||||
- `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** a method that takes (currentFeature, currentIndex)
|
||||
|
||||
**Examples**
|
||||
|
||||
```javascript
|
||||
var features = {
|
||||
"type": "FeatureCollection",
|
||||
"features": [
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [26, 37]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [36, 53]
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
turf.featureEach(features, function (currentFeature, currentIndex) {
|
||||
//=currentFeature
|
||||
//=currentIndex
|
||||
});
|
||||
```
|
||||
|
||||
# featureReduce
|
||||
|
||||
Reduce features in any GeoJSON object, similar to Array.reduce().
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `layer` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** any GeoJSON object
|
||||
- `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** a method that takes (previousValue, currentFeature, currentIndex)
|
||||
- `initialValue` **\[Any]** Value to use as the first argument to the first call of the callback.
|
||||
|
||||
**Examples**
|
||||
|
||||
```javascript
|
||||
var features = {
|
||||
"type": "FeatureCollection",
|
||||
"features": [
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {"foo": "bar"},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [26, 37]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {"hello": "world"},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [36, 53]
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
turf.featureReduce(features, function (previousValue, currentFeature, currentIndex) {
|
||||
//=previousValue
|
||||
//=currentFeature
|
||||
//=currentIndex
|
||||
return currentFeature
|
||||
});
|
||||
```
|
||||
|
||||
Returns **Any** The value that results from the reduction.
|
||||
|
||||
# coordAll
|
||||
|
||||
Get all coordinates from any GeoJSON object.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `layer` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** any GeoJSON object
|
||||
|
||||
**Examples**
|
||||
|
||||
```javascript
|
||||
var features = {
|
||||
"type": "FeatureCollection",
|
||||
"features": [
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [26, 37]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [36, 53]
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
var coords = turf.coordAll(features);
|
||||
//=coords
|
||||
```
|
||||
|
||||
Returns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>>** coordinate position array
|
||||
|
||||
# geomEach
|
||||
|
||||
Iterate over each geometry in any GeoJSON object, similar to Array.forEach()
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `layer` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** any GeoJSON object
|
||||
- `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** a method that takes (currentGeometry, currentIndex)
|
||||
|
||||
**Examples**
|
||||
|
||||
```javascript
|
||||
var features = {
|
||||
"type": "FeatureCollection",
|
||||
"features": [
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [26, 37]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [36, 53]
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
turf.geomEach(features, function (currentGeometry, currentIndex) {
|
||||
//=currentGeometry
|
||||
//=currentIndex
|
||||
});
|
||||
```
|
||||
|
||||
# geomReduce
|
||||
|
||||
Reduce geometry in any GeoJSON object, similar to Array.reduce().
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `layer` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** any GeoJSON object
|
||||
- `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** a method that takes (previousValue, currentGeometry, currentIndex)
|
||||
- `initialValue` **\[Any]** Value to use as the first argument to the first call of the callback.
|
||||
|
||||
**Examples**
|
||||
|
||||
```javascript
|
||||
var features = {
|
||||
"type": "FeatureCollection",
|
||||
"features": [
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {"foo": "bar"},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [26, 37]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {"hello": "world"},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [36, 53]
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
turf.geomReduce(features, function (previousValue, currentGeometry, currentIndex) {
|
||||
//=previousValue
|
||||
//=currentGeometry
|
||||
//=currentIndex
|
||||
return currentGeometry
|
||||
});
|
||||
```
|
||||
|
||||
Returns **Any** The value that results from the reduction.
|
||||
|
||||
<!-- This file is automatically generated. Please don't edit it directly:
|
||||
if you find an error, edit the source file (likely index.js), and re-run
|
||||
./scripts/generate-readmes in the turf project. -->
|
||||
|
||||
---
|
||||
|
||||
This module is part of the [Turfjs project](http://turfjs.org/), an open source
|
||||
module collection dedicated to geographic algorithms. It is maintained in the
|
||||
[Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create
|
||||
PRs and issues.
|
||||
|
||||
### Installation
|
||||
|
||||
Install this module individually:
|
||||
|
||||
```sh
|
||||
$ npm install @turf/meta
|
||||
```
|
||||
|
||||
Or install the Turf module that includes it as a function:
|
||||
|
||||
```sh
|
||||
$ npm install @turf/turf
|
||||
```
|
||||
101
immoweb/node_modules/@turf/meta/index.d.ts
generated
vendored
Normal file
101
immoweb/node_modules/@turf/meta/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
/// <reference types="geojson" />
|
||||
|
||||
type Points = GeoJSON.FeatureCollection<GeoJSON.Point>
|
||||
type Point = GeoJSON.Feature<GeoJSON.Point> | GeoJSON.Point
|
||||
type MultiPoints = GeoJSON.FeatureCollection<GeoJSON.MultiPoint>
|
||||
type MultiPoint = GeoJSON.Feature<GeoJSON.MultiPoint> | GeoJSON.MultiPoint
|
||||
type LineStrings = GeoJSON.FeatureCollection<GeoJSON.LineString>
|
||||
type LineString = GeoJSON.Feature<GeoJSON.LineString> | GeoJSON.LineString
|
||||
type MultiLineStrings = GeoJSON.FeatureCollection<GeoJSON.MultiLineString>
|
||||
type MultiLineString = GeoJSON.Feature<GeoJSON.MultiLineString> | GeoJSON.MultiLineString
|
||||
type Polygons = GeoJSON.FeatureCollection<GeoJSON.Polygon>
|
||||
type Polygon = GeoJSON.Feature<GeoJSON.Polygon> | GeoJSON.Polygon
|
||||
type MultiPolygons = GeoJSON.FeatureCollection<GeoJSON.MultiPolygon>
|
||||
type MultiPolygon = GeoJSON.Feature<GeoJSON.MultiPolygon> | GeoJSON.MultiPolygon
|
||||
type Feature = GeoJSON.Feature<any>
|
||||
type Features = GeoJSON.FeatureCollection<any>
|
||||
type GeometryCollection = GeoJSON.GeometryCollection
|
||||
type GeometryObject = GeoJSON.GeometryObject
|
||||
|
||||
interface MetaStatic {
|
||||
/**
|
||||
* http://turfjs.org/docs/#coordeach
|
||||
*/
|
||||
coordEach(layer: Points | Point | MultiPoint | MultiPoints, callback: (currentCoords: Array<number>, currentIndex: number) => void, excludeWrapCoord?: boolean): void;
|
||||
coordEach(layer: LineStrings | LineString | MultiLineString | MultiLineStrings, callback: (currentCoords: Array<Array<number>>, currentIndex: number) => void, excludeWrapCoord?: boolean): void;
|
||||
coordEach(layer: Polygons | Polygon | MultiPolygons | MultiPolygon, callback: (currentCoords: Array<Array<Array<number>>>, currentIndex: number) => void, excludeWrapCoord?: boolean): void;
|
||||
coordEach(layer: GeometryCollection | GeometryObject, callback: (currentCoords: Array<any>, currentIndex: number) => void, excludeWrapCoord?: boolean): void;
|
||||
|
||||
/**
|
||||
* http://turfjs.org/docs/#coordreduce
|
||||
*/
|
||||
coordReduce(layer: Points | Point | MultiPoint | MultiPoints, callback: (previousValue: any, currentCoords: Array<number>, currentIndex: number) => void, initialValue: any, excludeWrapCoord?: boolean): any;
|
||||
coordReduce(layer: LineStrings | LineString | MultiLineString | MultiLineStrings, callback: (previousValue: any, currentCoords: Array<Array<number>>, currentIndex: number) => void, initialValue: any, excludeWrapCoord?: boolean): any;
|
||||
coordReduce(layer: Polygons | Polygon | MultiPolygons | MultiPolygon, callback: (previousValue: any, currentCoords: Array<Array<Array<number>>>, currentIndex: number) => void, initialValue: any, excludeWrapCoord?: boolean): any;
|
||||
coordReduce(layer: GeometryCollection | GeometryObject, callback: (previousValue: any, currentCoords: Array<any>, currentIndex: number) => void, initialValue: any, excludeWrapCoord?: boolean): any;
|
||||
|
||||
/**
|
||||
* http://turfjs.org/docs/#propeach
|
||||
*/
|
||||
propEach(layer: Feature | Features, callback: (currentProperties: any, currentIndex: number) => void): void;
|
||||
|
||||
/**
|
||||
* http://turfjs.org/docs/#propreduce
|
||||
*/
|
||||
propReduce(layer: Feature | Features, callback: (previousValue: any, currentProperties: any, currentIndex: number) => void, initialValue: any): any;
|
||||
|
||||
/**
|
||||
* http://turfjs.org/docs/#featurereduce
|
||||
*/
|
||||
featureReduce(layer: Point | Points, callback: (previousValue: any, currentFeature: Point, currentIndex: number) => void, initialValue: any): any;
|
||||
featureReduce(layer: LineString | LineStrings, callback: (previousValue: any, currentFeature: LineString, currentIndex: number) => void, initialValue: any): any;
|
||||
featureReduce(layer: Polygon | Polygons, callback: (previousValue: any, currentFeature: Polygon, currentIndex: number) => void, initialValue: any): any;
|
||||
featureReduce(layer: MultiPoint | MultiPoints, callback: (previousValue: any, currentFeature: MultiPoint, currentIndex: number) => void, initialValue: any): any;
|
||||
featureReduce(layer: MultiLineString | MultiLineStrings, callback: (previousValue: any, currentFeature: MultiLineString, currentIndex: number) => void, initialValue: any): any;
|
||||
featureReduce(layer: MultiPolygon | MultiPolygons, callback: (previousValue: any, currentFeature: MultiPolygon, currentIndex: number) => void, initialValue: any): any;
|
||||
featureReduce(layer: Feature | Features, callback: (previousValue: any, currentFeature: Feature, currentIndex: number) => void, initialValue: any): any;
|
||||
|
||||
|
||||
/**
|
||||
* http://turfjs.org/docs/#featureeach
|
||||
*/
|
||||
featureEach(layer: Point | Points, callback: (currentFeature: Point, currentIndex: number) => void): void;
|
||||
featureEach(layer: LineString | LineStrings, callback: (currentFeature: LineString, currentIndex: number) => void): void;
|
||||
featureEach(layer: Polygon | Polygons, callback: (currentFeature: Polygon, currentIndex: number) => void): void;
|
||||
featureEach(layer: MultiPoint | MultiPoints, callback: (currentFeature: MultiPoint, currentIndex: number) => void): void;
|
||||
featureEach(layer: MultiLineString | MultiLineStrings, callback: (currentFeature: MultiLineString, currentIndex: number) => void): void;
|
||||
featureEach(layer: MultiPolygon | MultiPolygons, callback: (currentFeature: MultiPolygon, currentIndex: number) => void): void;
|
||||
featureEach(layer: Feature | Features, callback: (currentFeature: Feature, currentIndex: number) => void): void;
|
||||
|
||||
/**
|
||||
* http://turfjs.org/docs/#coordall
|
||||
*/
|
||||
coordAll(layer: Feature | Features | GeometryCollection | GeometryObject): Array<Array<number>>
|
||||
|
||||
/**
|
||||
* http://turfjs.org/docs/#geomreduce
|
||||
*/
|
||||
geomReduce(layer: Point | Points, callback: (previousValue: any, currentGeometry: GeoJSON.Point, currentIndex: number) => void, initialValue: any): any;
|
||||
geomReduce(layer: LineString | LineStrings, callback: (previousValue: any, currentGeometry: GeoJSON.LineString, currentIndex: number) => void, initialValue: any): any;
|
||||
geomReduce(layer: Polygon | Polygons, callback: (previousValue: any, currentGeometry: GeoJSON.Polygon, currentIndex: number) => void, initialValue: any): any;
|
||||
geomReduce(layer: MultiPoint | MultiPoints, callback: (previousValue: any, currentGeometry: GeoJSON.MultiPoint, currentIndex: number) => void, initialValue: any): any;
|
||||
geomReduce(layer: MultiLineString | MultiLineStrings, callback: (previousValue: any, currentGeometry: GeoJSON.MultiLineString, currentIndex: number) => void, initialValue: any): any;
|
||||
geomReduce(layer: MultiPolygon | MultiPolygons, callback: (previousValue: any, currentGeometry: GeoJSON.MultiPolygon, currentIndex: number) => void, initialValue: any): any;
|
||||
geomReduce(layer: Feature | Features, callback: (previousValue: any, currentGeometry: GeometryObject, currentIndex: number) => void, initialValue: any): any;
|
||||
geomReduce(layer: GeometryCollection | GeometryObject, callback: (previousValue: any, currentGeometry: GeometryObject, currentIndex: number) => void, initialValue: any): any;
|
||||
|
||||
/**
|
||||
* http://turfjs.org/docs/#geomeach
|
||||
*/
|
||||
geomEach(layer: Point | Points, callback: (currentGeometry: GeoJSON.Point, currentIndex: number) => void): void;
|
||||
geomEach(layer: LineString | LineStrings, callback: (currentGeometry: GeoJSON.LineString, currentIndex: number) => void): void;
|
||||
geomEach(layer: Polygon | Polygons, callback: (currentGeometry: GeoJSON.Polygon, currentIndex: number) => void): void;
|
||||
geomEach(layer: MultiPoint | MultiPoints, callback: (currentGeometry: GeoJSON.MultiPoint, currentIndex: number) => void): void;
|
||||
geomEach(layer: MultiLineString | MultiLineStrings, callback: (currentGeometry: GeoJSON.MultiLineString, currentIndex: number) => void): void;
|
||||
geomEach(layer: MultiPolygon | MultiPolygons, callback: (currentGeometry: GeoJSON.MultiPolygon, currentIndex: number) => void): void;
|
||||
geomEach(layer: Feature | Features, callback: (currentGeometry: GeometryObject, currentIndex: number) => void): void;
|
||||
geomEach(layer: GeometryCollection | GeometryObject, callback: (currentGeometry: GeometryObject, currentIndex: number) => void): void;
|
||||
}
|
||||
|
||||
declare const meta: MetaStatic
|
||||
export = meta
|
||||
650
immoweb/node_modules/@turf/meta/index.js
generated
vendored
Normal file
650
immoweb/node_modules/@turf/meta/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,650 @@
|
|||
/**
|
||||
* Callback for coordEach
|
||||
*
|
||||
* @private
|
||||
* @callback coordEachCallback
|
||||
* @param {[number, number]} currentCoords The current coordinates being processed.
|
||||
* @param {number} currentIndex The index of the current element being processed in the
|
||||
* array.Starts at index 0, if an initialValue is provided, and at index 1 otherwise.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Iterate over coordinates in any GeoJSON object, similar to Array.forEach()
|
||||
*
|
||||
* @name coordEach
|
||||
* @param {Object} layer any GeoJSON object
|
||||
* @param {Function} callback a method that takes (currentCoords, currentIndex)
|
||||
* @param {boolean} [excludeWrapCoord=false] whether or not to include
|
||||
* the final coordinate of LinearRings that wraps the ring in its iteration.
|
||||
* @example
|
||||
* var features = {
|
||||
* "type": "FeatureCollection",
|
||||
* "features": [
|
||||
* {
|
||||
* "type": "Feature",
|
||||
* "properties": {},
|
||||
* "geometry": {
|
||||
* "type": "Point",
|
||||
* "coordinates": [26, 37]
|
||||
* }
|
||||
* },
|
||||
* {
|
||||
* "type": "Feature",
|
||||
* "properties": {},
|
||||
* "geometry": {
|
||||
* "type": "Point",
|
||||
* "coordinates": [36, 53]
|
||||
* }
|
||||
* }
|
||||
* ]
|
||||
* };
|
||||
* turf.coordEach(features, function (currentCoords, currentIndex) {
|
||||
* //=currentCoords
|
||||
* //=currentIndex
|
||||
* });
|
||||
*/
|
||||
function coordEach(layer, callback, excludeWrapCoord) {
|
||||
var i, j, k, g, l, geometry, stopG, coords,
|
||||
geometryMaybeCollection,
|
||||
wrapShrink = 0,
|
||||
currentIndex = 0,
|
||||
isGeometryCollection,
|
||||
isFeatureCollection = layer.type === 'FeatureCollection',
|
||||
isFeature = layer.type === 'Feature',
|
||||
stop = isFeatureCollection ? layer.features.length : 1;
|
||||
|
||||
// This logic may look a little weird. The reason why it is that way
|
||||
// is because it's trying to be fast. GeoJSON supports multiple kinds
|
||||
// of objects at its root: FeatureCollection, Features, Geometries.
|
||||
// This function has the responsibility of handling all of them, and that
|
||||
// means that some of the `for` loops you see below actually just don't apply
|
||||
// to certain inputs. For instance, if you give this just a
|
||||
// Point geometry, then both loops are short-circuited and all we do
|
||||
// is gradually rename the input until it's called 'geometry'.
|
||||
//
|
||||
// This also aims to allocate as few resources as possible: just a
|
||||
// few numbers and booleans, rather than any temporary arrays as would
|
||||
// be required with the normalization approach.
|
||||
for (i = 0; i < stop; i++) {
|
||||
|
||||
geometryMaybeCollection = (isFeatureCollection ? layer.features[i].geometry :
|
||||
(isFeature ? layer.geometry : layer));
|
||||
isGeometryCollection = geometryMaybeCollection.type === 'GeometryCollection';
|
||||
stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;
|
||||
|
||||
for (g = 0; g < stopG; g++) {
|
||||
geometry = isGeometryCollection ?
|
||||
geometryMaybeCollection.geometries[g] : geometryMaybeCollection;
|
||||
coords = geometry.coordinates;
|
||||
|
||||
wrapShrink = (excludeWrapCoord &&
|
||||
(geometry.type === 'Polygon' || geometry.type === 'MultiPolygon')) ?
|
||||
1 : 0;
|
||||
|
||||
if (geometry.type === 'Point') {
|
||||
callback(coords, currentIndex);
|
||||
currentIndex++;
|
||||
} else if (geometry.type === 'LineString' || geometry.type === 'MultiPoint') {
|
||||
for (j = 0; j < coords.length; j++) {
|
||||
callback(coords[j], currentIndex);
|
||||
currentIndex++;
|
||||
}
|
||||
} else if (geometry.type === 'Polygon' || geometry.type === 'MultiLineString') {
|
||||
for (j = 0; j < coords.length; j++)
|
||||
for (k = 0; k < coords[j].length - wrapShrink; k++) {
|
||||
callback(coords[j][k], currentIndex);
|
||||
currentIndex++;
|
||||
}
|
||||
} else if (geometry.type === 'MultiPolygon') {
|
||||
for (j = 0; j < coords.length; j++)
|
||||
for (k = 0; k < coords[j].length; k++)
|
||||
for (l = 0; l < coords[j][k].length - wrapShrink; l++) {
|
||||
callback(coords[j][k][l], currentIndex);
|
||||
currentIndex++;
|
||||
}
|
||||
} else if (geometry.type === 'GeometryCollection') {
|
||||
for (j = 0; j < geometry.geometries.length; j++)
|
||||
coordEach(geometry.geometries[j], callback, excludeWrapCoord);
|
||||
} else {
|
||||
throw new Error('Unknown Geometry Type');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
module.exports.coordEach = coordEach;
|
||||
|
||||
/**
|
||||
* Callback for coordReduce
|
||||
*
|
||||
* The first time the callback function is called, the values provided as arguments depend
|
||||
* on whether the reduce method has an initialValue argument.
|
||||
*
|
||||
* If an initialValue is provided to the reduce method:
|
||||
* - The previousValue argument is initialValue.
|
||||
* - The currentValue argument is the value of the first element present in the array.
|
||||
*
|
||||
* If an initialValue is not provided:
|
||||
* - The previousValue argument is the value of the first element present in the array.
|
||||
* - The currentValue argument is the value of the second element present in the array.
|
||||
*
|
||||
* @private
|
||||
* @callback coordReduceCallback
|
||||
* @param {*} previousValue The accumulated value previously returned in the last invocation
|
||||
* of the callback, or initialValue, if supplied.
|
||||
* @param {[number, number]} currentCoords The current coordinate being processed.
|
||||
* @param {number} currentIndex The index of the current element being processed in the
|
||||
* array.Starts at index 0, if an initialValue is provided, and at index 1 otherwise.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Reduce coordinates in any GeoJSON object, similar to Array.reduce()
|
||||
*
|
||||
* @name coordReduce
|
||||
* @param {Object} layer any GeoJSON object
|
||||
* @param {Function} callback a method that takes (previousValue, currentCoords, currentIndex)
|
||||
* @param {*} [initialValue] Value to use as the first argument to the first call of the callback.
|
||||
* @param {boolean} [excludeWrapCoord=false] whether or not to include
|
||||
* the final coordinate of LinearRings that wraps the ring in its iteration.
|
||||
* @returns {*} The value that results from the reduction.
|
||||
* @example
|
||||
* var features = {
|
||||
* "type": "FeatureCollection",
|
||||
* "features": [
|
||||
* {
|
||||
* "type": "Feature",
|
||||
* "properties": {},
|
||||
* "geometry": {
|
||||
* "type": "Point",
|
||||
* "coordinates": [26, 37]
|
||||
* }
|
||||
* },
|
||||
* {
|
||||
* "type": "Feature",
|
||||
* "properties": {},
|
||||
* "geometry": {
|
||||
* "type": "Point",
|
||||
* "coordinates": [36, 53]
|
||||
* }
|
||||
* }
|
||||
* ]
|
||||
* };
|
||||
* turf.coordReduce(features, function (previousValue, currentCoords, currentIndex) {
|
||||
* //=previousValue
|
||||
* //=currentCoords
|
||||
* //=currentIndex
|
||||
* return currentCoords;
|
||||
* });
|
||||
*/
|
||||
function coordReduce(layer, callback, initialValue, excludeWrapCoord) {
|
||||
var previousValue = initialValue;
|
||||
coordEach(layer, function (currentCoords, currentIndex) {
|
||||
if (currentIndex === 0 && initialValue === undefined) {
|
||||
previousValue = currentCoords;
|
||||
} else {
|
||||
previousValue = callback(previousValue, currentCoords, currentIndex);
|
||||
}
|
||||
}, excludeWrapCoord);
|
||||
return previousValue;
|
||||
}
|
||||
module.exports.coordReduce = coordReduce;
|
||||
|
||||
/**
|
||||
* Callback for propEach
|
||||
*
|
||||
* @private
|
||||
* @callback propEachCallback
|
||||
* @param {*} currentProperties The current properties being processed.
|
||||
* @param {number} currentIndex The index of the current element being processed in the
|
||||
* array.Starts at index 0, if an initialValue is provided, and at index 1 otherwise.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Iterate over properties in any GeoJSON object, similar to Array.forEach()
|
||||
*
|
||||
* @name propEach
|
||||
* @param {Object} layer any GeoJSON object
|
||||
* @param {Function} callback a method that takes (currentProperties, currentIndex)
|
||||
* @example
|
||||
* var features = {
|
||||
* "type": "FeatureCollection",
|
||||
* "features": [
|
||||
* {
|
||||
* "type": "Feature",
|
||||
* "properties": {"foo": "bar"},
|
||||
* "geometry": {
|
||||
* "type": "Point",
|
||||
* "coordinates": [26, 37]
|
||||
* }
|
||||
* },
|
||||
* {
|
||||
* "type": "Feature",
|
||||
* "properties": {"hello": "world"},
|
||||
* "geometry": {
|
||||
* "type": "Point",
|
||||
* "coordinates": [36, 53]
|
||||
* }
|
||||
* }
|
||||
* ]
|
||||
* };
|
||||
* turf.propEach(features, function (currentProperties, currentIndex) {
|
||||
* //=currentProperties
|
||||
* //=currentIndex
|
||||
* });
|
||||
*/
|
||||
function propEach(layer, callback) {
|
||||
var i;
|
||||
switch (layer.type) {
|
||||
case 'FeatureCollection':
|
||||
for (i = 0; i < layer.features.length; i++) {
|
||||
callback(layer.features[i].properties, i);
|
||||
}
|
||||
break;
|
||||
case 'Feature':
|
||||
callback(layer.properties, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
module.exports.propEach = propEach;
|
||||
|
||||
|
||||
/**
|
||||
* Callback for propReduce
|
||||
*
|
||||
* The first time the callback function is called, the values provided as arguments depend
|
||||
* on whether the reduce method has an initialValue argument.
|
||||
*
|
||||
* If an initialValue is provided to the reduce method:
|
||||
* - The previousValue argument is initialValue.
|
||||
* - The currentValue argument is the value of the first element present in the array.
|
||||
*
|
||||
* If an initialValue is not provided:
|
||||
* - The previousValue argument is the value of the first element present in the array.
|
||||
* - The currentValue argument is the value of the second element present in the array.
|
||||
*
|
||||
* @private
|
||||
* @callback propReduceCallback
|
||||
* @param {*} previousValue The accumulated value previously returned in the last invocation
|
||||
* of the callback, or initialValue, if supplied.
|
||||
* @param {*} currentProperties The current properties being processed.
|
||||
* @param {number} currentIndex The index of the current element being processed in the
|
||||
* array.Starts at index 0, if an initialValue is provided, and at index 1 otherwise.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Reduce properties in any GeoJSON object into a single value,
|
||||
* similar to how Array.reduce works. However, in this case we lazily run
|
||||
* the reduction, so an array of all properties is unnecessary.
|
||||
*
|
||||
* @name propReduce
|
||||
* @param {Object} layer any GeoJSON object
|
||||
* @param {Function} callback a method that takes (previousValue, currentProperties, currentIndex)
|
||||
* @param {*} [initialValue] Value to use as the first argument to the first call of the callback.
|
||||
* @returns {*} The value that results from the reduction.
|
||||
* @example
|
||||
* var features = {
|
||||
* "type": "FeatureCollection",
|
||||
* "features": [
|
||||
* {
|
||||
* "type": "Feature",
|
||||
* "properties": {"foo": "bar"},
|
||||
* "geometry": {
|
||||
* "type": "Point",
|
||||
* "coordinates": [26, 37]
|
||||
* }
|
||||
* },
|
||||
* {
|
||||
* "type": "Feature",
|
||||
* "properties": {"hello": "world"},
|
||||
* "geometry": {
|
||||
* "type": "Point",
|
||||
* "coordinates": [36, 53]
|
||||
* }
|
||||
* }
|
||||
* ]
|
||||
* };
|
||||
* turf.propReduce(features, function (previousValue, currentProperties, currentIndex) {
|
||||
* //=previousValue
|
||||
* //=currentProperties
|
||||
* //=currentIndex
|
||||
* return currentProperties
|
||||
* });
|
||||
*/
|
||||
function propReduce(layer, callback, initialValue) {
|
||||
var previousValue = initialValue;
|
||||
propEach(layer, function (currentProperties, currentIndex) {
|
||||
if (currentIndex === 0 && initialValue === undefined) {
|
||||
previousValue = currentProperties;
|
||||
} else {
|
||||
previousValue = callback(previousValue, currentProperties, currentIndex);
|
||||
}
|
||||
});
|
||||
return previousValue;
|
||||
}
|
||||
module.exports.propReduce = propReduce;
|
||||
|
||||
/**
|
||||
* Callback for featureEach
|
||||
*
|
||||
* @private
|
||||
* @callback featureEachCallback
|
||||
* @param {Feature<any>} currentFeature The current feature being processed.
|
||||
* @param {number} currentIndex The index of the current element being processed in the
|
||||
* array.Starts at index 0, if an initialValue is provided, and at index 1 otherwise.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Iterate over features in any GeoJSON object, similar to
|
||||
* Array.forEach.
|
||||
*
|
||||
* @name featureEach
|
||||
* @param {Object} layer any GeoJSON object
|
||||
* @param {Function} callback a method that takes (currentFeature, currentIndex)
|
||||
* @example
|
||||
* var features = {
|
||||
* "type": "FeatureCollection",
|
||||
* "features": [
|
||||
* {
|
||||
* "type": "Feature",
|
||||
* "properties": {},
|
||||
* "geometry": {
|
||||
* "type": "Point",
|
||||
* "coordinates": [26, 37]
|
||||
* }
|
||||
* },
|
||||
* {
|
||||
* "type": "Feature",
|
||||
* "properties": {},
|
||||
* "geometry": {
|
||||
* "type": "Point",
|
||||
* "coordinates": [36, 53]
|
||||
* }
|
||||
* }
|
||||
* ]
|
||||
* };
|
||||
* turf.featureEach(features, function (currentFeature, currentIndex) {
|
||||
* //=currentFeature
|
||||
* //=currentIndex
|
||||
* });
|
||||
*/
|
||||
function featureEach(layer, callback) {
|
||||
if (layer.type === 'Feature') {
|
||||
callback(layer, 0);
|
||||
} else if (layer.type === 'FeatureCollection') {
|
||||
for (var i = 0; i < layer.features.length; i++) {
|
||||
callback(layer.features[i], i);
|
||||
}
|
||||
}
|
||||
}
|
||||
module.exports.featureEach = featureEach;
|
||||
|
||||
/**
|
||||
* Callback for featureReduce
|
||||
*
|
||||
* The first time the callback function is called, the values provided as arguments depend
|
||||
* on whether the reduce method has an initialValue argument.
|
||||
*
|
||||
* If an initialValue is provided to the reduce method:
|
||||
* - The previousValue argument is initialValue.
|
||||
* - The currentValue argument is the value of the first element present in the array.
|
||||
*
|
||||
* If an initialValue is not provided:
|
||||
* - The previousValue argument is the value of the first element present in the array.
|
||||
* - The currentValue argument is the value of the second element present in the array.
|
||||
*
|
||||
* @private
|
||||
* @callback featureReduceCallback
|
||||
* @param {*} previousValue The accumulated value previously returned in the last invocation
|
||||
* of the callback, or initialValue, if supplied.
|
||||
* @param {Feature<any>} currentFeature The current Feature being processed.
|
||||
* @param {number} currentIndex The index of the current element being processed in the
|
||||
* array.Starts at index 0, if an initialValue is provided, and at index 1 otherwise.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Reduce features in any GeoJSON object, similar to Array.reduce().
|
||||
*
|
||||
* @name featureReduce
|
||||
* @param {Object} layer any GeoJSON object
|
||||
* @param {Function} callback a method that takes (previousValue, currentFeature, currentIndex)
|
||||
* @param {*} [initialValue] Value to use as the first argument to the first call of the callback.
|
||||
* @returns {*} The value that results from the reduction.
|
||||
* @example
|
||||
* var features = {
|
||||
* "type": "FeatureCollection",
|
||||
* "features": [
|
||||
* {
|
||||
* "type": "Feature",
|
||||
* "properties": {"foo": "bar"},
|
||||
* "geometry": {
|
||||
* "type": "Point",
|
||||
* "coordinates": [26, 37]
|
||||
* }
|
||||
* },
|
||||
* {
|
||||
* "type": "Feature",
|
||||
* "properties": {"hello": "world"},
|
||||
* "geometry": {
|
||||
* "type": "Point",
|
||||
* "coordinates": [36, 53]
|
||||
* }
|
||||
* }
|
||||
* ]
|
||||
* };
|
||||
* turf.featureReduce(features, function (previousValue, currentFeature, currentIndex) {
|
||||
* //=previousValue
|
||||
* //=currentFeature
|
||||
* //=currentIndex
|
||||
* return currentFeature
|
||||
* });
|
||||
*/
|
||||
function featureReduce(layer, callback, initialValue) {
|
||||
var previousValue = initialValue;
|
||||
featureEach(layer, function (currentFeature, currentIndex) {
|
||||
if (currentIndex === 0 && initialValue === undefined) {
|
||||
previousValue = currentFeature;
|
||||
} else {
|
||||
previousValue = callback(previousValue, currentFeature, currentIndex);
|
||||
}
|
||||
});
|
||||
return previousValue;
|
||||
}
|
||||
module.exports.featureReduce = featureReduce;
|
||||
|
||||
/**
|
||||
* Get all coordinates from any GeoJSON object.
|
||||
*
|
||||
* @name coordAll
|
||||
* @param {Object} layer any GeoJSON object
|
||||
* @returns {Array<Array<number>>} coordinate position array
|
||||
* @example
|
||||
* var features = {
|
||||
* "type": "FeatureCollection",
|
||||
* "features": [
|
||||
* {
|
||||
* "type": "Feature",
|
||||
* "properties": {},
|
||||
* "geometry": {
|
||||
* "type": "Point",
|
||||
* "coordinates": [26, 37]
|
||||
* }
|
||||
* },
|
||||
* {
|
||||
* "type": "Feature",
|
||||
* "properties": {},
|
||||
* "geometry": {
|
||||
* "type": "Point",
|
||||
* "coordinates": [36, 53]
|
||||
* }
|
||||
* }
|
||||
* ]
|
||||
* };
|
||||
* var coords = turf.coordAll(features);
|
||||
* //=coords
|
||||
*/
|
||||
function coordAll(layer) {
|
||||
var coords = [];
|
||||
coordEach(layer, function (coord) {
|
||||
coords.push(coord);
|
||||
});
|
||||
return coords;
|
||||
}
|
||||
module.exports.coordAll = coordAll;
|
||||
|
||||
/**
|
||||
* Iterate over each geometry in any GeoJSON object, similar to Array.forEach()
|
||||
*
|
||||
* @name geomEach
|
||||
* @param {Object} layer any GeoJSON object
|
||||
* @param {Function} callback a method that takes (currentGeometry, currentIndex)
|
||||
* @example
|
||||
* var features = {
|
||||
* "type": "FeatureCollection",
|
||||
* "features": [
|
||||
* {
|
||||
* "type": "Feature",
|
||||
* "properties": {},
|
||||
* "geometry": {
|
||||
* "type": "Point",
|
||||
* "coordinates": [26, 37]
|
||||
* }
|
||||
* },
|
||||
* {
|
||||
* "type": "Feature",
|
||||
* "properties": {},
|
||||
* "geometry": {
|
||||
* "type": "Point",
|
||||
* "coordinates": [36, 53]
|
||||
* }
|
||||
* }
|
||||
* ]
|
||||
* };
|
||||
* turf.geomEach(features, function (currentGeometry, currentIndex) {
|
||||
* //=currentGeometry
|
||||
* //=currentIndex
|
||||
* });
|
||||
*/
|
||||
function geomEach(layer, callback) {
|
||||
var i, j, g, geometry, stopG,
|
||||
geometryMaybeCollection,
|
||||
isGeometryCollection,
|
||||
currentIndex = 0,
|
||||
isFeatureCollection = layer.type === 'FeatureCollection',
|
||||
isFeature = layer.type === 'Feature',
|
||||
stop = isFeatureCollection ? layer.features.length : 1;
|
||||
|
||||
// This logic may look a little weird. The reason why it is that way
|
||||
// is because it's trying to be fast. GeoJSON supports multiple kinds
|
||||
// of objects at its root: FeatureCollection, Features, Geometries.
|
||||
// This function has the responsibility of handling all of them, and that
|
||||
// means that some of the `for` loops you see below actually just don't apply
|
||||
// to certain inputs. For instance, if you give this just a
|
||||
// Point geometry, then both loops are short-circuited and all we do
|
||||
// is gradually rename the input until it's called 'geometry'.
|
||||
//
|
||||
// This also aims to allocate as few resources as possible: just a
|
||||
// few numbers and booleans, rather than any temporary arrays as would
|
||||
// be required with the normalization approach.
|
||||
for (i = 0; i < stop; i++) {
|
||||
|
||||
geometryMaybeCollection = (isFeatureCollection ? layer.features[i].geometry :
|
||||
(isFeature ? layer.geometry : layer));
|
||||
isGeometryCollection = geometryMaybeCollection.type === 'GeometryCollection';
|
||||
stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;
|
||||
|
||||
for (g = 0; g < stopG; g++) {
|
||||
geometry = isGeometryCollection ?
|
||||
geometryMaybeCollection.geometries[g] : geometryMaybeCollection;
|
||||
|
||||
if (geometry.type === 'Point' ||
|
||||
geometry.type === 'LineString' ||
|
||||
geometry.type === 'MultiPoint' ||
|
||||
geometry.type === 'Polygon' ||
|
||||
geometry.type === 'MultiLineString' ||
|
||||
geometry.type === 'MultiPolygon') {
|
||||
callback(geometry, currentIndex);
|
||||
currentIndex++;
|
||||
} else if (geometry.type === 'GeometryCollection') {
|
||||
for (j = 0; j < geometry.geometries.length; j++) {
|
||||
callback(geometry.geometries[j], currentIndex);
|
||||
currentIndex++;
|
||||
}
|
||||
} else {
|
||||
throw new Error('Unknown Geometry Type');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
module.exports.geomEach = geomEach;
|
||||
|
||||
/**
|
||||
* Callback for geomReduce
|
||||
*
|
||||
* The first time the callback function is called, the values provided as arguments depend
|
||||
* on whether the reduce method has an initialValue argument.
|
||||
*
|
||||
* If an initialValue is provided to the reduce method:
|
||||
* - The previousValue argument is initialValue.
|
||||
* - The currentValue argument is the value of the first element present in the array.
|
||||
*
|
||||
* If an initialValue is not provided:
|
||||
* - The previousValue argument is the value of the first element present in the array.
|
||||
* - The currentValue argument is the value of the second element present in the array.
|
||||
*
|
||||
* @private
|
||||
* @callback geomReduceCallback
|
||||
* @param {*} previousValue The accumulated value previously returned in the last invocation
|
||||
* of the callback, or initialValue, if supplied.
|
||||
* @param {*} currentGeometry The current Feature being processed.
|
||||
* @param {number} currentIndex The index of the current element being processed in the
|
||||
* array.Starts at index 0, if an initialValue is provided, and at index 1 otherwise.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Reduce geometry in any GeoJSON object, similar to Array.reduce().
|
||||
*
|
||||
* @name geomReduce
|
||||
* @param {Object} layer any GeoJSON object
|
||||
* @param {Function} callback a method that takes (previousValue, currentGeometry, currentIndex)
|
||||
* @param {*} [initialValue] Value to use as the first argument to the first call of the callback.
|
||||
* @returns {*} The value that results from the reduction.
|
||||
* @example
|
||||
* var features = {
|
||||
* "type": "FeatureCollection",
|
||||
* "features": [
|
||||
* {
|
||||
* "type": "Feature",
|
||||
* "properties": {"foo": "bar"},
|
||||
* "geometry": {
|
||||
* "type": "Point",
|
||||
* "coordinates": [26, 37]
|
||||
* }
|
||||
* },
|
||||
* {
|
||||
* "type": "Feature",
|
||||
* "properties": {"hello": "world"},
|
||||
* "geometry": {
|
||||
* "type": "Point",
|
||||
* "coordinates": [36, 53]
|
||||
* }
|
||||
* }
|
||||
* ]
|
||||
* };
|
||||
* turf.geomReduce(features, function (previousValue, currentGeometry, currentIndex) {
|
||||
* //=previousValue
|
||||
* //=currentGeometry
|
||||
* //=currentIndex
|
||||
* return currentGeometry
|
||||
* });
|
||||
*/
|
||||
function geomReduce(layer, callback, initialValue) {
|
||||
var previousValue = initialValue;
|
||||
geomEach(layer, function (currentGeometry, currentIndex) {
|
||||
if (currentIndex === 0 && initialValue === undefined) {
|
||||
previousValue = currentGeometry;
|
||||
} else {
|
||||
previousValue = callback(previousValue, currentGeometry, currentIndex);
|
||||
}
|
||||
});
|
||||
return previousValue;
|
||||
}
|
||||
module.exports.geomReduce = geomReduce;
|
||||
67
immoweb/node_modules/@turf/meta/package.json
generated
vendored
Normal file
67
immoweb/node_modules/@turf/meta/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
{
|
||||
"_from": "@turf/meta@^3.14.0",
|
||||
"_id": "@turf/meta@3.14.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-jTBQwaD0S/QGpjO2vSjFEPe87ic=",
|
||||
"_location": "/@turf/meta",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "@turf/meta@^3.14.0",
|
||||
"name": "@turf/meta",
|
||||
"escapedName": "@turf%2fmeta",
|
||||
"scope": "@turf",
|
||||
"rawSpec": "^3.14.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^3.14.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@turf/bbox"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@turf/meta/-/meta-3.14.0.tgz",
|
||||
"_shasum": "8d3050c1a0f44bf406a633b6bd28c510f7bcee27",
|
||||
"_spec": "@turf/meta@^3.14.0",
|
||||
"_where": "/home/kadir/workspace/webimmo/node_modules/@turf/bbox",
|
||||
"author": {
|
||||
"name": "Turf Authors"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/Turfjs/turf/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {},
|
||||
"deprecated": false,
|
||||
"description": "turf meta module",
|
||||
"devDependencies": {
|
||||
"@turf/helpers": "^3.13.0",
|
||||
"@turf/random": "^3.14.0",
|
||||
"benchmark": "^2.1.3",
|
||||
"eslint": "^3.14.1",
|
||||
"eslint-config-mourner": "^2.0.1",
|
||||
"tape": "^3.4.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"homepage": "https://github.com/Turfjs/turf",
|
||||
"keywords": [
|
||||
"functional",
|
||||
"programming",
|
||||
"turfjs"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "@turf/meta",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/Turfjs/turf.git"
|
||||
},
|
||||
"scripts": {
|
||||
"bench": "node bench.js",
|
||||
"test": "node test.js"
|
||||
},
|
||||
"types": "index.d.ts",
|
||||
"version": "3.14.0"
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue