{"id":29022022,"url":"https://github.com/amsterdam/geosearch","last_synced_at":"2025-07-15T11:37:00.776Z","repository":{"id":7981216,"uuid":"57038067","full_name":"Amsterdam/geosearch","owner":"Amsterdam","description":"Providers geosearch for the data available via datapunt","archived":false,"fork":false,"pushed_at":"2025-06-24T13:50:47.000Z","size":619,"stargazers_count":2,"open_issues_count":1,"forks_count":2,"subscribers_count":28,"default_branch":"master","last_synced_at":"2025-06-26T02:41:47.311Z","etag":null,"topics":["flask","flask-api","geosearch","team-datadiensten"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Amsterdam.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,"zenodo":null}},"created_at":"2016-04-25T11:59:17.000Z","updated_at":"2025-06-24T13:50:50.000Z","dependencies_parsed_at":"2023-11-07T12:23:48.907Z","dependency_job_id":"1604b418-d130-4223-b456-5aaf35f8432b","html_url":"https://github.com/Amsterdam/geosearch","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/Amsterdam/geosearch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Amsterdam%2Fgeosearch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Amsterdam%2Fgeosearch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Amsterdam%2Fgeosearch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Amsterdam%2Fgeosearch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Amsterdam","download_url":"https://codeload.github.com/Amsterdam/geosearch/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Amsterdam%2Fgeosearch/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265432470,"owners_count":23764098,"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":["flask","flask-api","geosearch","team-datadiensten"],"created_at":"2025-06-26T02:34:59.228Z","updated_at":"2025-07-15T11:37:00.740Z","avatar_url":"https://github.com/Amsterdam.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Setup of local development\n\n## API docs\n\n- go to `https://api.data.amsterdam.nl/api/swagger/?url=/geosearch/docs/geosearch.yml`\n- put `/geosearch/docs/geosearch.yml` into the search bar\n\n### Notes\n\n- there is currently no guarantee that these docs are 100% up to date\n- the possible datasets/tables that canbe used for filtering can be retrieved from `/catalogus/`\n- behavior of filtering on datasets is non-deterministic and opaque because 1) it is not described and 2) if there is a name collision, results may disappear\n\n## Bootstrapping\n\nThe dependencies are set up using `pip-compile` which is part of the `pip-tools` package.\nSo, after creating the virtual env, update the requirements files.\nFirst install `pip-tools` with `pip install pip-tools`.\n\nNB. Because of a problem with cython 3, we need an extra PIP_CONSTRAINT. \nHopefully, this limitation will be removed in the near future. \nSo, first try without the constraint. \nIf that works, remove this limitation from this readme.\n\nNow update the `requirements.txt` and `requirements_dev.txt` from the `*.in` files.\n\n1) `echo \"cython\u003c3\" \u003e /tmp/constraint.txt`\n2) `cd web`\n3) `PIP_CONSTRAINT=/tmp/constraint.txt pip-compile --resolver=legacy -o requirements_dev.txt requirements_dev.in`\n4) `PIP_CONSTRAINT=/tmp/constraint.txt pip-compile --resolver=legacy -o requirements.txt requirements.in`\n\n## Virtual env setup for local development\n\nNB. See above about the needed PIP_CONSTRAINT.\n\n1) `cd` to the root of the git repo\n2) `PIP_CONSTRAINT=/tmp/constraint.txt pip install -r web/requirements_dev.txt`\n3) `pre-commit install`\n\nThe local geosearch application can be started with `python web/geosearch/wsgi.py` \n(with an active venv).\n\nTo run the geosearch application against the Azure postgreSQL instance\ndefine the following environment variables:\n\n    export DATASERVICES_PW_LOCATION\n    export DATASERVICES_DB_DATABASE_OVERRIDE\n    export DATASERVICES_DB_HOST_OVERRIDE\n    export DATASERVICES_DB_USER_OVERRIDE\n\nThe DATASERVICES_PW_LOCATION should point to a local file that contains\na valid postgreSQL user token.\n\n\n## Container setup\n\nLocal development can be done using docker. \nThe application requires the `datasets_` tables\ncreated by dso-api. \n\n1) Start containers:\n\n    `docker-compose up database -d`\n\n\n2) Start the app\n\n    `docker-compose up web`\n\n3) Query the app\n   `http://localhost:8022/?datasets=bag/gebieden\u0026lat=52.3533513854879\u0026lon=4.83714013585293\u0026_fields=type\u0026radius=100`\n\n4) Take the testsuite for a spin:\n\n    `docker-compose exec web pytest -v`\n\n\n## A note on formatting and git blame\n\nblack formatting was introduced late in this project by a monster commit.\nTo avoid git blame getting confused, configure git to ignore that commit:\n\n`$ git config blame.ignoreRevsFile .git-blame-ignore-revs`\n\n# Geospatial queries\n\nDoel is zoeken op coordinaat door de (aangegeven) aanwezige database\nviews en features teruggeven aan de client in geojson formaat.\n\n## Soorten queries\nEr zijn twee soorten postgis queries van toepassing voor de usecase:\n\n* ST_DWithin voor ST_Point velden\n* ST_Contains voor ST_Polygon ST_MultiPolygon\n\nWe zoeken momenteel nog niet op ST_MultiLineString.\n\n## RD/WGS84\nMomenteel is de geometrie opgeslagen in RD srid. We zouden naast deze\nkolom een kolom kunnen toevoegen waarin geometrie rsid WGS84 is. Met\ndeze rsid heeft kunnen we een ST_GeoHash index gebruiken in plaats van\nde GEOS filter, wat beter performt.\n\nView \u0026 index aanmaken wordt dan zoiets:\n\n`CREATE MATERIALIZED VIEW {}_mat AS SELECT *, ST_Transform(geometrie,\n4326) as geometrie_wgs84 FROM {}`\n\n`CREATE INDEX {}_idx ON {}_mat USING GIST(geometrie)`\n\n`GISTCREATE INDEX {}_idx_wgs84 ON {}_mat USING\nST_GeoHash(geometrie_wgs84)`geometrie_wgs84\n\n\n## Api Endpoints\n\nAlleen datasets die zijn opgenomen in de referentiedatabase kunnen doorzocht worden vanuit Geosearch.\n\nVoorbeeld van een zoekopdracht:\n\n    https://api.data.amsterdam.nl/geosearch/?datasets=bag%2Fopenbareruimtes\u0026lat=52.38507894664783\u0026lon=4.876663684844972\u0026radius=5\u0026_fields=naam,typeOmschrijving\n\nZoekparameters zijn:\n\ndatasets:\n    Komma-gescheiden lijst van datasets. Zie `https://schemas.data.amsterdam.nl/datasets/` voor een lijst met alle mogelijke datasets.\n    Uiteraard moet de dataset geo-informatie bevatten om doorzoekbaar te zijn. Naast de dataset kan ook de datasettable gespecificeerd worden.\n    De specificatie van de datasets wordt dan `datasets=\u003cdataset-id\u003e%2F\u003cdatset-table-id\u003e, ...`\n\nx,y of lat, lon:\n    Coordinatenpaar. x,y: voor coordinaten in RD stelsel en lat, lon: voor WGS84.\n\nradius:\n    Radius van de cirkel rond de opgegeven coordinaat.\n\n_fields:\n    Komma-gescheiden lijst van evt. extra velden die in het resultaat getoond moeten worden (zie ook weer de amsterdam schema definities voor de velden van de dataset-tabel).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famsterdam%2Fgeosearch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famsterdam%2Fgeosearch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famsterdam%2Fgeosearch/lists"}