Skip to content

🌍📍RESTful API for querying HERE polygon boundary data in GeoJSON format.

License

Notifications You must be signed in to change notification settings

dbabbs/query-geojson-polygons

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Query Polygon Boundaries

This RESTful API enables one to query HERE map content, specifically admin level polygon data in GeoJSON format. This API wraps responses from the HERE Geocoder API and converts the polygon shape data from WKT format to GeoJSON format.

This service is great for obtaining data to use with your favorite web map renderers like HERE XYZ, Tangram, Leaflet, deck.gl, Google Maps, and Mapbox.

Prerequisites

A valid App Id and App Code from the HERE Developer Portal is required. The free tier allows for up to 250K transactions/month.

Installation

git clone https://github.com/dbabbs/query-geojson-polygons.git
cd query-geojson-polygons
npm install

Running

npm start

Parameters

Parameter Required Accepted Values Description
here_id Yes A valid HERE Developer App Id
here_code Yes A valid HERE Developer App Code
admin_level No country, state, county, city, district, postalCode The desired admin level of the polygon data. For example, if you would like city polygon data for Seattle, WA, use city. If admin_level is not passed, the API will return the admin level data for the top result in the geocoder.
location Yes A location string The desired region / query. Examples: 98122, Seattle, WA, Hong Kong, Brazil, Virginia.
response_type No feature, geometry, feature_collection The desired GeoJSON object type. If the value is not provided, the API will return a feature.

Examples

Querying State of Washington feature

{LOCAL-SERVER}/query
?here_id={HERE-ID}
&here_code={HERE-CODE}
&location=Washington State
&response_type=feature

Querying City of San Francisco geometry

{LOCAL-SERVER}/query
?here_id={HERE-ID}
&here_code={HERE-CODE}
&location=San Francisco,CA
&response_type=geometry

Querying State of Louisiana with the city name of New Orleans

Since New Orleans is a city in the state of Louisiana, the API will return the polygon data for the state of New Orleans using using admin_level=state.

{LOCAL-SERVER}/query
?here_id={HERE-ID}
&here_code={HERE-CODE}
&location= New Orleans
&admin_level=state

Demo

This repository includes a demo of the API to be used with Leaflet. Instructions for running the demo:

Navigate to the demo directory

cd demo

Start a local server for the front end code.

python -m SimpleHTTPServer 8888

Navigate to localhost:8888 or to the port you configured.

Inside of index.js, be sure to insert your HERE Developer credentials into the hereCredentials object. These credentials authenticate the Map Tile API for Leaflet and the Polygon Query API.

const hereCredentials: {
   id: '',
   code: ''
}

Data Usage

When using data from this API, please comply with all terms listed on the HERE Developer Portal FAQ.

About

🌍📍RESTful API for querying HERE polygon boundary data in GeoJSON format.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published