Merge branch 'lost_work_rural_urban' into rural_urban
This commit is contained in:
commit
1ad5fe562e
|
@ -1,7 +1,7 @@
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import _ from 'lodash'
|
import _ from 'lodash'
|
||||||
import {connect} from 'react-redux'
|
import {connect} from 'react-redux'
|
||||||
import {List, Select, Input, Divider, Checkbox, Header} from 'semantic-ui-react'
|
import {List, Select, Input, Divider, Label, Checkbox, Header} from 'semantic-ui-react'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
MapConfig,
|
MapConfig,
|
||||||
|
@ -23,6 +23,7 @@ const ROAD_ATTRIBUTE_OPTIONS = [
|
||||||
{value: 'distance_overtaker_median', key: 'distance_overtaker_median', text: 'Overtaker distance median'},
|
{value: 'distance_overtaker_median', key: 'distance_overtaker_median', text: 'Overtaker distance median'},
|
||||||
{value: 'overtaking_event_count', key: 'overtaking_event_count', text: 'Event count'},
|
{value: 'overtaking_event_count', key: 'overtaking_event_count', text: 'Event count'},
|
||||||
{value: 'usage_count', key: 'usage_count', text: 'Usage count'},
|
{value: 'usage_count', key: 'usage_count', text: 'Usage count'},
|
||||||
|
{value: 'zone', key: 'zone', text: 'Overtaking distance zone'}
|
||||||
]
|
]
|
||||||
|
|
||||||
function LayerSidebar({
|
function LayerSidebar({
|
||||||
|
@ -96,6 +97,13 @@ function LayerSidebar({
|
||||||
<ColorMapLegend map={_.chunk(colorByCount('obsRoads.maxCount', mapConfig.obsRoads.maxCount, viridisSimpleHtml ).slice(3), 2)} twoTicks />
|
<ColorMapLegend map={_.chunk(colorByCount('obsRoads.maxCount', mapConfig.obsRoads.maxCount, viridisSimpleHtml ).slice(3), 2)} twoTicks />
|
||||||
</List.Item></>
|
</List.Item></>
|
||||||
) :
|
) :
|
||||||
|
attribute.endsWith('zone') ? (
|
||||||
|
<>
|
||||||
|
<List.Item>
|
||||||
|
<Label size="small" style={{background: "blue",color:"white"}}>urban (1.5 m)</Label>
|
||||||
|
<Label size="small" style={{background: "cyan", color:"black"}}>rural (2 m)</Label>
|
||||||
|
</List.Item></>
|
||||||
|
) :
|
||||||
(
|
(
|
||||||
<List.Item>
|
<List.Item>
|
||||||
<span style={{color: "olive"}}>Urban</span>
|
<span style={{color: "olive"}}>Urban</span>
|
||||||
|
@ -123,9 +131,9 @@ function LayerSidebar({
|
||||||
{showEvents && (
|
{showEvents && (
|
||||||
<>
|
<>
|
||||||
<List.Item>
|
<List.Item>
|
||||||
<span style={{color: "olive"}}>Urban</span>
|
<span style={{color: "blue"}}>Urban</span>
|
||||||
<DiscreteColorMapLegend map={colorByDistance('distance_overtaker')[3][5].slice(2)} />
|
<DiscreteColorMapLegend map={colorByDistance('distance_overtaker')[3][5].slice(2)} />
|
||||||
<span style={{color: "brown"}}>Rural</span>
|
<span style={{color: "cyan"}}>Rural</span>
|
||||||
<DiscreteColorMapLegend map={colorByDistance('distance_overtaker')[3][3].slice(2)} />
|
<DiscreteColorMapLegend map={colorByDistance('distance_overtaker')[3][3].slice(2)} />
|
||||||
</List.Item>
|
</List.Item>
|
||||||
</>
|
</>
|
||||||
|
|
|
@ -34,7 +34,7 @@ const LABELS = {
|
||||||
max: 'Maximum',
|
max: 'Maximum',
|
||||||
mean: 'Average',
|
mean: 'Average',
|
||||||
}
|
}
|
||||||
const ZONE_COLORS = {urban: 'olive', rural: 'brown', motorway: 'purple'}
|
const ZONE_COLORS = {urban: 'blue', rural: 'cyan', motorway: 'purple'}
|
||||||
const CARDINAL_DIRECTIONS = ['north', 'north-east', 'east', 'south-east', 'south', 'south-west', 'west', 'north-west']
|
const CARDINAL_DIRECTIONS = ['north', 'north-east', 'east', 'south-east', 'south', 'south-west', 'west', 'north-west']
|
||||||
const getCardinalDirection = (bearing) =>
|
const getCardinalDirection = (bearing) =>
|
||||||
bearing == null
|
bearing == null
|
||||||
|
|
|
@ -54,6 +54,8 @@ const getRoadsLayer = (colorAttribute, maxCount) =>
|
||||||
? colorByDistance(colorAttribute)
|
? colorByDistance(colorAttribute)
|
||||||
: colorAttribute.endsWith('_count')
|
: colorAttribute.endsWith('_count')
|
||||||
? colorByCount(colorAttribute, maxCount)
|
? colorByCount(colorAttribute, maxCount)
|
||||||
|
: colorAttribute.endsWith('zone')
|
||||||
|
? borderByZone()
|
||||||
: '#DDD'
|
: '#DDD'
|
||||||
draft.paint['line-opacity'][3] = 12
|
draft.paint['line-opacity'][3] = 12
|
||||||
draft.paint['line-opacity'][5] = 13
|
draft.paint['line-opacity'][5] = 13
|
||||||
|
@ -67,8 +69,6 @@ const getEventsLayer = () => ({
|
||||||
paint: {
|
paint: {
|
||||||
'circle-radius': ['interpolate', ['linear'], ['zoom'], 14, 3, 17, 8],
|
'circle-radius': ['interpolate', ['linear'], ['zoom'], 14, 3, 17, 8],
|
||||||
'circle-color': colorByDistance('distance_overtaker'),
|
'circle-color': colorByDistance('distance_overtaker'),
|
||||||
'circle-stroke-color': borderByZone(),
|
|
||||||
'circle-stroke-width':['interpolate', ['linear'], ['zoom'], 14, 1, 17, 4],
|
|
||||||
},
|
},
|
||||||
minzoom: 11,
|
minzoom: 11,
|
||||||
})
|
})
|
||||||
|
|
|
@ -11,7 +11,8 @@ type RoadAttribute =
|
||||||
| "distance_overtaker_max"
|
| "distance_overtaker_max"
|
||||||
| "distance_overtaker_median"
|
| "distance_overtaker_median"
|
||||||
| "overtaking_event_count"
|
| "overtaking_event_count"
|
||||||
| "usage_count";
|
| "usage_count"
|
||||||
|
| "zone";
|
||||||
|
|
||||||
export type MapConfig = {
|
export type MapConfig = {
|
||||||
baseMap: {
|
baseMap: {
|
||||||
|
|
|
@ -61,6 +61,8 @@ local roads = osm2pgsql.define_way_table('road', {
|
||||||
{ column = 'oneway', type = 'bool' },
|
{ column = 'oneway', type = 'bool' },
|
||||||
})
|
})
|
||||||
|
|
||||||
|
local minspeed_rural = 60
|
||||||
|
|
||||||
function osm2pgsql.process_way(object)
|
function osm2pgsql.process_way(object)
|
||||||
if object.tags.highway and contains(HIGHWAY_TYPES, object.tags.highway) then
|
if object.tags.highway and contains(HIGHWAY_TYPES, object.tags.highway) then
|
||||||
local tags = object.tags
|
local tags = object.tags
|
||||||
|
@ -92,7 +94,11 @@ function osm2pgsql.process_way(object)
|
||||||
zone = "urban"
|
zone = "urban"
|
||||||
elseif contains(MOTORWAY_TYPES, tags.highway) then
|
elseif contains(MOTORWAY_TYPES, tags.highway) then
|
||||||
zone = "motorway"
|
zone = "motorway"
|
||||||
elseif (tags.maxspeed) and (tonumber(string.match(tags.maxspeed, '[%d]*'))) and tonumber(string.match(tags.maxspeed, '[%d]*')) > 60 then
|
elseif (tags.maxspeed) and (tonumber(string.match(tags.maxspeed, '[%d]*'))) and tonumber(string.match(tags.maxspeed, '[%d]*')) > minspeed_rural then
|
||||||
|
zone = "rural"
|
||||||
|
elseif (tags["maxspeed:forward"]) and (tonumber(string.match(tags["maxspeed:forward"], '[%d]*'))) and tonumber(string.match(tags["maxspeed:forward"], '[%d]*')) > minspeed_rural then
|
||||||
|
zone = "rural"
|
||||||
|
elseif (tags["maxspeed:backward"]) and (tonumber(string.match(tags["maxspeed:backward"], '[%d]*'))) and tonumber(string.match(tags["maxspeed:backward"], '[%d]*')) > minspeed_rural then
|
||||||
zone = "rural"
|
zone = "rural"
|
||||||
elseif tags['source:maxspeed'] and string.match(tags['source:maxspeed'], "rural") then
|
elseif tags['source:maxspeed'] and string.match(tags['source:maxspeed'], "rural") then
|
||||||
zone = "rural"
|
zone = "rural"
|
||||||
|
|
Loading…
Reference in a new issue