{"id":23143698,"url":"https://github.com/digitalinteraction/make-place-geography","last_synced_at":"2025-04-04T12:14:53.081Z","repository":{"id":146137729,"uuid":"378938931","full_name":"digitalinteraction/make-place-geography","owner":"digitalinteraction","description":null,"archived":false,"fork":false,"pushed_at":"2021-06-21T13:25:13.000Z","size":378,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-09T22:11:18.468Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/digitalinteraction.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-06-21T13:24:53.000Z","updated_at":"2024-11-08T12:31:59.000Z","dependencies_parsed_at":null,"dependency_job_id":"8eaefcdf-a86c-4613-aeb8-9a40f54aa5a4","html_url":"https://github.com/digitalinteraction/make-place-geography","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalinteraction%2Fmake-place-geography","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalinteraction%2Fmake-place-geography/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalinteraction%2Fmake-place-geography/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalinteraction%2Fmake-place-geography/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/digitalinteraction","download_url":"https://codeload.github.com/digitalinteraction/make-place-geography/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247174467,"owners_count":20896078,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-17T15:14:02.507Z","updated_at":"2025-04-04T12:14:53.075Z","avatar_url":"https://github.com/digitalinteraction.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Make Place Geography\n\nA restful JSON api for Make Place, responsible for the creation, storage and retrieval of geographical data. See `/docs` for usage.\n\n## Features\n\n* List geometries that you have access to with `GET: /geo`\n* Get a specific geometry with `GET: /geo/:id`\n* Create a geometry with `POST: /geo`\n* All requests are validated with an `api_key`\n\n## Data Structure\n\n* Geometries are stored under a `Deployment` and reference a `DataType`\n* A `Deployment` has `DataType` records to describe the type of data\n* A `Deployment` has `ApiKey` records which have different permissions\n\n## Permissions\n\nWhat you can do with the api is based on what `api_key` you pass.\nAll geo requests require a valid `api_key` to be passed in the query string.\nApi keys are sql records associated to a deployment with a specific permission, defined below.\n\n\u003e Keys must be created manually, add them to the `api_key` table.\n\n| Code    | Description |\n| ------- | ----------- |\n| `READ`  | You can **only** read from the deployment |\n| `WRITE` | You can **only** create data for the deployment |\n| `ALL`   | You can read **and** write on the deployment |\n\n## Sample Deployment\n\nBelow is an example of how to deploy this docker image using a docker-compose.\n\n**docker-compose.yml**\n\n```yml\nversion: '3'\n\nservices:\n  mysql:\n    image: mysql:5.7\n    environment:\n      MYSQL_ROOT_PASSWORD: secret\n      MYSQL_DATABASE: geography\n    ports:\n      - 3306:3306\n  geo:\n    image: openlab.ncl.ac.uk:4567/make-place/geo:1.1.1\n    links:\n      - mysql\n    environment:\n      SQL_URL: mysql://root:secret@mysql/geography\n    ports:\n      - 3000:3000\n```\n\nWith the above setup, run `docker-compose up -d` to start up your containers.\nYou then need to run the database migrations by executing `db_init.sql` inside your database.\nTo finish the setup add your `deployment`, `data_type` and `api_key` records.\n\n## API Sample Bodies\n\nHere are some sample request bodies, showing how you create each type of geometry.\n\ne.g. `POST: http://localhost:3000/geo?api_key=YOUR_API_KEY`\n\n**Creating a POINT**\n\n```json\n{\n  \"data_type\": 1,\n  \"geom\": {\n    \"type\": \"POINT\",\n    \"x\": 54.973877,\n    \"y\": -1.613101\n  }\n}\n```\n\n**Creating a LINESTRING**\n\n```json\n{\n  \"data_type\": 2,\n  \"geom\": {\n    \"type\": \"LINESTRING\",\n    \"points\": [\n      { \"x\": 54.973877, \"y\": -1.613101 },\n      { \"x\": 54.973877, \"y\": -1.613101 }\n    ]\n  }\n}\n```\n\n## Docker Environment Variables\n\nThese are the variables you set on your container and what they are for\n\nVariable   | Description\n---------- | -----------\n`SQL_URL`  | An sql url to specify the database connection\n`API_PORT` | The port the api runs on, default: 3000\n\n\u003e You can use `SQL_USER`, `SQL_PASS`, `SQL_HOST` \u0026 `SQL_NAME` if you cannot use `SQL_URL` for some reason (i.e. dokku)\n\n## Dev Notes\n\nAll you need to develop locally is to have [docker](https://www.docker.com/) installed.\n\n**Setup**\n\n```bash\ncd into/this/repo\n\n# Start up docker containers\n# It will watch for .js file changes and restart automatically\ndocker-compose up -d\n```\n\n\u003e The first time, you'll need to manually run the database migrations.\n\u003e Connect with the details below and run the SQL statements in [db_init.sql](/db_init.sql)\n\u003e\n\u003e Credentials: `user:secret@127.0.0.1/geo-api`\n\n## Deployment\n\nThis repo uses a [GitLab pipeline](https://about.gitlab.com/features/gitlab-ci-cd/) to build a docker image on git push.\nIt creates a image with the `latest` tag on each commit.\nA versioned image can be built using the manual `build-version` CI job which uses the `package.json` version.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdigitalinteraction%2Fmake-place-geography","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdigitalinteraction%2Fmake-place-geography","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdigitalinteraction%2Fmake-place-geography/lists"}