Comments (4)
@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.
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.
Thanks for pointing that out. Will probably have to make some changes here, but not sure exactly what just yet
from geo.
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)
- is .tool-versions necessary? HOT 1
- Support for `Feature` and `FeatureCollection` to Geo.JSON HOT 2
- Geo.WKB and raw binaries HOT 5
- GeoJSON default SRID not set HOT 1
- The new 'Feature' does not retain the SRID property when encoding HOT 1
- Flatten GeometryCollection into non-complex geometries HOT 1
- Add box2d type HOT 1
- Unable to decode WKB of MultiLineString with no coordinates
- ArgumentError in Geo.WKB.Encoder.do_encode/2(geo 3.4.2) HOT 2
- Multi Linestring with 'EMPTY' in the point throwing error HOT 3
- GeoJSON coordinates are not check nor converted to a numeric value
- Fix handling of GeoJSON Z and M coordinates HOT 1
- Feature GeoJSON with Geometry object of type GeometryCollection is not supported HOT 2
- Feature object with null geometry is not supported HOT 2
- Addition of Circle Geometry HOT 1
- Move Ecto specific code to geo_ecto HOT 7
- Improve WKB and WKT encoder/decoder HOT 1
- Using geometry types with sqlite_ecto2 HOT 2
- Issue parsing geometry HOT 2
- Geo.JSON does not support PointZ HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from geo.