Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow properties to be added to Geo types #74

Closed
jerel opened this issue Aug 2, 2017 · 7 comments
Closed

Allow properties to be added to Geo types #74

jerel opened this issue Aug 2, 2017 · 7 comments
Assignees
Milestone

Comments

@jerel
Copy link

jerel commented Aug 2, 2017

Is there a PostGIS (or other) limitation that would prevent us from adding properties to the Geo structs?

For example it would be very nice to be able to do the following:

%Geo.Point{coordinates: {1, 1}, properties: %{time: "12:01"}}
|> Geo.JSON.encode()
@bryanjos
Copy link
Contributor

bryanjos commented Aug 3, 2017

There is no limitation that would prevent that. It would just be ignored unless used by something like the Geo.JSON module. I think adding properties is fine.

If another request for adding a GeoJSON specific item comes up, I'm leaning towards making something that follows the spec exactly that wraps around the Geo structs.

@larsbutler
Copy link

@jerel

Is there a PostGIS (or other) limitation that would prevent us from adding properties to the Geo structs?

The GeoJSON RFC states that "FeatureCollection and Geometry objects, respectively, MUST NOT contain a "geometry" or "properties" member." This came up in a discussion I had with one of the RFC authors.

It seems that the general theme here is a lack of support for metadata. Your cases is pretty custom, but there are some cases where metadata is vital to retaining information when converting between formats (GeoJSON to/from EWKT/EWKB, for example). Relevant issues:

I would really like to see some official guidance for how to include metadata/extensions in the GeoJSON schema. I'll have to go and do a bit of research.

@niahoo
Copy link

niahoo commented Oct 4, 2017

Hi,

That's exactly what the Feature geojson type is for. It has two members, geometry and properties.

FeatureCollection has only one member (besides type) : features :: [Feature].

{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "properties": {
        "name": "Hanoi",
        "month_notes": [2, 2, 3, 4, 3, 2, 2, 2, 3, 4, 5, 3],
        "location": "Hanoi, Vietnam",
        "country": "vietnam"
      },
      "geometry": {
        "type": "Point",
        "coordinates": [
          105.8341598,
          21.0277644
        ]
      }
    },
    ...

Any plans to implement it ?

@bryanjos
Copy link
Contributor

I've been thinking about this a lot and I think instead of trying to shoehorn geojson features into the geometry types, maybe it would be cleaner to create struct(s) around geojson itself. Maybe that's a better direction to move towards

@niahoo
Copy link

niahoo commented Jan 29, 2018

But this is not stoehorning, the Feature type exists for this sole purpose : have geometry and properties in one entity ...

@bryanjos
Copy link
Contributor

Looking at the spec and thinking on it a bit, I think adding properties to the types should be fine.

@bryanjos bryanjos added this to the Geo 3.0 milestone Mar 11, 2018
@bryanjos bryanjos self-assigned this Apr 12, 2018
@bryanjos
Copy link
Contributor

Fixed in 4647ed3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants