geojson-parser-js
v1.0.13
Published
A node.js/typescript library to generate and validate geojson string or parse geometries from the geojson file
Downloads
494
Readme
geojson-parser-js
A Node.js module to generate a geojson or validate it. This module also let you easily parse geometries from geojson.
Installation
npm install geojson-parser-js --save
yarn add geojson-parser-js
bower install geojson-parser-js --save
Demo
You can use the demo at https://www.geojson.in/
Usage
TypeScript
import {Geojson} from 'geojson-parser-js';
var isValid = Geojson.isValid({ "type": "FeatureCollection", "features": [] });
Output should be 'true'
import {Geojson} from 'geojson-parser-js';
import { FeatureCollection, GeometryType, FeatureProperty, Coordinate, Geometry, Point, LineString, Polygon, PolygonWithHole, MultiPoint, MultiLineString, MultiPolygon } from 'geojson-parser-js/models/geojson';
let features:FeatureCollection = Geojson.parse('{ "type": "FeatureCollection", "features": [] }');
Output should be an instance of FeatureCollection class
import {Geojson} from 'geojson-parser-js';
import { FeatureCollection } from 'geojson-parser-js/models/geojson';
let geoJsonStr:string = Geojson.create(features);
Input should be an instance of FeatureCollection
Output should be an Geojson string
Javascript
var geojson = require('geojson-parser-js');
var isValid = geojson.isValid('{ "type": "FeatureCollection", "features": [] }');
Output should be 'true'
var geojson = require('geojson-parser-js');
var features = geojson.parse('{ "type": "FeatureCollection", "features": [] }');
Output should be an instance of FeatureCollection class
var geojson = require('geojson-parser-js');
var geojsonStr = geojson.create(features);
Input should be an instance of FeatureCollection
Output should be an Geojson string
AMD
define(function(require,exports,module){
var parser = require('geojson-parser-js');
});
Test
npm run test
Support
You can directly send any bug/issue or suggestion to my personal email id: [email protected].