Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

geojson

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

geojson - npm Package Compare versions

Comparing version 0.0.6 to 0.0.7

17

geojson.js

@@ -1,2 +0,2 @@

exports.version = '0.0.6';
exports.version = '0.0.7';

@@ -15,2 +15,3 @@ exports.defaults = {};

addOptionals(geojson, settings);
return geojson;

@@ -35,2 +36,16 @@ };

function addOptionals(geojson, settings){
if(settings.crs) {
geojson.crs = {
type: "name",
properties: {
name: settings.crs
}
};
}
if (settings.bbox) {
geojson.bbox = settings.bbox;
}
}
function setGeom(params) {

@@ -37,0 +52,0 @@ params.geom = {};

2

package.json

@@ -5,3 +5,3 @@ {

"author": "Casey Thomas <c@cpt.ph>",
"version": "0.0.6",
"version": "0.0.7",
"main": "./geojson",

@@ -8,0 +8,0 @@ "repository": {

@@ -7,4 +7,8 @@ # geojson.js

For node, use npm:
npm install geojson
Client-side version is coming soon.
## Getting Started

@@ -244,2 +248,14 @@

The valid geometry types are `Point`, `MultiPoint`, `LineString`, `MultiLineString`, `Polygon`, and `MultiPolygon`.
The valid geometry types are
- `Point`
- `MultiPoint`
- `LineString`
- `MultiLineString`
- `Polygon`
- `MultiPolygon`
geojson.js also supports the optional GeoJSON properties `bbox` and `crs`.
- `crs` - A string identifying a coordinate reference system. Only named CRSs are supported at the moment. [More information](http://geojson.org/geojson-spec.html#named-crs)
- `bbox` - A bounding box for the feature collection. An array with the following format: `[y1, x1, y2, x2]`. [More information](http://geojson.org/geojson-spec.html#bounding-boxes)

@@ -150,3 +150,4 @@ var GeoJSON = require('./geojson');

Point: ['lat', 'lng'],
include: ['name']
include: ['name'],
crs: 'urn:ogc:def:crs:EPSG::4326'
};

@@ -156,2 +157,3 @@

assert.equal(output.crs.properties.name, 'urn:ogc:def:crs:EPSG::4326', "crs.properties.name matches input value for crs");
output.features.forEach(function(feature){

@@ -168,2 +170,3 @@ assert.notEqual(feature.properties.name, undefined, "Properties should have name attribute");

assert.equal(output.crs.properties.name, 'urn:ogc:def:crs:EPSG::4326', "crs.properties.name matches input value for crs");
output.features.forEach(function(feature){

@@ -179,2 +182,3 @@ assert.equal(feature.properties.name, undefined, "Properties shouldn't have name attribute");

assert.equal(output.crs.properties.name, 'urn:ogc:def:crs:EPSG::4326', "crs.properties.name matches input value for crs");
output.features.forEach(function(feature){

@@ -190,3 +194,16 @@ assert.notEqual(feature.properties.name, undefined, "Properties should have name attribute");

it("it should add 'bbox' and/or 'crs' to the output if either is specified in the parameters", function(){
var output = GeoJSON.parse(data, {
Point: ['lat', 'lng'],
bbox: [100.0, 0.0, 105.0, 1.0],
crs: 'urn:ogc:def:crs:EPSG::4326'});
assert.equal(output.crs.properties.name, 'urn:ogc:def:crs:EPSG::4326', "crs.properties.name matches input value for crs");
assert.equal(output.bbox[0], 100.0, "bbox matches input value for bbox");
assert.equal(output.bbox[1], 0.0, "bbox matches input value for bbox");
assert.equal(output.bbox[2], 105.0, "bbox matches input value for bbox");
assert.equal(output.bbox[3], 1.0, "bbox matches input value for bbox");
});
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc