Skip to content

Adding Updating new data layers for Maproom v3

Yoh Kawano edited this page Aug 8, 2018 · 6 revisions

The following workflow describes the process of updating or adding new data layers to the Million Dollar Hoods maproom. Data must first be exported as a csv file, which is then converted to a json format for the web map.

  • create csv table that includes the following fields: id,slug,name,pop2010,pop2010_18,_bookings,_jaildays,_cost,_sex_m,_sex_f,_race_h,_race_b,_race_w,_race_o2,_charge_m,_charge_f,_charge_o
  • convert csv to json (https://www.csvjson.com/csv2json)
  • there is a small edit that needs to be applied to the json file. open the json file in a text editor (ie. Atom or Sublime), and add the variable name in front. The variable name should be the same as the file name, and should have the following nomenclature (lasd_2012_2017_by_neighborhoods):
	lasd_2012_2017_by_neighborhoods = [
	{
		"id": 112,
		"slug": "larchmont",
		"name": "Larchmont",
		"pop2010": 7822,
		"pop2010_18": 6510,
		"_bookings": 26,
		"_jaildays": 824,
		"_cost": 117477,
		"_sex_m": 18,
		"_sex_f": 8,
		"_race_h": 9,
		"_race_b": 2,
		"_race_w": 10,
		"_race_o2": 5,
		"_charge_m": 14,
		"_charge_f": 11,
		"_charge_o": 1
	},
  • save it in the data directory with the name of the variable name and a .js extension (ex: lasd_2012_2017_by_neighborhoods.js)
  • open maproomv3/js/mdbla.config.js
  • add the following (around line 54): $.getScript( "data/lasd_2012_2017_by_neighborhoods.js" ),
  • under mdbla.datalayers (around line 182), add the following (change accordingly**):
		{
			title: 		"LASD 2012-2017 by Neighborhoods",
			department: 	"LASD",
			years: 		"2012-2017",
			identifyer: 	"slug",
			geographyname: 	"Neighborhoods",
			geography: 	neighborhoods,
			datavar: 	lasd_2012_2017_by_neighborhoods
		},

** Note:

  • identifyers for region should be changed to "region" instead of "slug" in the json file. same with "assembly"