Well, it turns out I had a couple of mistakes. First and most importantly I wasn’t really defining a closed form polygon (make sure to follow the right-hand rule, most usually)
tile_features = [Dict("type" => "Feature",
"properties" => Dict{String, Any}(),
"geometry" => Dict("type" => "Polygon",
"coordinates" => [
[
[grid["Lng"][i], grid["Lat"][j]],
[grid["Lng"][i], grid["Lat"][j+1]],
[grid["Lng"][i+1], grid["Lat"][j+1]],
[grid["Lng"][i+1], grid["Lat"][j]],
[grid["Lng"][i], grid["Lat"][j]]
]
])
)
for i in 1:grid["Eps"]-1, j in 1:grid["Eps"]-1]
And then I was able to turn it into a FeatureCollection object more properly by first
open("mad_grid.geojson", "w") do io
JSON3.pretty(io, fc)
end
And reading it back on memory
jsonbytes = read("mad_grid.geojson")
fc = GeoJSON.read(jsonbytes)
Seems like a roundabout way of doing things, so won’t mark as a solution just in case someone has a more direct way of achieving this
Oh I’m not married to it, but given that I don’t really know the ecosystem I chose it because it’s 100% Julia version a JS library by the same name (might as kill two birds with one stone type of thing… if I ever need the JS version ), its listed here: https://juliageo.org/, plus I thought it might be well tested.
I just need to do some spatial queries, like getting the area of the tiles above etc… I expect my FeatureCollection to get big so the above is not very efficient. What do you suggest?