Winnipeg Crime Stat – Pulling out Datasets

City of Winnipeg has a new crime map.

wps-crime-stat

 

The map utilizes googlemaps api and it is now possible to pull data directly out of the back end. More on the subject … here

 

 

Anyways onto the data liberation!

Here are a couple example links

http://mapapi.winnipeg.ca/mapapi/wfs.ashx?maptypeid=2&featurelist=13706

Returns data looking like :

{"features":[{"id":"13706","gtype":"2001","selectable":false,"DESCRIPTION":"CrimeStat GoogleMapAPI","PRIORITY":"1","tooltip":"<%.MASTERTYPE%> - Not Actual Location","HOT_WEIGHT":"0","HOT_TEXT_SIZE":"140","HOT_SYMBOL_NAME":"<%.ICON%>","HOT_SYMBOL_FILE":"<%FilesRoot%>CrimeStat.fsm","HOT_LINE_STYLE":"0","HOT_FILL_COLOR":"<%.ICON_COLOR%>","HOT_COLOR":"6F6F6F","SYM_WEIGHT":"0","SYM_TEXT_SIZE":"140","HOT_LINE_STYLE":"0","SYM_SYMBOL_NAME":"<%.ICON%>","SYM_SYMBOL_FILE":"<%FilesRoot%>CrimeStat.fsm","SYM_LINE_STYLE":"0","SYM_FILL_COLOR":"<%.ICON_COLOR%>","SYM_COLOR":"000000","THEME_ID":"0","HOTSPOT_SYM_ID":"18313","DISPLAY_SYM_ID":"18312","FEATURE_TYPE":"P","DISPLAY_TYPE":"D","DISPLAY_ID":"952806","DISPLAY_SCALE_FROM":"0","DISPLAY_SCALE_TO":"200000","ENHANCED_DISPLAY_MAX":"200000","serviceType":"both","items":[{"ID":"412510300","ICON":"Knife","ICON_COLOR":"8816262","STARTDATE":"11-APR-13","MASTERTYPE":"Robbery - Non-Commercial/Financial","DISTRICT":"1","NEIGHBOURHOOD":"SPENCE","WARD":"Daniel McIntyre","ENDDATE":"11-APR-13","XCOORD":"632393.131401872547084177443531119399629","YCOORD":"5529066.24247354374464699454078565812944","DOWNTOWN":"0","geometry":"49.8993202833931 -97.156457624586"},{"ID":"412517700","ICON":"Car (SV Actual)","ICON_COLOR":"255","STARTDATE":"11-APR-13","MASTERTYPE":"Theft Motor Vehicle - Actual","DISTRICT":"6","NEIGHBOURHOOD":"CENTRAL RIVER HEIGHTS","WARD":"River Heights - Fort Garry","ENDDATE":"11-APR-13","XCOORD":"630035.458971987419543558466424536070793","YCOORD":"5524859.84074894720901909985837909073774","DOWNTOWN":"0","geometry":"49.8620229716132 -97.19068433179"},

drill into the code … what kind of information are we looking at here:

{"ID":"412510300","ICON":"Knife","ICON_COLOR":"8816262","STARTDATE":"11-APR-13","MASTERTYPE":"Robbery - Non-Commercial/Financial","DISTRICT":"1","NEIGHBOURHOOD":"SPENCE","WARD":"Daniel McIntyre","ENDDATE":"11-APR-13","XCOORD":"632393.131401872547084177443531119399629","YCOORD":"5529066.24247354374464699454078565812944","DOWNTOWN":"0","geometry":"49.8993202833931 -97.156457624586"},

So one record contains alot of information … this is what I would be mostly interested in:

  • The Start Date(STARTDATE)
  • Type of Crime(MASTERTYPE)
  • The Police District(DISTRICT)
  • What Neighborhood(NEIGHBOURHOOD)
  • The Ward(WARD)
  • The End Date(ENDDATE) … this one is a little odd as so far every start and end date have been the same value
  • Relative GPS coordinates of where the crime happened(geometry)

So a useful record would look like:

  • 11-APR-13
  • Robbery – Non-Commercial/Financial
  • 1
  • SPENCE
  • Daniel McIntyre
  • 11-APR-13
  • 49.8993202833931 -97.156457624586

Here is what the city says about the gps data … in BOLD

THE CRIME TYPE ICONS ARE RELATED TO AN ADDRESS, BUT FOR PRIVACY CONCERNS THE ICONS HAVE BEEN RANDOMIZED FOR DISPLAY PURPOSES. THE DISPLAYED ICONS ARE NOT THE ACTUAL LOCATION WHERE THE CRIME OCCURRED. ALL DATA VISUALIZATIONS ON MAPS SHOULD BE CONSIDERED APPROXIMATE AND ATTEMPTS TO DERIVE SPECIFIC ADDRESSES ARE STRICTLY PROHIBITED.

Ever record has various internal delimiters {“Field1″:”Value1”, “Field2″:”Value2”} and records are separated by {record1}, {record2}

Here is the dataset for all the crime reports of 2012

http://mapapi.winnipeg.ca/mapapi/wfs.ashx?maptypeid=2&featurelist=13706&where=where%20startdate%26gt;='01-jan-2012'%20and%20enddate%26lt;='31-dec-2012'

If your curious to see what other types of selection are available. Install wireshark and set it to filter http headers. All the scripts that the site uses have been obfusticated so using this method to get the request urls is kind of a sneaky way of getting the data 😀

3 Replies to “Winnipeg Crime Stat – Pulling out Datasets”

Comments are closed.