From Matthew Bloch's 2017 NACIS workshop.
mapshaper election/countyp010.shp name=counties \
-filter 'STATE_FIPS < 72' \
-filter 'COUNTY != ""' \
-dissolve FIPS copy-fields=STATE \
-proj albersusa \
-points inner + name=points \
-i election/2012-president-general-counties.csv string-fields=fips name=data \
-filter-fields fips,obama,romney \
-each 'margin = obama - romney' \
-each 'absmargin = Math.abs(margin)' \
-join target=points data keys=FIPS,fips \
-sort absmargin descending \
-svg-style r='Math.sqrt(absmargin) * 0.02' \
-svg-style opacity=0.5 fill='margin > 0 ? "#0061aa" : "#cc0000"' \
-lines STATE target=counties \
-svg-style stroke="#ddd" where='TYPE == "inner"' \
-svg-style stroke="#777" where='TYPE == "outer"' \
-svg-style stroke="#999" where='TYPE == "STATE"' \
-o election/map.svg target=counties,points
This take a list fires detected in Australia, clips them to New South Wales and counts how many occur each day.
mapshaper aus-fire/fire_nrt.csv \
-clip aus-fire/NSW_STATE_POLYGON_shp.shp \
-filter-fields acq_date \
-dissolve acq_date calc='n = count()' \
-o aus-fire/by-day-nsw.csv
The input data looks like this:
latitude,longitude,brightness,scan,track,acq_date,acq_time,satellite,instrument,confidence,version,bright_t31,frp,daynight
-18.439,145.293,331.3,1.3,1.1,2020-01-01,0050,Terra,MODIS,48,6.0NRT,307.5,22.5,D
-18.148,142.975,338.2,1,1,2020-01-01,0050,Terra,MODIS,65,6.0NRT,308.3,21.1,D
-18.16,142.993,337.3,1,1,2020-01-01,0050,Terra,MODIS,76,6.0NRT,302.5,23.4,D
and gets shrunk down to this:
acq_date,n
2020-01-01,3686
2020-01-02,4389
2020-01-03,4257