1

I generated a JSON by a PHP script and now want to load this JSON to GeoServer. So far I just found ways to publish SHP files but not JSON...

3
  • 1
    Do you want to load JSON into GeoServer (i.e. use it as a data source), or publish (Geo)JSON, they are different things.
    – nmtoken
    Commented Feb 5, 2021 at 17:16
  • I want to load JSON into GeoServer with the overall goal to provide it via WFS
    – jonsken
    Commented Feb 5, 2021 at 18:15
  • You don't need to have to load JSON into GeoServer to serve it out as JSON though. GeoServer can convert from multiple formats to multiple formats. So if you have a shapefile as datasource you can through WFS serve it out as JSON
    – nmtoken
    Commented Feb 8, 2021 at 10:04

1 Answer 1

2

GeoTools (which provides the underlying data management for GeoServer) has an unsupported GeoJsonDatastore (gt-geojsonstore) which would allow you to publish GeoJson files via GeoServer if you drop the jar file into the WEB-INF/lib folder.

But it would be very slow and would lack the nice GUI of a finished data plugin. GeoJSON is better suited as a transfer format rather than a storage format so you would be better off using QGis or ogr2ogr to convert it into a better format such as GeoPackage or load it into a database.

3
  • my overall goal is to provide the data via a WFS (no visualization). Do you recommend to convert the format for this case as well? I was already thinking about ogr2ogr/QGis/GDAL but I was not sure how to realise it because it should be able to run on a server more or less on its own
    – jonsken
    Commented Feb 5, 2021 at 18:28
  • I added the jar to the WEB-INF/lib folder, but there is no new data store in the GeoServer data store menu... I used the jar from this address: https://mvnrepository.com/artifact/org.geotools/gt-geojsondatastore/24.2 - Did I miss something out?
    – jonsken
    Commented Feb 6, 2021 at 16:05
  • GeoJSON does not support any indexes. But if the amount of data is small or your WFS users do not use spatial filters (including BBOX) or attribute filters then GeoJSON may be usable.
    – user30184
    Commented Feb 7, 2021 at 20:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.