Skip to content

Commit

Permalink
Create README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
mayconbordin committed Jul 24, 2015
1 parent 24e3d20 commit f9294b2
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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 `<repositories>` list in the `pom.xml` file:

```xml
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
```

Then add the dependency to your `pom.xml` file:

```xml
<dependency>
<groupId>com.github.mayconbordin</groupId>
<artifactId>postgis-geojson</artifactId>
<version>1.0</version>
</dependency>
```

## 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);
```

0 comments on commit f9294b2

Please sign in to comment.