Crime Data API

This API exposes data on Part I crime incidents for the City of Philadelphia from January 1, 2006.

API Endpoints

There are two API endpoints, providing crime data going back to different points in time. (Note - A static CSV file of Part 1 all crime incidents since 1/1/2006 (updated daily) is available for download.)

Part 1 crimes for the last 30 dayshttp://gis.phila.gov/ArcGIS/rest/services/PhilaGov/Police_Incidents_Last30/Mapserver
Part 1 crimes going back to 1/1/2006http://gis.phila.gov/ArcGIS/rest/services/PhilaGov/Police_Incidents/MapServer

Key Attribute Field Names & Descriptions

DC_DistA two character field that names the District boundary.
SectorA single character field that names the Police Service Area boundary.
Dispatch_Date/Dispatch_TimeThe date and time that the officer was dispatched to the scene.
HourThe generalized hour of the dispatched time.
DC_KeyThe unique identifier of the crime that consists of Year + District + Unique ID.
Location_BlockThe location of crime generalized by street block.
UCR_GeneralThe rounded crime code, i.e. 614 to 600.
Text_General_CodeThe generalized text for the crime code.
Point_XLongitude of crime location.
Point_YLatitude of crime location.

UCR Codes

100Homicide
200Rape
300Robbery (with Firearm or not)
400Agggravated Assault (with Firearm or not)
500Burglary (Residential or Non-Residential)
600Theft (from Vehicle or not)
700Motor Vehicle Theft and Recovered Stolen Motor Vehicle

Sample API Calls

Using query SECTOR='3' AND UCR_GENERAL='500'

http://gis.phila.gov/ArcGIS/rest/services/PhilaGov/Police_Incidents_Last30/MapServer/0/query?text=&geometry=&geometryType=esriGeometryPoint&inSR=&spatialRel=esriSpatialRelIntersects&relationParam=&objectIds=&where=SECTOR%3D%273%27+AND+UCR_GENERAL%3D%27500%27&time=&returnCountOnly=false&returnIdsOnly=false&returnGeometry=true&maxAllowableOffset=&outSR=&outFields=*&f=pjson

Sample API Response

