Skip to content

Latest commit

 

History

History
81 lines (55 loc) · 2.11 KB

Orientation.md

File metadata and controls

81 lines (55 loc) · 2.11 KB

orientation

This script renders a polar histogram of roads orientation within any city. The size of the bar in this histogram shows total length of roads in the direction of the bar. See more scripts here

usage

To initialize it, load a city in the city-roads, and enter the following command in the developer console.

let city = await requireModule('city-script');

The city object is your access point to all the scripts in the current repository.

city.orientation(options?)

city.orientation();

This will render a default histogram:

default histogram

Once the histogram is loaded, you can click on it. When border border is dotted - you can drag it around. When the border is solid - you can click on any area in the circle, to highlight matching roads.

Holding shift key adds slices to collection. Holding alt key inverts the selection. You can then open customize window to hide original roads or change colors. Here is how Seattle looks like if you remove all South-North and East-West roads:

no major roads

API

You can control stroke width and color:

city.orientation({
  strokeWidth: 2,        // make borders thicker
  strokeColor: '#2288ff' // and make them blue
});

stroke control

To adjust the radius of the inner circle, pass the r variable:

city.orientation({
  r: 80 // The inner circle radius 
})

inner circle radius

To change the width of the outer circle, pass the width variable:

city.orientation({
  width: 84 // The outer circle width
})

outer circle width

Finally, to change number of buckets, pass the count variable:

city.orientation({
  count: 42
})

count of buckets

like what you see?

Play with your city here: https://anvaka.github.io/city-roads