Comments (2)
This likely due to the fact that the map sql query has to select geometries that aren't null, while the stats sql query selects all rows regardless of whether or not it has a geometry.
Example stats query:
--- filter where pedestrians_killed > 0
SELECT COUNT(c.cartodb_id) as total_crashes,
SUM(CASE WHEN c.number_of_persons_injured > 0 THEN 1 ELSE 0 END) AS total_crashes_with_injury,
SUM(CASE WHEN c.number_of_persons_killed > 0 THEN 1 ELSE 0 END) AS total_crashes_with_death,
SUM(c.number_of_cyclist_injured) as cyclist_injured,
SUM(c.number_of_cyclist_killed) as cyclist_killed,
SUM(c.number_of_motorist_injured) as motorist_injured,
SUM(c.number_of_motorist_killed) as motorist_killed,
SUM(c.number_of_pedestrian_injured) as pedestrian_injured,
SUM(c.number_of_pedestrian_killed) as pedestrian_killed,
SUM(c.number_of_persons_injured) as persons_injured,
SUM(c.number_of_persons_killed) as persons_killed
FROM export2016_07 c
WHERE (date_val <= date 'Aug 6, 2016')
AND (date_val >= date 'Jul 1, 2016')
AND ( number_of_pedestrian_killed > 0 )
Example map query:
--- filter where pedestrians > 0
SELECT c.the_geom,
c.the_geom_webmercator,
c.on_street_name,
c.cross_street_name,
COUNT(c.cartodb_id) as total_crashes,
SUM(c.number_of_cyclist_injured) as cyclist_injured,
SUM(c.number_of_cyclist_killed) as cyclist_killed,
SUM(c.number_of_motorist_injured) as motorist_injured,
SUM(c.number_of_motorist_killed) as motorist_killed,
SUM(c.number_of_pedestrian_injured) as pedestrian_injured,
SUM(c.number_of_pedestrian_killed) as pedestrian_killed,
SUM(c.number_of_pedestrian_injured + c.number_of_cyclist_injured + c.number_of_motorist_injured) as persons_injured,
SUM(c.number_of_pedestrian_killed + c.number_of_cyclist_killed + c.number_of_motorist_killed) as persons_killed
FROM export2016_07 c
WHERE (date_val <= date '2016-08-06')
AND (date_val >= date '2016-07-01')
AND ( number_of_pedestrian_killed > 0 )
AND c.the_geom IS NOT NULL
GROUP BY c.the_geom, c.the_geom_webmercator, c.on_street_name, c.cross_street_name
from nyc-crash-mapper.
Should explain this in the "about" or "about the data" section though as to not confuse users.
from nyc-crash-mapper.
Related Issues (20)
- Vehicle Type Filter HOT 7
- Default date not setting? HOT 1
- New Vehicle Type listing on map HOT 1
- Copy updates to Help, About, Copyright HOT 4
- Download data button no longer works, appears to Vehicle type related HOT 1
- Improve Filter by Intersection UX HOT 9
- Select area type but not an area = Button selected but no GeoJSON HOT 1
- Some intersections making bad queries? HOT 3
- Make intersection circle legend HOT 4
- Error in console, line 111 HOT 1
- Filter Area Message for "Citywide"?
- Add tracking code HOT 1
- Update About copy
- Make About Modal bigger
- New Help panel HOT 1
- Geocoder tool HOT 4
- integrate Vision Zero traffic mitigation data
- ETL for Vision Zero data
- Add new boundary layers for leg districts HOT 10
- Some geometries have ID mismatches between Map and Chart app HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nyc-crash-mapper.