From f9294b2f279ca9b707c778a05bd5d7819ac1527c Mon Sep 17 00:00:00 2001 From: Maycon Viana Bordin Date: Fri, 24 Jul 2015 10:57:13 -0300 Subject: [PATCH] Create README.md --- README.md | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..c09d520 --- /dev/null +++ b/README.md @@ -0,0 +1,62 @@ +# postgis-geojson + +GeoJSON Jackson Serializers and Deserializers for PostGIS Geometry objects. + +## GeoJSON Support + +This library gives support for serialization/deserialization of all [Geometry Objects](http://geojson.org/geojson-spec.html#geometry-objects) defined +in the GeoJSON specification. + +The relation between GeoJSON geometry objects and PostGIS objects is given below: + +GeoJSON | PostGIS +------------------| ------------- +[Point](http://geojson.org/geojson-spec.html#point)| [Point](http://postgis.refractions.net/documentation/javadoc/org/postgis/Point.html) +[MultiPoint](http://geojson.org/geojson-spec.html#multipoint)| [MultiPoint](http://postgis.refractions.net/documentation/javadoc/org/postgis/MultiPoint.html) +[LineString](http://geojson.org/geojson-spec.html#linestring)| [LineString](http://postgis.refractions.net/documentation/javadoc/org/postgis/LineString.html) +[MultiLineString](http://geojson.org/geojson-spec.html#multilinestring)| [MultiLineString](http://postgis.refractions.net/documentation/javadoc/org/postgis/MultiLineString.html) +[Polygon](http://geojson.org/geojson-spec.html#polygon)| [Polygon](http://postgis.refractions.net/documentation/javadoc/org/postgis/Polygon.html) +[MultiPolygon](http://geojson.org/geojson-spec.html#multipolygon)| [MultiPolygon](http://postgis.refractions.net/documentation/javadoc/org/postgis/MultiPolygon.html) +[GeometryCollection](http://geojson.org/geojson-spec.html#geometry-collection)| [GeometryCollection](http://postgis.refractions.net/documentation/javadoc/org/postgis/GeometryCollection.html) + +## Installation + +Add the JitPack repository to your `` list in the `pom.xml` file: + +```xml + + jitpack.io + https://jitpack.io + +``` + +Then add the dependency to your `pom.xml` file: + +```xml + + com.github.mayconbordin + postgis-geojson + 1.0 + +``` + +## Usage + +First you need to register the library module within the `ObjectMapper` instance you are going to use: + +```java +ObjectMapper mapper = new ObjectMapper(); +mapper.registerModule(new PostGISModule()); +``` + +The you can serialize objects: + +```java +String json = mapper.writeValueAsString(new Point(125.6, 10.1)); +``` + +And deserialize them: + +```java +Point point = (Point) mapper.readValue(json, Geometry.class); +```