@@ -52,9 +52,8 @@ if hstore and hstore_all then
5252end
5353
5454-- Used for splitting up long linestrings
55- if srid == 4326 then
56- max_length = 1
57- else
55+ local max_length = 1
56+ if srid == 3857 then
5857 max_length = 100000
5958end
6059
@@ -320,8 +319,8 @@ local non_point_columns = {
320319 ' wood' ,
321320}
322321
323- function gen_columns (text_columns , with_hstore , area , geometry_type )
324- columns = {}
322+ local function gen_columns (text_columns , with_hstore , area , geometry_type )
323+ local columns = {}
325324
326325 local add_column = function (name , type )
327326 columns [# columns + 1 ] = { column = name , type = type }
@@ -412,11 +411,11 @@ local z_order_lookup = {
412411 motorway = {39 , true }
413412}
414413
415- function as_bool (value )
414+ local function as_bool (value )
416415 return value == ' yes' or value == ' true' or value == ' 1'
417416end
418417
419- function get_z_order (tags )
418+ local function get_z_order (tags )
420419 local z_order = 100 * math.floor (tonumber (tags .layer or ' 0' ) or 0 )
421420 local roads = false
422421
@@ -447,7 +446,7 @@ function get_z_order(tags)
447446 return z_order , roads
448447end
449448
450- function make_check_in_list_func (list )
449+ local function make_check_in_list_func (list )
451450 local h = {}
452451 for _ , k in ipairs (list ) do
453452 h [k ] = true
465464local is_polygon = make_check_in_list_func (polygon_keys )
466465local clean_tags = osm2pgsql .make_clean_tags_func (delete_keys )
467466
468- function make_column_hash (columns )
467+ local function make_column_hash (columns )
469468 local h = {}
470469
471470 for _ , k in ipairs (columns ) do
@@ -475,7 +474,7 @@ function make_column_hash(columns)
475474 return h
476475end
477476
478- function make_get_output (columns , hstore_all )
477+ local function make_get_output (columns )
479478 local h = make_column_hash (columns )
480479 if hstore_all then
481480 return function (tags )
@@ -511,10 +510,10 @@ end
511510
512511local has_generic_tag = make_check_in_list_func (generic_keys )
513512
514- local get_point_output = make_get_output (point_columns , hstore_all )
515- local get_non_point_output = make_get_output (non_point_columns , hstore_all )
513+ local get_point_output = make_get_output (point_columns )
514+ local get_non_point_output = make_get_output (non_point_columns )
516515
517- function get_hstore_column (tags )
516+ local function get_hstore_column (tags )
518517 local len = # hstore_column
519518 local h = {}
520519 for k , v in pairs (tags ) do
@@ -561,7 +560,7 @@ function osm2pgsql.process_node(object)
561560 tables .point :insert (output )
562561end
563562
564- function add_line (output , geom , roads )
563+ local function add_line (output , geom , roads )
565564 for sgeom in geom :segmentize (max_length ):geometries () do
566565 output .way = sgeom
567566 tables .line :insert (output )
0 commit comments