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.
mongoose-geojson-schema
Advanced tools
Schema definitions for GeoJSON types for use with Mongoose JS, a mongodb object model.
The GeoJSON Schema specifies geospatial data types for use in JSON-based projects. This package aims to make those data types available to those wanting to employ them in a mongoose schema, with validation following the strict guidelines available on the GeoJSON website. The following data types are available:
and the following super types:
Following the GeoJSON spec, we assume a default coordinate reference system (CRS) of the WGS84 datum. That is, coordinates are validated to represent longitude and latitude units of decimal degrees.
If you wish to disable this validation, set the crs
property to a null
or alternate
value following the GeoJSON spec for Coordinate Reference Sytems
First install node.js, mongodb and mongoose
$ npm install mongoose-geojson-schema --save
var GeoJSON = require('mongoose-geojson-schema');
var mongoose = require('mongoose');
var schema = new mongoose.Schema({
point: mongoose.Schema.Types.GeoJSON,
multipoint: mongoose.Schema.Types.GeoJSON,
linestring: mongoose.Schema.Types.GeoJSON,
multilinestring: mongoose.Schema.Types.GeoJSON,
polygon: mongoose.Schema.Types.GeoJSON,
multipolygon: mongoose.Schema.Types.GeoJSON,
geometry: mongoose.Schema.Types.GeoJSON,
geometrycollection: mongoose.Schema.Types.GeoJSON,
feature: mongoose.Schema.Types.GeoJSON,
featurecollection: mongoose.Schema.Types.GeoJSON
});
var db = mongoose.createConnection('localhost', 'test');
var model = db.model('GeoJSON', schema);
var test = new GeoJSON({
point: {
type: "Point",
coordinates: [12.123456, 13.134578]
},
...
polygon: {
type: "Polygon",
coordinates: [
[
[12.123456, 13.1345678],
[179.999999, -1.345],
[12.0002, -45.4663],
[12.123456, 13.1345678]
],
...
}
});
var GeoJSON = require('mongoose-geojson-schema');
var mongoose = require('mongoose');
var schema = new mongoose.Schema({
point: mongoose.Schema.Types.Point,
multipoint: mongoose.Schema.Types.MultiPoint,
linestring: mongoose.Schema.Types.LineString,
multilinestring: mongoose.Schema.Types.MultiLineString,
polygon: mongoose.Schema.Types.Polygon,
multipolygon: mongoose.Schema.Types.MultiPolygon,
geometry: mongoose.Schema.Types.Geometry,
geometrycollection: mongoose.Schema.Types.GeometryCollection,
feature: mongoose.Schema.Types.Feature,
featurecollection: mongoose.Schema.Types.FeatureCollection
});
var db = mongoose.createConnection('localhost', 'test');
var model = db.model('GeoJSON', schema);
var test = new GeoJSON({
point: {
type: "Point",
coordinates: [12.123456, 13.134578]
},
...
polygon: {
type: "Polygon",
coordinates: [
[
[12.123456, 13.1345678],
[179.999999, -1.345],
[12.0002, -45.4663],
[12.123456, 13.1345678]
],
...
}
});
var GeoJSON = require('mongoose-geojson-schema');
var mongoose = require('mongoose');
var schema = new mongoose.Schema({
geoFeature:GeoJSON.Feature
});
npm test
Ben Dalton, Mark Stosberg, Joshua Kopecek
Copyright (c) 2014-2016, RideAmigos. (MIT License)
See LICENSE for more info.
FAQs
Schema definitions for GeoJSON types for use with Mongoose JS
The npm package mongoose-geojson-schema receives a total of 2,258 weekly downloads. As such, mongoose-geojson-schema popularity was classified as popular.
We found that mongoose-geojson-schema demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers 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.