Skip to content

Commit 5d45dfb

Browse files
committed
replace ArchGDAL with GeoInterface
1 parent 8df4d38 commit 5d45dfb

File tree

4 files changed

+8
-11
lines changed

4 files changed

+8
-11
lines changed

Project.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ authors = ["Jack Chan <[email protected]>"]
44
version = "0.1.19"
55

66
[deps]
7-
ArchGDAL = "c9ce4bd3-c3d5-55b8-8973-c0e20141b8c3"
87
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
98
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
109
GeoInterface = "cf35fbd7-0cd7-5166-be24-54bfbe79505f"

src/LightOSM.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ using HTTP
1313
using JSON
1414
using LightXML
1515
using DataFrames
16-
using ArchGDAL: createmultilinestring, createlinestring, createpoint, addgeom!
16+
using GeoInterface
1717
using RecipesBase
1818

1919
export GeoLocation,

src/geodataframes.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
coordinates(node::Node) = node.location.lon, node.location.lat
1+
coordinates(node::Node) = [node.location.lon, node.location.lat]
22

33
function node_gdf(g::OSMGraph)
44
ids = collect(keys(g.nodes))
55
geom = map(ids) do id
66
coordinates(g.nodes[id])
77
end
8-
return DataFrame(;id=ids, geom=createpoint.(geom))
8+
return DataFrame(;id=ids, geom=Point.(geom))
99
end
1010

1111
function highway_gdf(g::OSMGraph)
@@ -14,15 +14,15 @@ function highway_gdf(g::OSMGraph)
1414
coordinates(g.nodes[id])
1515
end
1616
geom = map(id -> _way_coordinates(g.highways[id]), ids)
17-
return DataFrame(;id=ids, geom=createlinestring.(geom))
17+
return DataFrame(;id=ids, geom=LineString.(geom))
1818
end
1919

2020
function node_gdf(sg::SimplifiedOSMGraph)
2121
ids = collect(keys(sg.node_to_index))
2222
geom = map(ids) do id
2323
coordinates(sg.parent.nodes[id])
2424
end
25-
return DataFrame(;id=ids, geom=createpoint.(geom))
25+
return DataFrame(;id=ids, geom=Point.(geom))
2626
end
2727

2828
highway_gdf(sg::SimplifiedOSMGraph) = highway_gdf(sg.parent)
@@ -34,5 +34,5 @@ function edge_gdf(sg::SimplifiedOSMGraph)
3434
reverse.(sg.parent.node_coordinates[path])
3535
end
3636
u, v, key = map(i -> getindex.(edge_ids, i), 1:3)
37-
return DataFrame(;u, v, key, geom=createlinestring.(geom))
37+
return DataFrame(;u, v, key, geom=LineString.(geom))
3838
end

src/plotrecipes.jl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
function aspect_ratio(g::OSMGraph)
22
max_y, min_y = extrema(first, g.node_coordinates)
3-
mid_y = max_y/2 + min_y/2
3+
mid_y = (max_y + min_y)/2
44
return 1/cos(mid_y * pi/180)
55
end
66
aspect_ratio(sg::SimplifiedOSMGraph) = aspect_ratio(sg.parent)
@@ -9,7 +9,5 @@ aspect_ratio(sg::SimplifiedOSMGraph) = aspect_ratio(sg.parent)
99
RecipesBase.@recipe function f(g::AbstractOSMGraph)
1010
color --> :black
1111
aspect_ratio --> aspect_ratio(g)
12-
highways = createmultilinestring()
13-
addgeom!.(Ref(highways), highway_gdf(g).geom)
14-
return highways
12+
MultiLineString(GeoInterface.coordinates.(highway_gdf(g).geom))
1513
end

0 commit comments

Comments
 (0)