geoposition-to-geojson

1.0.1 • Public • Published

geoposition-to-geojson

Turn an HTML5 Geoposition object into a GeoJSON Point.

Pairs well with geolocation-stream and mapbox.js.

See also geoposition-to-object.

Installation

npm install geoposition-to-geojson --save

Usage

var geojsonify = require('geoposition-to-geojson')

navigator.geolocation.getCurrentPosition(function(position) {
  console.log(geojsonify(position))
})

{
  type: "Feature",
  geometry: {
    type: "Point",
    coordinates: [-104.8483681, 38.792024999999995]
  },
  properties: {
    timestamp: "123",
    accuracy: 26,
    altitude: null,
    altitudeAccuracy: null,
    heading: null,
    speed: null
  }
}

Tests

npm install
npm test

Dependencies

None

Dev Dependencies

  • tap-spec: Formatted TAP output like Mocha's spec reporter
  • tape: tap-producing test harness for node and browsers

License

MIT

Generated by package-json-to-readme

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.1
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.1
    1
  • 1.0.0
    0

Package Sidebar

Install

npm i geoposition-to-geojson

Weekly Downloads

1

Version

1.0.1

License

MIT

Last publish

Collaborators

  • zeke