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

@mapbox/geojson-normalize

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mapbox/geojson-normalize

normalize different geojson forms into featurecollections

  • 0.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is @mapbox/geojson-normalize?

@mapbox/geojson-normalize is a utility for normalizing various GeoJSON objects into a consistent format. It ensures that different types of GeoJSON inputs (like Feature, FeatureCollection, Geometry, etc.) are converted into a standard FeatureCollection format, making it easier to work with GeoJSON data.

What are @mapbox/geojson-normalize's main functionalities?

Normalize a single Feature

This feature allows you to normalize a single GeoJSON Feature into a FeatureCollection. The code sample demonstrates how to convert a single Feature into a FeatureCollection.

const normalize = require('@mapbox/geojson-normalize');
const feature = {
  type: 'Feature',
  geometry: {
    type: 'Point',
    coordinates: [102.0, 0.5]
  },
  properties: {
    prop0: 'value0'
  }
};
const normalized = normalize(feature);
console.log(JSON.stringify(normalized, null, 2));

Normalize a FeatureCollection

This feature allows you to normalize an already existing FeatureCollection. The code sample shows how to ensure that a FeatureCollection is in the correct format.

const normalize = require('@mapbox/geojson-normalize');
const featureCollection = {
  type: 'FeatureCollection',
  features: [
    {
      type: 'Feature',
      geometry: {
        type: 'Point',
        coordinates: [102.0, 0.5]
      },
      properties: {
        prop0: 'value0'
      }
    }
  ]
};
const normalized = normalize(featureCollection);
console.log(JSON.stringify(normalized, null, 2));

Normalize a Geometry

This feature allows you to normalize a GeoJSON Geometry object into a FeatureCollection. The code sample demonstrates how to convert a Geometry into a FeatureCollection.

const normalize = require('@mapbox/geojson-normalize');
const geometry = {
  type: 'Point',
  coordinates: [102.0, 0.5]
};
const normalized = normalize(geometry);
console.log(JSON.stringify(normalized, null, 2));

Other packages similar to @mapbox/geojson-normalize

Keywords

FAQs

Package last updated on 02 Dec 2016

Did you know?

Socket

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.

Install

Related posts

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