Skip to content

Latest commit

 

History

History
42 lines (30 loc) · 1.25 KB

README.md

File metadata and controls

42 lines (30 loc) · 1.25 KB

geo-pt-api

Detect official divisional administrative regions of Portugal ("Carta Administrativa Oficial de Portugal - CAOP 2020", from here), providing GPS coordinates as input. You can use the public API here.

It creates a HTTP server, whose GET request /?lat=40.153687&lon=-8.514602 returns a JSON

{
  "freguesia": "Anobra",
  "concelho": "Condeixa-A-Nova",
  "distrito":"Coimbra"
}

How to install the API on your machine

  1. Install nodeJS, npm and git
  2. Clone the project:
    git clone https://github.com/jfoclpf/geo-pt-api.git
  3. Enter the newly created directory and install dependencies
    cd geo-pt-api && npm install
  4. Start the server
    npm start --port=8080

Continuous operation

For permanent and continuous operation use for example pm2 or forever, using directly the node script located at the root directory

node server.js --port=8080.

With pm2

npm install pm2@latest -g
pm2 start server.js -- --port 8080

Debug

DEBUG=http npm start --port=8080