A django project to retrieve information of a point.
View a running instance at http://geocontext.kartoza.com
The latest source code is available at https://github.com/kartoza/geocontext.
- Stateless and easy to deploy
- Able to retrieve geo-context information of a point from several services
- Optimized for rapid information retrieval
- Currently supports WFS, WMS, ArcREST and Placename sources
- Using cache mechanism to retrieve context frequently requested information
- Three level hierarchy (service --> group --> collection) to sort services to request
- Simple API returning json data
After you have working geocontext instance, you can then check the available API from the API documentation links (you can find it in the main page) or see the content and the hierarchy of context service (you can also find the link in the main page)
New query endpoint accepting GET keyword parameters: /api/v2/query?
Keyword | Description | Details |
---|---|---|
registry |
service , group or collection |
REQUIRED |
key |
Unique key of the registry | REQUIRED |
x |
Longitude in DD, DMS or DD | REQUIRED |
y |
Latitude in DD, DMS or DD | REQUIRED |
srid |
Coordinate reference | OPTIONAL (Default 4326) |
tolerance |
Query tolerance in m | OPTIONAL (Default 10m) |
outformat |
Output format (geojson / json) | OPTIONAL (Default geojson) |
For deployment we use docker so you need to have docker running on the host. GeoContext is a django app so it will help if you have some knowledge of running a django site.
- Clone the project
git clone git://github.com/kartoza/geocontext.git && cd /docs/
- Ensure shared volume permissions are set
make permissions
-
Copy the
sample.env
file as.env
and change the values inside if necessary. -
Copy
docker-compose.override.sample.yml
asdocker-compose.override.yml
and change the values inside if necessary. -
Setup and run the web service: available on
http://localhost/
make setup-web
- If needed, create a superuser for Django admin access on
http://localhost/admin/
- here you can manually modify data
make superuser
Loading Data GeoContext use a json file to populate the context service and its group and collection. Everything is stored in geocontext.json. You can load it by running this command:
make import-data
Or if you have your own json file, you can load it with:
make import-data FILE_URI=path/to/your/json/file
Be careful, it will replace your context service data (and its
hierarchy) with your new one from the json file. But no worries, when your
run this import-data
command, it will export your context service
data to a new json file.
You can also export your context service to json file by running:
make data-export
An easy way to set up a locally development environment is with Docker and VSCode.
- Optional: add any ENV variables needed to for uwsgi & dvweb to
/deployment/.env
- Use setup-dev to build the production and development containers, create superuser, and import default services.
make setup-dev
- Geocontext should now be running at localhost.
- DB can be accessed at port 'localhost:25432', user&password='docker', database=gis
- Attach a VSCode session by right clicking on the running geocontext_devweb container in the VSCode remote - Containers extension
- Now we can get into the running containers to run management commands, run another server at another port, debug etc.
- In the geocontext_devweb container terminal you can run a test server for debugging as follows:
python manage.py runserver 8001
- Pytest is used for testing. Unit & integration tests, flake8 linting, coverage and documentation can be run with:
make test-full
- See README-legacy for PyCharm and SSH access to devweb container.
- Config git repo/branch and dockerhub/image:tag to use for deploy in top of Makefile
- Run make command to build and push image
make deploy
- Note the UWSGI image must be available (setup-dev / setup-web)
We work under the philosophy that stakeholders should have access to the development and source code, and be able to participate in every level of the project - we invite comments, suggestions and contributions. See our milestones list and our open issues list for known bugs and outstanding tasks.
GeoContext was funded by JRS and developed by Kartoza.com, Freshwater Research Center and individual contributors.
GeoContext is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3 (GPLv3) as published by the Free Software Foundation.
The full GNU General Public License is available in LICENSE.txt or http://www.gnu.org/licenses/gpl.html
There is no warranty for the program, to the extent permitted by applicable law. Except when otherwise stated in writing the copyright holders and/or other parties provide the program "as is" without warranty of any kind, either expressed or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. The entire risk as to the quality and performance of the program is with you. Should the program prove defective, you assume the cost of all necessary servicing, repair or correction.
Thank you to the individual contributors who have helped to build GeoContext:
- Tim Sutton (@timlinux) : tim@kartoza.com
- Ismail Sunni (@ismailsunni)
- Dimas Tri Ciputra (@dimasciput) : dimas@kartoza.com
- Andre Theron (@andretheronsa) : andre.theron@kartoza.com
- Rizky Maulana Nugraha (@lucernae) : lana.pcfre@gmail.com)