I am creating a Java web service that receives GeoJSON.
Does anyone know a java library to manage GeoJSON?
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.
Sign up to join this communityI am creating a Java web service that receives GeoJSON.
Does anyone know a java library to manage GeoJSON?
Geotools as a support for geojson. See here.
Otherwise, you could simply use a typical JSON parser (such as json-simple) together with the geoJSON spec, which is really easy to use.
The best solution depends on what you want to do with the parsed information.
To parse or deserialize geojson in Java REST webservice, i prefere to use geojson-jackson , which integrate itself very nicely with jackson.
Another alternative is GeoGson, which is built on top of Google's Gson:
Geometry geometry = new GsonBuilder()
.registerTypeAdapterFactory(new GeometryAdapterFactory())
.create()
.fromJson("{\"type\":\"Point\",\"coordinates\": [23.5,20.125]}");