routing icon indicating copy to clipboard operation
routing copied to clipboard

Question - Custom lua skipping to reduce filesize of routerdb

Open TomQv opened this issue 6 years ago • 7 comments

I want to create a Routerdb of Europe with reasonable filesize. Kind of "overland-Routing"

So I created a car-lua, which is not including highway=residential and highway=track in speed_profile-list.

Unfortunate this didn't reduce the filesize much, maybe only by 5% where I was expecting 50%, because residential and track makes more then 70% of all highways in osm.

Where am I wrong?

Ok, I could start with some osm-commandline tools, deleting this ways from the pbf, but I thought, this could also be done with a lua?

TomQv avatar Jun 29 '19 20:06 TomQv

Seems as if my test-pbf was too small (8mb) to see the effect. because of some overhead in routerdb. Using a 100mb pbf - now the difference is in deed 50%.

TomQv avatar Jun 30 '19 10:06 TomQv

@TomQv how did you modify the lua file to avoid residential and track?

I tried to remove the speed value from the speed_profile array whiteout success.

Thanks

alecava58 avatar Jul 16 '19 13:07 alecava58

There is even more to be gained by removing all edges that cannot be accessed. Now they are kept in case they get trough the initial filter.

The edges can be removed right after loading but before sorting the vertices.

xivk avatar Jul 16 '19 19:07 xivk

How?

TomQv avatar Jul 16 '19 19:07 TomQv

You would need to write a bit of custom code to check if all the profiles generate only values == 0 and remove those edges. Then compressing the database should remove the edges.

But I'm guessing that this will probably be worth just a few %...

xivk avatar Jul 16 '19 19:07 xivk

how did you modify the lua file to avoid residential and track?

Thats my only modification:

speed_profile = {
	["motorway"] = 120,        
	["motorway_link"] = 120,
	["trunk"] = 90,            
	["trunk_link"] = 90,
	["primary"] = 90,          
	["primary_link"] = 90,
	["secondary"] = 70,         
	["secondary_link"] = 70,
	["tertiary"] = 70,        
	["tertiary_link"] = 70,
	["unclassified"] = 50,     
    -- ["residential"] = 50,       
	["service"] = 30,
	["services"] = 30,
	["road"] = 30,
    -- ["track"] = 30,             
	["living_street"] = 5,
	["ferry"] = 5,
	["movable"] = 5,
	["shuttle_train"] = 10,
 	["default"] = 10
}

TomQv avatar Jul 16 '19 20:07 TomQv

I did the same without success. Likely I did a mistake.

AC

Il mar 16 lug 2019, 22:01 Tom Flemming [email protected] ha scritto:

how did you modify the lua file to avoid residential and track?

Thats my only modification:

speed_profile = { ["motorway"] = 120, ["motorway_link"] = 120, ["trunk"] = 90, ["trunk_link"] = 90, ["primary"] = 90, ["primary_link"] = 90, ["secondary"] = 70, ["secondary_link"] = 70, ["tertiary"] = 70, ["tertiary_link"] = 70, ["unclassified"] = 50, -- ["residential"] = 50, ["service"] = 30, ["services"] = 30, ["road"] = 30, -- ["track"] = 30, ["living_street"] = 5, ["ferry"] = 5, ["movable"] = 5, ["shuttle_train"] = 10, ["default"] = 10 }

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/itinero/routing/issues/273?email_source=notifications&email_token=AANUYQNB2CVKZW3KCTNX573P7YSH3A5CNFSM4H4LGH42YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2B7EVY#issuecomment-511963735, or mute the thread https://github.com/notifications/unsubscribe-auth/AANUYQMJSZT2QHBSHPULH5DP7YSH3ANCNFSM4H4LGH4Q .

alecava58 avatar Jul 17 '19 05:07 alecava58