koop-retired / koop-server

PROJECT DEPRECATED - DO NOT USE
Apache License 2.0
5 stars 7 forks source link

Mixed-Features in geoJSON are not supported (import to database fails) #32

Closed schlomm closed 8 years ago

schlomm commented 9 years ago

Hey, Firstly thanks a lot for this cool application. Unfortunately there is a bigger error using mixed-types geoJsons. For example: Using this geoJSON-gist , showing some sample countries of the world, won't be imported completely to the database. Koop fails to import all Multipolygons (multipolygons for this dataset are Italy, Japan, USA) with the following error:

error:  name=error, length=135, severity=ERROR, code=22023, detail=undefined, hint=undefined, position=undefined, internalPosition=undefined, internalQuery=undefined, where=undefined, file=gserialized_typmod.c, line=143, routine=postgis_valid_typmod

The first feature-Type for this geoJSON is Multi-Polygon.

Using this geoJSON-gist, koop fails to import all "normal" Poylgons.The first feature-Type for this geoJSON is Polygon. So...Depending on the feature-Type one or the other can not imported to the database.

chelm commented 9 years ago

Hey @schlomm yes this is a known issue and I might have a few changes I could make to get around it. The problem is that Esri's GeoServices REST doesnt have the concept of mixed geom types like GeoJSON.

I'll follow up with what I find.

schlomm commented 9 years ago

Hey @chelm. Thanks for your fast response :) If there is somehow a way to solve this issue, a workaround would be amazing. Currently I am dealing with many datasets, which include mixed geoJSON like the example I've mentioned in my first post, so the option of using the complete dataset via a "koop-FeatureService" would be awesome. Anyway....I am happy that I realized the fact that mixed geoJSONs causes the error. That took some time, because I have thought that there is something wrong with my setup.

chelm commented 9 years ago

So one route we talked about going is to split mixed geom geojson files into geom-based subsets. Again since a FeatureService only supports one geometry, you'll never get a single feature service to support points, lines, and polygons at the same time.

My thinking is that we somehow need to ease the restriction of geometry types in the DB and add a method in the URL to allows for accessing the various geom types.

The other work around would be just split the geojson files into seperate files for the time being. Either way, as featureservices they will always only have one type.

schlomm commented 9 years ago

Hey Chris, Thanks for your input! Apart from the general problem that mixed geo geojsons are currently not supported due to the limitations of the Esri's REST Interface: Would "a dirty fix" be somehow possible, which would split multipolygons into polygons and where the attributes remain the same? For my personal use case it would be awesome to get this running, and I've already tried to modify some lines in the corresponding PostGIS.js (which is as far as I see the right file), but I had no success. So...is it relatively easy to adapt the system for my use case? I've found a possible solution here on stackoverflow, but I am not sure on how to change in for the koop-system.

Maybe you had an idea or even a workaround?