Closed andrewharvey closed 4 years ago
This issue is caused by a locality with 2 sets of coordinates instead of one for its centroid.
This code highlights the issue. There's no primary key at this stage of the process on the localities table, hence the problem occurs downstream on the street locality table
SELECT loc.locality_pid, loc.locality_name, loc.primary_postcode AS postcode, st.state_abbreviation AS state, pnt.latitude, pnt.longitude, aut.name AS locality_class, loc.gnaf_reliability_code, st_setsrid(st_makepoint(pnt.longitude, pnt.latitude), 4283) AS geom FROM raw_gnaf_202008.locality AS loc INNER JOIN raw_gnaf_202008.state AS st ON loc.state_pid = st.state_pid INNER JOIN raw_gnaf_202008.locality_class_aut AS aut ON loc.locality_class_code = aut.code LEFT OUTER JOIN raw_gnaf_202008.locality_point AS pnt ON loc.locality_pid = pnt.locality_pid where loc.locality_pid = '500223830' ORDER BY st.state_abbreviation, loc.locality_name, loc.primary_postcode;
Fix is to log a support request with PSMA. I can do that.
Workaround is to do a group by on the code above (in the postgres-scripts/03-02-reference-populate-localities.sql file) and use average coords
Workaround is now in the 202008 branch - starting a test run...
Test run successful - merging branch
Thanks Hugh.
Probably a data issue, so I'll see if I can manually tweak the source data as a workaround, but just a heads up that