-
-
Notifications
You must be signed in to change notification settings - Fork 38
Add a general Marshal and Unmarshal function to geojson package. #113
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
Conversation
Pull Request Test Coverage Report for Build 514
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
// mapping between JSON and geom Geometry values are described in | ||
// the documentation for the Marshal and Unmarshal functions. | ||
// | ||
// At current this pacakge only supports 2D Geometries unless stated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
package is misspelled as 'pacakge'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also, change 'stated otherwise' to 'otherwise stated'
LGTM. No need to include extended geometries since they are not include in the GeoJSON standard. |
* Added additional information about package to main README.md file. * Documented the errors and rearranged code for error.go to make it easier to read the code.
* Added pacakge documentation with references to appropriate RFC. * Improved documentation for methods.
* Added a general Marshal function to the geojson package to make using the package easier. Currently you have to write a geom Geometry object with a geojson Geometry object and then a Feature object. This is ugly. The new Marshal function will take care of the wrapping as needed. * Added a general MarshalIndent function that behaves like Marshal, but returns and indented version of the geojson.
* Add an Unmarshal function to the top level of geojson, to allow simpler unmarshalling of geojson Features and FeatureCollections.
The current way of using the
geojson
package requires one to wrap a geometry several times.This PR introduces three new methods to simplify using the package.
Marshal
-- which will take any geom.Geometry, or slice of geom.Geometries, or ageojson.Feature
, or ageojson.FeatureCollection
and return ageojson
encoded version of it, or an error.MarshalIndent
is the same as Marshal, returning a pretty version of the output insteadUnmarshal
which will take an encodedgeojson
byte slice, and return either ageojson.Feature
, or ageojson.FeatureCollection
.@gbroccolo could you give this a review as well. Thank you.