readers/parking.rb
# Debug GeoJSON output:
# - for remapped, have lines from TfL to OSM
# - for TfL new, have points
# - for OSM only, have points
Debug GeoJSON output:
for remapped, have lines from TfL to OSM
for TfL new, have points
for OSM only, have points
Debug GeoJSON output : for remapped have lines from TfL to OSM for TfL new have points for OSM only have points
def crosses_road(lat1,lon1,lat2,lon2)
		sql = <<-SQL
		SELECT COUNT(*) AS ct
		FROM planet_osm_line
		WHERE highway IN ('trunk','trunk_link','primary','primary_link','secondary','secondary_link','tertiary','tertiary_link','unclassified','residential','pedestrian','living_street')
		AND ST_Intersects(way,ST_Transform(ST_SetSRID(ST_MakeLine(ST_MakePoint($1,$2),ST_MakePoint($3,$4)),4326),3857))
		SQL
		res = $conn.exec_params(sql,[lon1,lat1,lon2,lat2])
		ct  = res[0]['ct'].to_i
		if ct==0 then return false end
		if ct>1  then return true end
		sql = <<-SQL
		SELECT COUNT(*) AS ct
		FROM planet_osm_line
		WHERE highway IN ('trunk','trunk_link','primary','primary_link','secondary','secondary_link','tertiary','tertiary_link','unclassified','residential','pedestrian','living_street')
		AND ( ST_DWithin(way,ST_Transform(ST_SetSRID(ST_MakePoint($1,$2),4326),3857),2) OR
			  ST_DWithin(way,ST_Transform(ST_SetSRID(ST_MakePoint($3,$4),4326),3857),2) )
		SQL
		res = $conn.exec_params(sql,[lon1,lat1,lon2,lat2])
		ct  = res[0]['ct'].to_i
		if ct==1 then return false end
		true
	end
def crosses_road ( lat1 , lon1 , lat2 , lon2 ) sql = <<-SQL 
		SELECT COUNT(*) AS ct
		FROM planet_osm_line
		WHERE highway IN ('trunk','trunk_link','primary','primary_link','secondary','secondary_link','tertiary','tertiary_link','unclassified','residential','pedestrian','living_street')
		AND ST_Intersects(way,ST_Transform(ST_SetSRID(ST_MakeLine(ST_MakePoint($1,$2),ST_MakePoint($3,$4)),4326),3857))
		 SQL res = $conn . exec_params ( sql , [ lon1 , lat1 , lon2 , lat2 ] ) ct = res [ 0 ] [ 'ct' ] . to_i if ct == 0 then return false end if ct > 1 then return true end sql = <<-SQL 
		SELECT COUNT(*) AS ct
		FROM planet_osm_line
		WHERE highway IN ('trunk','trunk_link','primary','primary_link','secondary','secondary_link','tertiary','tertiary_link','unclassified','residential','pedestrian','living_street')
		AND ( ST_DWithin(way,ST_Transform(ST_SetSRID(ST_MakePoint($1,$2),4326),3857),2) OR
			  ST_DWithin(way,ST_Transform(ST_SetSRID(ST_MakePoint($3,$4),4326),3857),2) )
		 SQL res = $conn . exec_params ( sql , [ lon1 , lat1 , lon2 , lat2 ] ) ct = res [ 0 ] [ 'ct' ] . to_i if ct == 1 then return false end true end
Debug GeoJSON output:
 for remapped, have lines from TfL to OSM
 for TfL new, have points
 for OSM only, have points
Debug GeoJSON output : for remapped have lines from TfL to OSM for TfL new have points for OSM only have points
# Check to see if it crosses road # If either end is very close to the road, then that's a miss
lat1
<not_specific>
lon1
<not_specific>
lat2
<not_specific>
lon2
<not_specific>