Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
pszufe committed Nov 19, 2023
1 parent 92c8436 commit 1d6cfd5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "OSMToolset"
uuid = "a1c25ae6-0f93-4b3a-bddf-c248cb99b9fa"
authors = ["pszufe <[email protected]> and contributors"]
version = "0.1.1"
version = "0.1.2"

[deps]
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
Expand Down
6 changes: 5 additions & 1 deletion src/poi.jl
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,11 @@ function find_poi(filename::AbstractString; scrape_config::ScrapePOIConfig{T}=__
relations_firstnode = Dict{Int, Node}()
elemtype = :X
elemid = -1
df= DataFrame()
# creates an empty data frame
df = DataFrame(;elemtype=Symbol[], elemid=Int[],nodeid=Int[],lat=Float64[],lon=Float64[],
key=String[], value=String[],
(NamedTupleTools.fieldnames(T) .=> [Vector{ftype}() for ftype in NamedTupleTools.fieldtypes(T)])... )

io = open(filename, "r")
sr = EzXML.StreamReader(io)
i = 0
Expand Down
7 changes: 7 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,18 @@ end

config = DataFrame(key=["parking", "amenity"], values=["*", "parking"])
df2 = find_poi(test_map; scrape_config=ScrapePOIConfig{NoneMetaPOI}(config))
df3 = find_poi(test_map; scrape_config=ScrapePOIConfig{NoneMetaPOI}(DataFrame(key=String[], values=String[])))
df4 = find_poi(test_map; scrape_config=ScrapePOIConfig{NoneMetaPOI}(DataFrame(key=["does not exist<!"], values=["*"])))

# each parking space has an attractiveness range od 300 meters
sindex2 = AttractivenessSpatIndex{NoneMetaPOI}(df2; get_range=a->300, get_group=a->:parking);

@testset "CustomConfig" begin
@test nrow(df2) > 0
@test nrow(df3) == 0
@test nrow(df4) == 0
@test df2[1:0,:] == df3
@test df2[1:0,:] == df4
@test all(df2.key .∈ Ref(["amenity", "parking"]))
att2 = attractiveness(sindex2, lla; aggregator= x -> length(x)==0 ? 0 : maximum(x), calculate_attractiveness = (a,dist) -> dist > 300 ? 0 : 300/dist )
@test fieldnames(att2) == (:parking,)
Expand Down

2 comments on commit 1d6cfd5

@pszufe
Copy link
Owner Author

@pszufe pszufe commented on 1d6cfd5 Nov 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/95587

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.1.2 -m "<description of version>" 1d6cfd5910b4274dac8f7ce9a7370e86091f1efa
git push origin v0.1.2

Please sign in to comment.