Group Abstract Group Abstract

Message Boards Message Boards

Mapping Crime Statistics in St. Louis

Posted 11 years ago

enter image description here

Attachments:
POSTED BY: Arnoud Buzing
6 Replies
Posted 11 years ago

I added date filed to data:

data = data[[All, {1, 3, 9, 11, 19, 20}]];

and create sorted subdata:

dataset =  dataset[All,  Append[##,  "GeoPosition" -> (GeoPosition[GeoGridPosition[{Quantity[#XCoord, "Feet"], Quantity[#YCoord, "Feet"]}, projection]])] &]

subdata =   dataset[SortBy[#DateOccur &], {"DateOccur", "Description",  "GeoPosition"}];

By crime type:

desc = Normal[subdata[All, "Description"] // Union];

Manipulate[
 GeoGraphics[{Red, Opacity[.4], AbsolutePointSize[5], Point[#]} & /@ 
   Normal[subdata[Select[description === #Description &]][All, 
     "GeoPosition"]], 
  GeoRange -> {{38.5355, 38.7697}, {-90.3991, -90.1004}}, 
  ImageSize -> Large], {description, desc}]

By time stamp:

Manipulate[
 GeoGraphics[{{Red, Opacity[.4], AbsolutePointSize[5], Point[#]} & /@ 
    Normal[subdata[1 ;; time, "GeoPosition"]]}, ImageSize -> Large, 
  GeoRange -> {{38.5355, 38.7697}, {-90.3991, -90.1004}}], {time, 1, 
  Length[subdata], 1}]
POSTED BY: Jaebum Jung

This an animated GIF made from Jaebum's Manipulate code:

imgs = Table[
   GeoGraphics[{{Red, Opacity[.4], AbsolutePointSize[5], Point[#]} & /@
       Normal[subdata[1 ;; time, "GeoPosition"]]}, ImageSize -> Large,
     GeoRange -> {{38.5355, 38.7697}, {-90.3991, -90.1004}}], {time, 
    1, Length[subdata], 100}];

Export["test.gif", imgs, ImageSize -> 400]

enter image description here

POSTED BY: Vitaliy Kaurov

This is great! I shared this exercise with my students taking a course on statistics and they grasped pretty well the value of linked data. Thanks J. Rico

Good stuff. Would be interesting to break this down by type of crime and then create a Manipulate that let you select the crime type. Also, I note there's a time stamp on the crime in the original data. If the time stamp could be parsed, there might be a useful Numb3ersish animation lurking here.

POSTED BY: Seth Chandler

enter image description here -- you have earned Featured Contributor Badge enter image description here Your exceptional post has been selected for our editorial column Staff Picks http://wolfr.am/StaffPicks and Your Profile is now distinguished by a Featured Contributor Badge and is displayed on the Featured Contributor Board. Thank you!

POSTED BY: EDITORIAL BOARD

Hi, This a great example. I tried to copy this example on my own data. It works fine. The only issue I've is that there is not a kind of refresh of the image after each day. So, when a bullit is highlited, it stays highlited even that specific object it's not active on that day. Who has a solution for this issue? Thanks Michiel

POSTED BY: Michiel van Mens
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard