GeoTools

GeoJSON parser and builder

Details

  • Type: New Feature New Feature
  • Status: Resolved Resolved
  • Priority: Minor Minor
  • Resolution: Duplicate
  • Affects Version/s: 2.4.4
  • Fix Version/s: None
  • Component/s: data
  • Labels:
    None
  • Environment:
    Mac OS X v. 10.5.4, JVM 1.5.
  • Testcase included:
    yes

Description

This is the beginning of a GeoJSON parser and builder. The parser takes GeoJSON and parses it into Geometry and Feature objects. The builder takes Java geometry objects and writes out their GeoJSON string representations. GeoJSONBuilder was written by Chris Holmes and has been brought over from its package in GeoServer (org.geoserver.wfs.response.GeoJSONBuilder).

GeoJSONParser will correctly parse basic geometry objects (Point, LineString, Polygon, and their multi versions), as well as GeometryCollections. It will also parse features and feature collections, however, non-required attributes in the GeoJSON object won't be converted. The crs and bbox attributes are also not yet implemented.

This uses the json-lib library: http://json-lib.sourceforge.net/

Activity

Hide
Alexey Noskov added a comment -
I attached diff for pom.xml, which adds maven dependency from json-lib.
Show
Alexey Noskov added a comment - I attached diff for pom.xml, which adds maven dependency from json-lib.
Hide
Alexey Noskov added a comment -
Modification of GeoJSONBuilder to write features and feature collections
Show
Alexey Noskov added a comment - Modification of GeoJSONBuilder to write features and feature collections
Hide
Andrea Aime added a comment -
Wondering what this is about. Like, it's not really a datastore. How does it fit within GeoTools?
Also wondering how it's related to the GeoServer GeoJSON output format.
Show
Andrea Aime added a comment - Wondering what this is about. Like, it's not really a datastore. How does it fit within GeoTools? Also wondering how it's related to the GeoServer GeoJSON output format.
Hide
Jesse Eichar added a comment -
I don't think it has to be a datastore it is a transfer protocol. I have needed it a few times because I write several servers that send features to clients and to other servers. It makes sense to me to have this in Geotools as a peer to the GML parsers/writers.

I saw Justin has started an unsupported extension similar to this as well. I think one of the two should be part of geotools.

Show
Jesse Eichar added a comment - I don't think it has to be a datastore it is a transfer protocol. I have needed it a few times because I write several servers that send features to clients and to other servers. It makes sense to me to have this in Geotools as a peer to the GML parsers/writers. I saw Justin has started an unsupported extension similar to this as well. I think one of the two should be part of geotools.
Hide
Andrea Aime added a comment -
Adding Justin as a watcher of this issue. Justin, how is your work related to Nicholas one, is there a potential for merger, is there anything either of the two implementation does better?
Show
Andrea Aime added a comment - Adding Justin as a watcher of this issue. Justin, how is your work related to Nicholas one, is there a potential for merger, is there anything either of the two implementation does better?
Hide
Justin Deoliveira added a comment -
Definitely seems to be some overlap. Not sure about the merger... the stuff in geotools unsupported/geojson uses a different json library. http://code.google.com/p/json-simple/. Which I chose because of its emphasis on streaming and performance.

As far as completeness goes i parses and encodes all geometry objects, features, and feature collections. With crs and bounding box information included.
Show
Justin Deoliveira added a comment - Definitely seems to be some overlap. Not sure about the merger... the stuff in geotools unsupported/geojson uses a different json library. http://code.google.com/p/json-simple/. Which I chose because of its emphasis on streaming and performance. As far as completeness goes i parses and encodes all geometry objects, features, and feature collections. With crs and bounding box information included.
Hide
Andrea Aime added a comment -
Closing, as far as I can see the module in unsupported is the one that is going to stay (at least that's what happened in the last 3 years since this ticket was opened)
Show
Andrea Aime added a comment - Closing, as far as I can see the module in unsupported is the one that is going to stay (at least that's what happened in the last 3 years since this ticket was opened)

People

Vote (3)
Watch (4)

Dates

  • Created:
    Updated:
    Resolved: