GithubHelp home page GithubHelp logo

`srid` in GeoJSON output about geo HOT 4 CLOSED

larsbutler avatar larsbutler commented on July 25, 2024
`srid` in GeoJSON output

from geo.

Comments (4)

bryanjos avatar bryanjos commented on July 25, 2024

@larsbutler Geo puts it in the crs section which is part of the geojson spec as far as I can tell, but we are probably not using it correctly in Geo: http://geojson.org/geojson-spec.html#coordinate-reference-system-objects

I know there is also the properties field. Would it not work there either?

from geo.

larsbutler avatar larsbutler commented on July 25, 2024

Ah, I misinterpreted the output; I thought you were putting the srid in an srid member like so:

{"type": "Point", "coordinates": [30, 90], "srid": "4326"}

But now I see that it's placed in a crs object:

iex(1)> import Geo
Geo
iex(2)> import Poison
Poison
iex(3)> point = Geo.WKB.decode("0101000020E61000009EFB613A637B4240CF2C0950D3735EC0")
%Geo.Point{coordinates: {36.9639657, -121.8097725}, srid: 4326}
iex(4)> Geo.JSON.encode(point) |> Poison.encode!  
"{\"type\":\"Point\",\"crs\":{\"type\":\"name\",\"properties\":{\"name\":\"EPSG4326\"}},\"coordinates\":[36.9639657,-121.8097725]}"

Geo puts it in the crs section which is part of the geojson spec as far as I can tell, but we are probably not using it correctly in Geo.

It does seem that the crs section was removed from the official spec, according to https://tools.ietf.org/html/rfc7946#section-4. I wouldn't say your usage is incorrect, though. Because the spec doesn't say anything specific, we can just do whatever we want. :) It would be nice to have some standardization, though; I'm a bit frustrated with the lack of specificity in the spec, to be honest.

I know there is also the properties field. Would it not work there either?

There is no properties in a Geometry object. In fact, the spec explicitly states that Geometry objects must not contain a properties object. :/ Therefore, I think your approach of including a crs object is the most correct approach, since it follows http://geojson.org/geojson-spec.html#coordinate-reference-system-objects. Even though the CRS spec there is obsolete, it's better than nothing.

from geo.

bryanjos avatar bryanjos commented on July 25, 2024

Thanks for pointing that out. Will probably have to make some changes here, but not sure exactly what just yet

from geo.

larsbutler avatar larsbutler commented on July 25, 2024

Hey @bryanjos, even though your approach uses a deprecated (but documented--in the old geojson spec) approach and there is no new spec to replace it, I think we can close this issue. For consistency I will follow your approach in geomet.

Thanks for the discussion!

from geo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.