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"
}
- Install nodeJS, npm and git
- Clone the project:
git clone https://github.com/jfoclpf/geo-pt-api.git
- Enter the newly created directory and install dependencies
cd geo-pt-api && npm install
- Start the server
npm start --port=8080
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
.
npm install pm2@latest -g
pm2 start server.js -- --port 8080
DEBUG=http npm start --port=8080