alpha-beta-soup / national-crash-statistics

An interactive web map of the New Zealand Transport Agency's Crash Analysis System (CAS) data.
MIT License
12 stars 6 forks source link

Correcting points #15

Closed alpha-beta-soup closed 9 years ago

alpha-beta-soup commented 9 years ago

There are a few issues with the raw data. In the 2014 data, two points seem to have an invalid latitude, so appear near the south pole. These will need to be manually adjusted, and there are possibly others in the as yet untouched datasets.

Crashes occurring in the Chatham Islands have been placed in the Pacific Ocean to the west of where they actually occurred, presumably to avoid having points in the western hemisphere. The offset can probably be determined and then added to any points listed as occurring in the Chathams county (in the Python). How this plays with Leaflet is another matter...

alpha-beta-soup commented 9 years ago

Turns out the two in the Ross Sea had latitude and longitude values of 0, rather than NULL as they should. I've added a check for 0 as well as NULL when determining nztacrash.hasLocation (which in turn controls whether the accident gets added to the GeoJSON).

parnelandr commented 9 years ago

Sweet sounds good

alpha-beta-soup commented 9 years ago

I worked out the correction needed to move the Chatham Islands crashes back onto the Chatham Islands: -96135 metres in the easting, and +355966 in the northing. Problem is, as expected, Leaflet doesn't play nice with the anti-meridian. Here's an example of what happens If I offset everything a couple of hundred kilometres towards it.

screenshot from 2014-12-17 12 47 37

On the far side, the other points appear. This is where this correction moves the Chatham's crashes to. For now I'll leave the correction in place, even though in principle it makes them harder find. What do you think @parnelandr? Sweating the small stuff?

alpha-beta-soup commented 9 years ago

It could be an issue of choosing a custom projection (with an origin on the antimeridian)? I'm not sure. https://github.com/kartena/Proj4Leaflet

alpha-beta-soup commented 9 years ago

Going to close this issue given this commit.