Demographic Structure and Urban Facilities

Rw
Data Mining the City
5 min readOct 16, 2019

by Guangwei Ren, Rui Wang, Shuo Han

An interactive model of the evalution of infrastructures’ capacity with increasing population and changing demographic structure.

User Interface

1.Intro

Infrastructures serve all-age groups. However, as the the aging of population becomes a serious problem all around the world, especially in developed countries like Japan and Singapore, it would be a question that whether the infrastructures in nowadays could still work in the future if the demographic structure changes heavily? And how the city’s function would shift in this circumstance?

Population & Percentage(Demographic Structure) Count

We suppose people in different age groups would have different paths and frequencies in using the public facilities;

Children:

Home — School/Hospital — Park — Home

Adult:

Home — Work — Food — Gym — Park — NightLife — Home

Elderly:

Home — Park/Hospital — Shop/Arts — Park — Home

Concept

Visualization

By swifting the scroll bars to control the percent that different age groups account for in the whole population, we can see the distribution of population around infrastructures and the visualized circle.

And there will be two cameras-

One is to show the overall distribution trends of people in different ages in a larger scope and the other is to wander around Manhattan to show specific moment around certain place.

Wandering Camera(Left) & Overall Cameral(Right)

2.Framework

Agents

Agents of the model are people in different age groups who would be the user of public facilities. In order to demonstrate the preference for facilities of different age groups, they would use the facilities with different frequencies. We adopt yellow to represent the elderly people, blue for middle-age, and red for children.

Environment

The environment would be Manhattan, we state the range of age group according to the demographic statistics in New York City, and marked out the exact location of facilities in Manhattan. the logic could be applied to other sites though.

Behavior

We derived the behavior from people’s daily life. The agents would be distributed in the space according to their preference to facilities ,and we can control the slider to see the situation under different demographic structure.

We looked to some materials and set the population in facilities approximately to the real number(which is as below)

Hospitals: 85m²/bed, 1 bed/3.7 patients

Parks: 67 people/acre

Schools: 135 sf/student

Libraries: 50sf/people

Gyms: 50sf/people

To visualize the behavior, we use the circles representing for realtime volume. The radius of the circles are in proportion to the volume, the bigger the volume is, the larger the circle would be. We could find out which group of people are most concentrated in which part of the city clearly.

Parameter

1. There are four different types of places of interest, and three different groups of people are in different ratio. If we assume that currently, the demographic structure of children, adults and elder is 1:1:1, then define the weight parameter, for example

Children Adult Elder

Park: x1 y1 z1

Then for example, every time generating an agent in a Park, the possibility of generating a child is x1/(x1+y1+z1);

2. Taking consideration of the change of demographic structure, if children, adults, elder are separately defined as a1, b1, c1, the:

Children Adult Elder

Park: x1*a1 y1*b1 z1*c1

3. Each kind of Facility has its own active ratio varies in different time. For example, the Park reaches the maximum density in 3 pm as Pmax, and reaches the minimum in 1 am as Pmin,

then when time changes, children in park generating parameter is clamped between x1*a1*Pmin and x1*a1*Pmax.

Work distribution:

Guangwei Ren: Scripts, logic-framework, Mapbox visulization, data;

Rui Wang: Mapbox site, research,diagram, visualization and logic revision;

Shuo Han: Visualization and UI, research, Evaluation of Facilities and scripts.

Scripts:

