keithamoss / demsausage

Democracy Sausage
https://democracysausage.org
MIT License
10 stars 4 forks source link

Polling place ingest improvements #65

Closed keithamoss closed 1 year ago

keithamoss commented 5 years ago
SELECT "app_pollingplaces"."id", "app_pollingplaces"."old_id", "app_pollingplaces"."election_id", "app_pollingplaces"."noms_id", "app_pollingplaces"."geom"::bytea, "app_pollingplaces"."name", "app_pollingplaces"."facility_type_id", "app_pollingplaces"."premises", "app_pollingplaces"."address", "app_pollingplaces"."divisions", "app_pollingplaces"."state", "app_pollingplaces"."wheelchair_access", "app_pollingplaces"."entrance_desc", "app_pollingplaces"."opening_hours", "app_pollingplaces"."booth_info", "app_pollingplaces"."status", "app_pollingplaces"."chance_of_sausage", "app_pollingplaces"."extras", "app_pollingplaces"."ec_id", ST_Distance("app_pollingplaces"."geom", ST_GeogFromWKB('\x0101000020e610000062105839b4e46240c286a757caba40c0'::bytea)) AS "distance" FROM "demsausage"."app_pollingplaces" WHERE ("app_pollingplaces"."status" = 'Active' AND NOT ("app_pollingplaces"."election_id" = 27) AND ST_Distance("app_pollingplaces"."geom", ST_GeogFromWKB('\x0101000020e610000062105839b4e46240c286a757caba40c0'::bytea)) <= 200.0) ORDER BY "app_pollingplaces"."election_id" ASC;

Resources

Django

https://docs.djangoproject.com/en/2.2/topics/db/transactions/ https://docs.djangoproject.com/en/2.2/ref/databases/ (Performance and optimisation)

PostGIS

https://gis.stackexchange.com/questions/14232/using-a-geodjango-pointfield-with-geography-true-my-distance-calculations-are-w https://web.archive.org/web/20180204152904/http://workshops.boundlessgeo.com/postgis-intro/geography.html

AB#41

keithamoss commented 1 year ago

Closing and merging into https://github.com/keithamoss/demsausage/issues/1339