Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
geojson-geometries
Advanced tools
Extract elementary geometries from a geojson inheriting properties.
⛏ Extract elementary geometries from a GeoJSON inheriting properties.
Coded with ❤️ by Simone Primarosa.
$ npm install --save geojson-geometries
const GeoJsonGeometries = require('geojson-geometries');
const geojson = {type: 'FeatureCollection',
features: [{
type: 'Feature',
geometry: {
type: 'Point',
coordinates: [102.0, 0.5]
},
properties: {prop0: 'value0'}
}, {
type: 'Feature',
geometry: {
type: 'LineString',
coordinates: [[102.0, 0.0], [103.0, 1.0], [104.0, 0.0], [105.0, 1.0]]
},
properties: {prop1: 'value1'}
}, {
type: 'Feature',
geometry: {
type: 'Polygon',
coordinates: [
[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]]
]
},
properties: {prop2: 'value2'}
}]
};
const extracted = new GeoJsonGeometries(geojson);
extracted.points
// => {
// type: "FeatureCollection",
// features: [{
// type: "Feature",
// geometry: {
// type: "Point",
// coordinates: [102, 0.5]
// },
// properties: {prop0: 'value0'}
// }]
// }
extracted.lines
// => {
// type: "FeatureCollection",
// features: [{
// type: "Feature",
// geometry: {
// type: "LineString",
// coordinates: [[[102.0, 0.0], [103.0, 1.0], [104.0, 0.0], [105.0, 1.0]]]
// },
// properties: {prop1: 'value1'}
// }]
// }
extracted.polygons
// => {
// type: "FeatureCollection",
// features: [{
// type: "Feature",
// geometry: {
// type: "Polygon",
// coordinates: [[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]]]
// },
// properties: {prop2: 'value2'}
// }]
// }
Create an instance of the geometries extractor.
Param | Type | Description |
---|---|---|
geoJson | Object | The GeoJSON from which extract the geometries. |
[options] | Object | Optional options. |
options.ignorePoints | boolean | If true the extractor will ignore geometries of type Point. |
options.ignoreLines | boolean | If true the extractor will ignore geometries of type LineString. |
options.ignorePolygon | boolean | If true the extractor will ignore geometries of type Polygon. |
Array.<Object>
Returns the list of geometries of type Point found in the GeoJSON.
Kind: instance property of GeoJsonGeometries
Returns: Array.<Object>
- A FeatureCollection of points with inherited properties if any.
Array.<Object>
Returns the list of geometries of type LineString found in the GeoJSON.
Kind: instance property of GeoJsonGeometries
Returns: Array.<Object>
- A FeatureCollection of lines with inherited properties if any.
Array.<Object>
Returns the list of geometries of type Polygon found in the GeoJSON.
Kind: instance property of GeoJsonGeometries
Returns: Array.<Object>
- A FeatureCollection of polygons with inherited properties if any.
See also the list of contributors who participated in this project.
This project is licensed under the MIT License - see the license file for details.
FAQs
Extract elementary geometries from a geojson inheriting properties.
The npm package geojson-geometries receives a total of 1,998 weekly downloads. As such, geojson-geometries popularity was classified as popular.
We found that geojson-geometries demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.