Skip to content

JavaScript library to transform HERE JSON objects to GeoJSON

License

Notifications You must be signed in to change notification settings

meggsimum/here-json2geojson

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HERE JSON to GeoJSON

JavaScript library to transform HERE JSON objects to GeoJSON.

Build Status dependencies Status devDependencies Status

At the moment only a subset of the JSON response types provided by the HERE REST APIs is supported. This will be extended from time to time.

Disclaimer

This is not an official HERE product!

Be sure to respect the HERE Service Terms when using their API.

Usage

To use this library in an HTML-web-application just include the JavaScript-file at dist/hj2gj.js into your HTML-page. Otherwise just import this library as module like in the snippet below:

import {readIsolines} from 'here-json2geojson';

var hereIsolineResponse = // The response of the HERE REST API call
var isolineFeatColl = readIsolines(hereIsolineResponse);

Build the library on your own

> npm install
> npm run dist

Afterwards the single-file-build of the library is available under dist/hj2gj.js

API

readRoute

Reads route-response object delivered by the HERE API and converts it to a GeoJSON FeatureCollection holding the route legs as line features.

Parameters

  • hereRouteResponse Object HERE JSON for a route

Returns Object GeoJSON FeatureCollection

readWeatherConditions

Reads HERE traffic weather conditions and transforms them to a GeoJSON FeatureCollection containing point features with weather info as attributes.

Parameters

  • weatherConditionsResponse Object HERE JSON for weather conditions

Returns Object GeoJSON FeatureCollection

readPlaces

Reads places-response object delivered by the HERE API and converts it to a GeoJSON FeatureCollection holding the places as point features.

Parameters

  • herePlacesResponse Object HERE JSON for a place

Returns Object GeoJSON FeatureCollection

readTrafficIncidents

Reads HERE traffic incidents and transforms them to a GeoJSON FeatureCollection containing point features.

Parameters

  • trafficIncidentsResponse Object HERE JSON for traffic incidents
  • addEndPoints Boolean Should possible end points of incident be added to the FeatureCollection

Returns Object GeoJSON FeatureCollection

readIsolines

Reads isolines-response object delivered by the HERE API and converts it to a GeoJSON FeatureCollection.

Parameters

  • hereIsolineResponse Object HERE JSON for isolines

Returns Object GeoJSON FeatureCollection

Credits

The initial development of this project has been sponsored by geomer GmbH from Heidelberg, Germany