-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extend graphql queries with a geo query #3084
base: main
Are you sure you want to change the base?
Conversation
b137335
to
45492d0
Compare
insertBaseData-mssql.sql
Outdated
VALUES (N'7339f9e3-99d1-497a-9e3b-1269c4c287fe', 'Harbour Grace Police Station', 47.705133, -53.214422, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP); | ||
INSERT INTO locations (uuid, name, lat, lng, createdAt, updatedAt) | ||
VALUES (N'f2207d9b-204b-4cb5-874d-3fe6bc6f8acd', 'Conception Bay South Police Station', 47.526784, -52.954739, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP); | ||
INSERT INTO locations (uuid, name, lat, lng, gisPoint, createdAt, updatedAt) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need to remove the lat and lng columns as they are redundant with the with GIS geometry (named gisPoint
here, but probably better named geometry
as we may not need to be constrained to a point in the future).
So I suggest to drop the columns in a migration, and refactor the API to return/set a geometry
instead of lat
and lon
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing lat
and lng
columns;
- will result in substantial amount of changes in both backend and frontend.
- will result in conflicting changes (potentially hard to resolve) with our currently open PRs Improve and extend merge for locations object #3073 GH 3042 Add MGRS coordinate format #3062 and Add all locations layer to the map #3056.
- will block progress on Make report collection render items on map using a geo boundary #3044.
- will not provide any new functionality.
Due to above reasons and in order to keep things simple, I suggest keeping this PR as is and open a debt issue for removing lat
and lng
columns. Also postpone that issue until #3073 #3062 and #3056 are merged and #3044 is implemented.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed column name to geometry
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue is that by merging this PR, we will have the geo data twice in the database - once as lat/lon and once as a geometry. Moreover, when new location objects are created or the ones modified, their geomerty is not updated, so the two do get out of sync. Even if they were in sync, it would be combersome to manipulate the database if needed with external scripts.
45492d0
to
77159e0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, the PR description still mentions gis_point which should be geometry I believe.
@@ -11,3 +11,5 @@ CREATE OR REPLACE AGGREGATE tsvector_agg (tsvector) ( | |||
|
|||
-- make sure the preconditions for UUID prefix search are met | |||
CREATE EXTENSION IF NOT EXISTS pg_trgm; | |||
|
|||
CREATE EXTENSION IF NOT EXISTS postgis; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a comment why this extension is added.
src/main/java/mil/dds/anet/search/mssql/MssqlLocationSearcher.java
Outdated
Show resolved
Hide resolved
src/main/java/mil/dds/anet/search/pg/PostgresqlLocationSearcher.java
Outdated
Show resolved
Hide resolved
77159e0
to
ef0f584
Compare
ef0f584
to
bccb7cc
Compare
bccb7cc
to
7d5fd43
Compare
This pull request introduces 3 alerts when merging 7d5fd43 into 05d6382 - view on LGTM.com new alerts:
|
7d5fd43
to
57db4d9
Compare
- Enable PostGIS extension on PostgreSQL - Add db migration for adding geometry column to locations - Add db migration to populate geometry from existing lat,lng columns - Update test data with geometry values - Update test data conversion script for geometry values - Add gradle task for dropping postgis extension and make sure that it runs before dbDrop task otherwise drop-all liquibase command fails.
57db4d9
to
304ce58
Compare
Added a column named geometry to locations table which is type of geometry. By using this column we can perform queries by using gis functions. Specifically we aim to use ST_Within gis function to query locations, reports and positions within a given polygon.
Release notes
Closes #3043
User changes
Super User changes
Admin changes
System admin changes
Checklist
repo#issue: Title
title format and these 7 rules