readers/tfl_common.rb
# Put in a generic 'identify island' routine:
#	- length should be similar
#	- length should be short (<60)
#	- either one cycleway and 1+ oneway, or 2+ oneways
#	- oneway shouldn't be the same angle (i.e. 2x oneway with same angle don't count)
Put in a generic 'identify island' routine:
length should be similar
length should be short (<60)
either one cycleway and 1+ oneway, or 2+ oneways
oneway shouldn't be the same angle
Put in a generic ' identify island ' routine : length should be similar length should be short ( <60 ) either one cycleway and 1 + oneway or 2 + oneways oneway shouldn ' t be the same angle
def island(ways)
		ways.each do |w|
			next unless ROADS.include?(w[:tags]['highway'])
			next unless w[:tags]['oneway']=='yes'
			next unless w[:length]<60
			puts "i2"
			ways.each do |v|
				next if v==w
				next unless v[:length]<90
				if v[:tags]['highway']=='cycleway' then return true end
				next unless ROADS.include?(v[:tags]['highway'])
				next unless v[:tags]['oneway']=='yes'
				dir = [v[:angle],w[:angle]].max - [v[:angle],w[:angle]].min
				if dir>2.8 && dir<3.5 then return true end
				if dir<0.4 || dir>5.9 then return true end
			end
		end
		ways.each do |w|
			next unless w[:tags]['highway']=='cycleway'
			next unless w[:length]<90
			ways.each do |v|
				next if v==w
				next unless ROADS.include?(v[:tags]['highway'])
				dir = [v[:angle],w[:angle]].max - [v[:angle],w[:angle]].min
				if dir>2.8 && dir<3.5 then return true end
				if dir<0.4 || dir>5.9 then return true end
			end
		end
		false
	end
def island ( ways ) ways . each do | w | next unless ROADS . include? ( w [ :tags ] [ 'highway' ] ) next unless w [ :tags ] [ 'oneway' ] == 'yes' next unless w [ :length ] < 60 puts "i2" ways . each do | v | next if v == w next unless v [ :length ] < 90 if v [ :tags ] [ 'highway' ] == 'cycleway' then return true end next unless ROADS . include? ( v [ :tags ] [ 'highway' ] ) next unless v [ :tags ] [ 'oneway' ] == 'yes' dir = [ v [ :angle ] , w [ :angle ] ] . max - [ v [ :angle ] , w [ :angle ] ] . min if dir > 2.8 && dir < 3.5 then return true end if dir < 0.4 || dir > 5.9 then return true end end end ways . each do | w | next unless w [ :tags ] [ 'highway' ] == 'cycleway' next unless w [ :length ] < 90 ways . each do | v | next if v == w next unless ROADS . include? ( v [ :tags ] [ 'highway' ] ) dir = [ v [ :angle ] , w [ :angle ] ] . max - [ v [ :angle ] , w [ :angle ] ] . min if dir > 2.8 && dir < 3.5 then return true end if dir < 0.4 || dir > 5.9 then return true end end end false end
Put in a generic 'identify island' routine:
 length should be similar
 length should be short (<60)
 either one cycleway and 1+ oneway, or 2+ oneways
 oneway shouldn't be the same angle (i.e.
Put in a generic ' identify island ' routine : length should be similar length should be short ( <60 ) either one cycleway and 1 + oneway or 2 + oneways oneway shouldn ' t be the same angle ( i . e .
# for each oneway road way of <60m: # - can we find another oneway road way of similar length/direction? # - or can we find a cycleway of similar length/direction? # for each cycleway of <90m, can we find another road way (of any length) with oneway in the opposite direction?
ways
<not_specific>