-
Notifications
You must be signed in to change notification settings - Fork 12
Description
I wanted to start by saying thank you to the maintainers of this package for all their hard work. As a Julia user with some experience, I found this package to be really useful, but I did encounter a few areas where the documentation could be improved from a user perspective.
I had a few issues when trying to create a Point (but also would have had them with the other geometry types). The documentation mentions these types, but it's not entirely clear how to create them. For example, I had to dig into the source code to figure out that I needed to create a Point like this: GeoJSON.Point(coordinates=(lon, lat)). As someone familiar with Julia, I eventually realised that this is consistent with how structs are typically constructed in Julia, but I can imagine that it might not be immediately obvious to users who are new to the language or the package. I think it would be really helpful to have some examples in the documentation on how to create these geometries, which would make it easier for users to get started with the package.
I also had an issue with the 'properties' keyword in the Feature type. The documentation says it should be a Union{Nothing,Dict{String,Any}}, but when I tried to create a Dict with string keys, I got an error. It turns out that the keys need to be Symbols, like this: props = Dict(:name => name, :locality => locality). I think it would be helpful to note this in the documentation, maybe I made a mistake or maybe this is a bug? Here is the error code just in case:
# with
# props = Dict(
# "name" => name,
# "locality" => locality
# )
# it returns:
ERROR: LoadError: MethodError: Cannot `convert` an object of type String to an object of type Symbol
The function `convert` exists, but no method is defined for this combination of argument types.
Closest candidates are:
Symbol(::String)
@ Core boot.jl:618
Symbol(::AbstractString)
@ Base strings/basic.jl:228
Symbol(::Any...)
@ Base strings/basic.jl:229
...
Stacktrace:
[1] setindex!(h::Dict{Symbol, Any}, v0::String, key0::String)
@ Base ./dict.jl:346
[2] Dict{Symbol, Any}(kv::Dict{String, String})
@ Base ./dict.jl:94
[3] convert
@ ./abstractdict.jl:574 [inlined]
[4] convert
@ ./some.jl:37 [inlined]
[5] Feature
@ ~/.julia/packages/GeoJSON/0SijB/src/geojson_types.jl:170 [inlined]
[6] #Feature#24
@ ~/.julia/packages/GeoJSON/0SijB/src/geojson_types.jl:173 [inlined]
[7] top-level scope
@ /workspaces/julia/parse_stations.jl:21
in expression starting at /workspaces/julia/parse_stations.jl:8
Finally, I found it a bit tricky to create a Feature or FeatureCollection. I think it would be really helpful to have some examples in the documentation on how to create these types, including any required constructors.
I hope these suggestions are helpful. I'm really grateful for this package and I think with a few tweaks to the documentation, it could be even more beginner-friendly. Thanks again to the maintainers for all their hard work!
If there's anything I can do to help with implementing these changes or improving the documentation, please let me know.