-
Notifications
You must be signed in to change notification settings - Fork 94
Open
Description
Hiya!
I started using this library to transform results from GDAL ogr2ogr
CLI executions into structured GeoJSON.
I noticed that if a FeatureCollection
is passed into Geo.JSON.decode!/1
, it is returned as a %Geo.GeometryCollection{}
.
As an example, consider the following GeoJSON:
%{
"features" => [
%{
"geometry" => %{
"coordinates" => [
[
[-76.34699604768392, 36.33170421172728],
[-76.33589514587374, 36.332348509701035],
[-76.33512736015777, 36.32399799501997],
[-76.34610029768193, 36.32337940277699],
[-76.34699604768392, 36.33170421172728]
]
],
"type" => "Polygon"
},
"properties" => %{"id" => "567"},
"type" => "Feature"
},
%{
"geometry" => %{
"coordinates" => [
[
[-76.33554324408723, 36.3323227378844],
[-76.32210699405763, 36.33325051791261],
[-76.3202515119107, 36.325080519630006],
[-76.33487143158575, 36.32410109324975],
[-76.33554324408723, 36.3323227378844]
]
],
"type" => "Polygon"
},
"properties" => %{"id" => "456"},
"type" => "Feature"
},
%{
"geometry" => %{
"coordinates" => [
[
[-76.36231977093198, 36.33703883835424],
[-76.35771305663607, 36.337296540535085],
[-76.3571372173491, 36.331420718930794],
[-76.36174393164497, 36.331420718930794],
[-76.36231977093198, 36.33703883835424]
]
],
"type" => "Polygon"
},
"properties" => %{"id" => "234"},
"type" => "Feature"
},
%{
"geometry" => %{
"coordinates" => [
[
[-76.31868394940722, 36.31925532901004],
[-76.30972644938747, 36.32023481628918],
[-76.30793494938354, 36.3127594703222],
[-76.31702041368928, 36.31162521726675],
[-76.31868394940722, 36.31925532901004]
]
],
"type" => "Polygon"
},
"properties" => %{"id" => "123"},
"type" => "Feature"
}
],
"name" => "farm_fields",
"type" => "FeatureCollection"
}
Calling Geo.JSON.decode!
on this data will result in a %Geo.GeometryCollection{}
to be returned. The properties
are preserved in the Geo
structs – which is great – but won't be interpreted by other GeoJSON consumers (unless I'm misunderstanding here) because they're not technically part of the spec.
Is there a reason why there isn't first class FeatureCollection
support in Geo?
Metadata
Metadata
Assignees
Labels
No labels