Note - truncated for display.

          HTTP/1.1 200 OK
            Content-Type: text/plain; charset=utf-8
            ETag: -1697388757
            Server: Microsoft-IIS/7.5
            Access-Control-Allow-Origin: *
            Date: Thu, 17 Jan 2013 23:06:41 GMT
            Content-Length: 152617

            {
              "displayFieldName" : "DC_DIST",
              "fieldAliases" : {
                "DC_DIST" : "DC_DIST",
                "SECTOR" : "SECTOR",
                "DISPATCH_DATE_TIME" : "DISPATCH_DATE_TIME",
                "DISPATCH_DATE" : "DISPATCH_DATE",
                "DISPATCH_TIME" : "DISPATCH_TIME",
                "HOUR" : "HOUR",
                "DC_KEY" : "DC_KEY",
                "LOCATION_BLOCK" : "LOCATION_BLOCK",
                "UCR_GENERAL" : "UCR_GENERAL",
                "OBJECTID" : "OBJECTID",
                "TEXT_GENERAL_CODE" : "TEXT_GENERAL_CODE",
                "POINT_X" : "POINT_X",
                "POINT_Y" : "POINT_Y"
              },
              "geometryType" : "esriGeometryPoint",
              "spatialReference" : {
                "wkid" : 4269
              },
              "fields" : [
                {
                  "name" : "DC_DIST",
                  "type" : "esriFieldTypeString",
                  "alias" : "DC_DIST",
                  "length" : 2
                },
                {
                  "name" : "SECTOR",
                  "type" : "esriFieldTypeString",
                  "alias" : "SECTOR",
                  "length" : 1
                },
                {
                  "name" : "DISPATCH_DATE_TIME",
                  "type" : "esriFieldTypeDate",
                  "alias" : "DISPATCH_DATE_TIME",
                  "length" : 36
                },
                {
                  "name" : "DISPATCH_DATE",
                  "type" : "esriFieldTypeString",
                  "alias" : "DISPATCH_DATE",
                  "length" : 30
                },
                {
                  "name" : "DISPATCH_TIME",
                  "type" : "esriFieldTypeString",
                  "alias" : "DISPATCH_TIME",
                  "length" : 30
                },
                {
                  "name" : "HOUR",
                  "type" : "esriFieldTypeSmallInteger",
                  "alias" : "HOUR"
                },
                {
                  "name" : "DC_KEY",
                  "type" : "esriFieldTypeString",
                  "alias" : "DC_KEY",
                  "length" : 12
                },
                {
                  "name" : "LOCATION_BLOCK",
                  "type" : "esriFieldTypeString",
                  "alias" : "LOCATION_BLOCK",
                  "length" : 45
                },
                {
                  "name" : "UCR_GENERAL",
                  "type" : "esriFieldTypeString",
                  "alias" : "UCR_GENERAL",
                  "length" : 50
                },
                {
                  "name" : "OBJECTID",
                  "type" : "esriFieldTypeOID",
                  "alias" : "OBJECTID"
                },
                {
                  "name" : "TEXT_GENERAL_CODE",
                  "type" : "esriFieldTypeString",
                  "alias" : "TEXT_GENERAL_CODE",
                  "length" : 255
                },
                {
                  "name" : "POINT_X",
                  "type" : "esriFieldTypeDouble",
                  "alias" : "POINT_X"
                },
                {
                  "name" : "POINT_Y",
                  "type" : "esriFieldTypeDouble",
                  "alias" : "POINT_Y"
                }
              ],
              "features" : [
                {
                  "attributes" : {
                    "DC_DIST" : "15",
                    "SECTOR" : "3",
                    "DISPATCH_DATE_TIME" : 1355940000000,
                    "DISPATCH_DATE" : "2012-12-19",
                    "DISPATCH_TIME" : "18:00:00",
                    "HOUR" : 18,
                    "DC_KEY" : "201215122134",
                    "LOCATION_BLOCK" : "6800 BLOCK TULIP ST",
                    "UCR_GENERAL" : "500",
                    "OBJECTID" : 532,
                    "TEXT_GENERAL_CODE" : "Burglary Residential",
                    "POINT_X" : -75.042410129999993,
                    "POINT_Y" : 40.02350569
                  },
                  "geometry" : {
                    "x" : -75.042410134000022,
                    "y" : 40.023505689999979
                  }
                },

                ...
                
                  "attributes" : {
                    "DC_DIST" : "03",
                    "SECTOR" : "3",
                    "DISPATCH_DATE_TIME" : 1356958140000,
                    "DISPATCH_DATE" : "2012-12-31",
                    "DISPATCH_TIME" : "12:49:00",
                    "HOUR" : 12,
                    "DC_KEY" : "201203082580",
                    "LOCATION_BLOCK" : "2400 BLOCK S SARTAIN ST",
                    "UCR_GENERAL" : "500",
                    "OBJECTID" : 595642,
                    "TEXT_GENERAL_CODE" : "Burglary Residential",
                    "POINT_X" : -75.166264720000001,
                    "POINT_Y" : 39.919841759999997
                  },
                  "geometry" : {
                    "x" : -75.166264715000011,
                    "y" : 39.919841763000022
                  }
                }
              ]
            }
          

Tips on Querying this API

You can also pass in a geometry (points, lines or polygons) and query for the crimes that have a spatial relationship to that geometry (crosses, within, etc.). Consult the ArcGIS REST API documentation for full details.

For example, to retrieve all of the crimes within a certain area of Philadelphia:

http://gis.phila.gov/ArcGIS/rest/services/PhilaGov/Police_Incidents/MapServer/0/query?geometry={"rings":[[[-75.16505599021912,39.95365185651431],[-75.16235232353209,39.95329409673581],[-75.16274392604828,39.951423023730335],[-75.16437470912933,39.95170677215989],[-75.16496479511261,39.951805466989896],[-75.16525983810425,39.95202341756838],[-75.16528129577637,39.95224136745237],[-75.16524910926819,39.95252922472533],[-75.16513645648956,39.9529856816317],[-75.16510963439941,39.95331876988407],[-75.16505599021912,39.95365185651431]]],"spatialReference":{"wkid":4326}}&geometryType=esriGeometryPolygon&spatialRel=esriSpatialRelContains&outFields=*&inSR=4326&outSR=4326&f=pjson&pretty=true

Some things to keep in mind:
  • If you are passing a polygon as the geometry, your first pair of coordinates must be identical to your last to "close" the polygon.
  • The inSR and outSR parameters require a spatial reference code. You'll probably be using latitude/longitude, which is 4326, but there are others. If you do not pass these parameters, the service defaults to the spatialReference that you pass in the geometry string, which is required.

There is additional functionality for thsi API that is not included here. Consult the documentation for complete information.

Notes

Part I crime includes, Homicides, Rapes, Robberies, Aggravated Assaults, Thefts. The data returned is generalized by the crime type and the block location.