-
Notifications
You must be signed in to change notification settings - Fork 1
Convert OD long to wide format
mtbeek32 edited this page Jan 7, 2023
·
5 revisions
If you would create a full OD with a Dijkstra algorithm, you will get the result in a long data format. This is often not convenient when exporting to other applications. The following piece of code can be helpful in converting that output into a wide date format. The following code could be inserted in the Dijkstra unit:
attribute<string> impedance_min := string(round(impedance / 60f)); //Convert the impedance from seconds to minutes, round it off, and store it as a string value. unit<uint32> Matrix_Array := org { attribute<string> org_name := org/name; attribute<string> impedance_min_list := AsList(impedance_min, ';', OrgZone_rel); } unit<uint32> Header : nrofrows = 1 { attribute<string> dest_name := AsList(dest/name, ';', const(0[Header],dest)); } unit<uint32> Matrix_met_header := union_unit(Header, Matrix_Array) //This unit can easily be exported to csv and used in other applications. { attribute<string> org_name := union_data(., const('',Header), Matrix_Array/org_name); attribute<string> values := union_data(., Header/dest_name, Matrix_Array/impedance_min_list); }
GeoDMS ©Object Vision BV. Source code distributed under GNU GPL-3. Documentation distributed under CC BY-SA 4.0.