using System.Collections;using System.Collections.Generic;using UnityEngine;using UnityEngine.UI;public class GenerateAgent : MonoBehaviour{public float distance;public float totalagents=30;public float ratio1;public float ratio2;public float ratio3;public GameObject myPrefab1;public GameObject myPrefab2;public GameObject myPrefab3;public GameObject Density1;public GameObject Density2;public GameObject Density3;public Slider rr1;public Slider rr2;public Slider rr3;public int r1,r2,r3;private bool Generated=false;private float time=0;private List<GameObject> Instantiated=new List<GameObject>();private float temp1,temp2,temp3;private float k1=0,k2=0,k3=0;private float start1,start2,start3,starttotal,startdistance;private void Start(){start1=ratio1;start2=ratio2;start3=ratio3;starttotal=totalagents;startdistance=distance;}void Update(){temp1 = rr1.value;temp2 = rr2.value;temp3 = rr3.value;if(temp1!=k1||temp2!=k2||temp3!=k3){Generated=false;k1=temp1;k2=temp2;k3=temp3;}time +=Time.deltaTime;if (!Generated){ratio1=start1*k1/5;ratio2=start2*k2/5;ratio3=start3*k3/5;totalagents=starttotal*(ratio1+ratio2+ratio3)/(start1+start2+start3);distance=startdistance*Mathf.Sqrt((ratio1+ratio2+ratio3)/(start1+start2+start3));OnDisable();r1 = (int)(ratio1 / (ratio1 + ratio2 + ratio3) * totalagents);r2 = (int)(ratio2 / (ratio1 + ratio2 + ratio3) * totalagents);r3 = (int)(ratio3 / (ratio1 + ratio2 + ratio3) * totalagents);Vector3 Origin=Vector3.Scale(this.transform.position,new Vector3(1f,0,1f));for(int i=0;i<r1;i++){Instantiated.Add(GenerateAgent.Instantiate(myPrefab1,Origin+Random.Range(0,distance)*Vector3.Normalize(new Vector3(Random.Range(-1f,1f),0,Random.Range(-1f,1f)))+new Vector3(0,0.5f,0),Quaternion.identity));}for(int i=0;i<r2;i++){Instantiated.Add(GenerateAgent.Instantiate(myPrefab2,Origin+Random.Range(0,distance)*Vector3.Normalize(new Vector3(Random.Range(-1f,1f),0,Random.Range(-1f,1f)))+new Vector3(0,0.5f,0),Quaternion.identity));}for(int i=0;i<r3;i++){Instantiated.Add(GenerateAgent.Instantiate(myPrefab3,Origin+Random.Range(0,distance)*Vector3.Normalize(new Vector3(Random.Range(-1f,1f),0,Random.Range(-1f,1f)))+new Vector3(0,0.5f,0),Quaternion.identity));}GenerateDensity();Generated =true;}}private void GenerateDensity(){float visualizescale = 0.6f;GameObject D1=GenerateAgent.Instantiate(Density1,this.transform.position + new Vector3(0,0.5f,0),Quaternion.identity);D1.transform.localScale*=r1*visualizescale;Instantiated.Add(D1);GameObject lightGameObject1 = new GameObject("The Light");lightGameObject1.layer=9;Instantiated.Add(lightGameObject1);Light lightComp1 = lightGameObject1.AddComponent<Light>();lightComp1.color=Color.magenta;lightComp1.intensity=1.0f;lightComp1.range=r1;lightComp1.transform.position=D1.transform.position+new Vector3(0,5.0f,0);GameObject D2=GenerateAgent.Instantiate(Density2,this.transform.position + new Vector3(0,0.7f,0),Quaternion.identity);D2.transform.localScale*=r2*visualizescale;Instantiated.Add(D2);GameObject lightGameObject2 = new GameObject("The Light");lightGameObject2.layer=9;Instantiated.Add(lightGameObject2);Light lightComp2 = lightGameObject2.AddComponent<Light>();lightComp2.color=Color.blue;lightComp2.intensity=1.3f;lightComp2.range=r2;lightComp2.transform.position=D2.transform.position+new Vector3(0,3.0f,0);GameObject D3=GenerateAgent.Instantiate(Density3,this.transform.position + new Vector3(0,0.9f,0),Quaternion.identity);D3.transform.localScale*=r3*visualizescale;Instantiated.Add(D3);GameObject lightGameObject3 = new GameObject("The Light");lightGameObject3.layer=9;Instantiated.Add(lightGameObject3);Light lightComp3 = lightGameObject3.AddComponent<Light>();lightComp3.color=Color.yellow;lightComp3.intensity=1.1f;lightComp3.range=r3;lightComp3.transform.position=D3.transform.position+new Vector3(0,1.0f,0);}private void OnDisable(){for(int i=0;i<Instantiated.Count;i++){Destroy(Instantiated[i]);}}}using System.Collections;using System.Collections.Generic;using UnityEngine;public class FlyOver : MonoBehaviour{public float speed=1;// Update is called once per framevoid Update(){if(this.transform.position.z<191&&this.transform.position.x>=0)transform.Translate(new Vector3(0,0,1f)*Time.deltaTime*speed);if(this.transform.position.z>=191&&this.transform.position.x>-211)transform.Translate(new Vector3(-1f,0,0)*Time.deltaTime*speed);if(this.transform.position.x<=-211&&this.transform.position.z>0)transform.Translate(new Vector3(0,0,-1f)*Time.deltaTime*speed);if(this.transform.position.z<=0&&this.transform.position.x<0)transform.Translate(new Vector3(1f,0,0)*Time.deltaTime*speed);}}

--

--