uoa-ems-research / JEMSS.jl

Julia package for Emergency Medical Services Simulation
Apache License 2.0
13 stars 4 forks source link

get_vertices in convert_osm_network not defined #76

Open elgloli opened 5 months ago

elgloli commented 5 months ago

Hello Sam,

Im trying to use JEMSS for the city Hamburg and downloaded a osm file and removed non-road objects via osmconvert. Next I wanted to calculate road arc travel times and write to csv via your run.jl code. I got this error:

ERROR: UndefVarError: get_vertices not defined Stacktrace: [1] readOsmNetworkFile(osmFilename::String; levels::Set{Int64}, boundsLLA::Nothing) @ Main ~/.julia/packages/JEMSS/M2vZd/tools/network/convert_osm_network.jl:57

I think the function osm.getvertices in convert_osm_network.jl code is not part of the package OpenStreetMapX anymore. Do you have a solution for that issue?

Thank you in advance and best regards. Elias

samridler commented 5 months ago

Hi Elias,

I've made an attempt at updating the code, can you try the run.jl script (along with convert_osm_network.jl and graph_tools.jl in the same folder) from this zip file convert_osm_network.zip. Please let me know if there are errors, if not I'll then use this code to update the package.

elgloli commented 4 months ago

Hey Sam, thanks for the fast reply.

I got this error now: Dividing arcs ... done. Checking which nodes (of 140138) are inside border ERROR: UndefVarError: linearrings not defined

I have another general question..: I got for hamburg the same data and put it in the same folder structure as the other cities in the data folder. Next step is to create a road file with run.jl and if I don't have my own data for calls, I use the call configuration file. Are there any other steps to take?

I appreciate your help and thank you for your work and the code you provided.

samridler commented 4 months ago

Ah, I see I changed a variable name at the last moment causing the linearrings not defined error, here's the fixed script convert_osm_network.zip.

Once you have all the data and files set up like in a data/cities/[city]/models folder then copy one of the sim_config.xml files like in the example/input folder and make sure the <inputPath> and <simFiles> point to your data (though ignore <rNetTravels> as that will be generated). Then try load and run the simulation and if that doesn't work let me know.

elgloli commented 4 months ago

Hey Sam, fyi your script is working perfectly now..

I tried to run the simulation for hamburg, but I think my grid for the population density is not correct. I got this error: Loading sim. ERROR: AssertionError: 1 <= ix && (ix <= grid.nx && (1 <= iy && iy <= grid.ny)) Stacktrace: [1] locationToGridIndex(map::Map, grid::Grid, location::Location) @ JEMSS ~/.julia/packages/JEMSS/M2vZd/src/types/grid.jl:27 [2] findNearestNode(map::Map, grid::Grid, nodes::Vector{Node}, location::Location) @ JEMSS ~/.julia/packages/JEMSS/M2vZd/src/types/grid.jl:51 [3] initCalls!(sim::Simulation, calls::Vector{Call}) @ JEMSS ~/.julia/packages/JEMSS/M2vZd/src/types/call.jl:97 [4] setSimReps!(sim::Simulation, callSets::Vector{Vector{Call}}) @ JEMSS ~/.julia/packages/JEMSS/M2vZd/src/replication.jl:23 [5] initSim(configFilename::String; allowResim::Bool, createBackup::Bool, allowWriteOutput::Bool, doPrint::Bool) @ JEMSS ~/.julia/packages/JEMSS/M2vZd/src/run_config.jl:201 [6] initSim(configFilename::String) @ JEMSS ~/.julia/packages/JEMSS/M2vZd/src/run_config.jl:35

How and with which programm (QGIS?) did you create such a grid?

samridler commented 4 months ago

Hey Elias, It could be the population density file or maybe the map.csv file, if the map file you linked before is what you are currently using then it needs to be changed as that was for New York, see here for how to set the contents of the map file. As for the population density file, I used QGIS to create them, first saving the shapefile with population density information in the WGS84 format then using rasterize functionality to create the raster file.