Unity Package

Crime Data

General

Please note, this feature is in an early stage, and we are including more and more data points. We currently support the following countries:

  1. GB

  2. Parts of the US

You can now also request points in the world where crimes have happened. In order to render crime points, you need to.

  1. Check the CRIMES entry in the AREA_RENDER_OPTIONS in the CoalaConfigObj that you will find in your CoalaConfig.

  1. Create or alter a CrimeConfigObj with settings of your choosing by right-clicking into your content browser and clicking Create-> Coala -> CrimeConfig and dragging it into the "Crime" property in the CoalaConfig.

Features

Displaying Crime Points

One of the greatest features of Crime Data is that you can display Crime Points on the map with prefabs of your choosing. You first need to specify all crime type combinations for the crime points you would like to be displayed in the Crime Types To Display section. For convenience, you can stop each of these combinations from getting rendered by unchecking the Should Be Rendered box. You can assign a specific prefab to represent that crime type combination in the Prefab fields.

Highlighting Crime Points

You can highlight Crime Points by checking Should Be Highlighted for the specified Crime Type combination in Crime Types To Display. The prefab used to highlight those crime points can be set in the field HighlighterPrefab.

Crime Heatmap

There is also a feature which allows you to display a heatmap that illustrates the distribution of crimes on the map. Only rendered crime points that fit your selected types in Crime Types To Display in the CrimeConfig will be taken into consideration. If you want to disable the heatmap, you can set the Heat Map Type property to Off. This property has two other options, Pillars and Flat, which allow you to choose between two different display options for your heatmap.

Heatmap Settings explained

Weight: The height of the token on any Cell is determined by the total Weight value of that Cell. By default, each crime point adds a value of 1 to the initial weight of the Cell the crime was reported in. This is then modified by the following variables to produce the heatmap in the picture.

  1. Influence. This value determines how far the influence of each crime point reaches and how tall the tokens are. The value is translated in "rings" around the crime point, meaning that a value of 0 will only influence the Cell in which the crime point's location is. A value of 1 will influence that cell and the 8 adjacent ones, and so on. The Weight of a Cell containing a crime point is multiplied by this value and is then applied to neighboring Cells as well, reduced by 1 for each ring of Cells away from the crime point, which produces the result in the picture below. If a Cell is within the Influence range of more than one crime points, its Weight value will equal the sum of the individual Weights applied to it by all of these crime points.

  2. WeightFactor. This is a universal value which determines how much a crime point influences the cells surrounding it. If a red color signalizes a large number of crimes, then the higher the WeightFactor is, the more cells around the crime point will have a red prefab on them. Practically, the Weight of each Cell is multiplied by the WeightFactor, resulting in taller tokens on all Cells. By default, a token's color is directly dependent on its height, which is determined by the Cell's Weight, therefore, the bigger the WeightFactor value, the more "Red" the heatmap will be.

  3. ThresholdWeight. This value determines a threshold for the minimum Weight a Cell needs to have so that a token will be displayed on it. If you want to display all tokens, set this to -1.

Example Heatmaps with thresholds:

Pillars

The Pillars mode will use the Prefab Heat Pillar. The Pillar Scale property in the CrimeConfig is exclusively relevant to this mode and specifies how tall the pillars will be.

Flat

The Flat mode will just spawn the prefabs but will not alter their height depending on their weight. For a nice effect on hexagon or dot patterns, every second row will be displaced by half a cell.

Visuals

You can define your own prefab for each of these options by assigning it to the properties Prefab Heat Pillar and Prefab Heat Map Flat. It is important to note that your prefab will only work if the following things apply:

  1. The highest parent needs to have a collider component as well as the HeatMapToken script attached

  2. The Mesh Renderer needs to be attached to an object other than the highest parent object.

  3. In the HeatMapToken Inspector you need to assign the mesh renderer as well as the Heat Map Type this token is supposed to represent.

The gradient which is used for the heatmap can be edited by duplicating the standard heatmap shader and altering the ColorGradient parameter in Unity's ShaderGraph Editor.