openjump-gis / openjump

OpenJUMP, the Open Source GIS with more than one trick in its kangaroo pocket, takes the leap from svn to git. join the effort!
http://openjump.org
GNU General Public License v2.0
28 stars 14 forks source link

DataStoreDataSource does not read extent of gpkg table #47

Open jratike80 opened 2 years ago

jratike80 commented 2 years ago

If a table from a geopackage is added into the map so that no features in the gpkg table intersect with the map view, it is impossible to zoom to the layer and find the data with Zoom to layer. The only workaroud that I have invented so far is to run a database query from the same layer as "select * from layer limit 1" for getting something to zoom to.

Extent is usually available in the table "gpkg_contents", in the fields "min_x", "min_y", "max_x", "max_y". Also field "srs_id" could be useful.

mukoki commented 2 years ago

Nice workaround Jukka. It is probably possible to use min_x, min_y, max_x, max_y as suggested, once we know we are reading a gpkg database and not a pure spatialite one. One small drawback I can see is that if the data table is very big, the first thing OpenJUMP will do is to try to load everything and throw an OOME. I think this problem is not specific to spatialite and that postgis driver behaviour has currently the same limitation.

edeso commented 2 years ago

One small drawback I can see is that if the data table is very big, the first thing OpenJUMP will do is to try to load everything and throw an OOME.

we could do a COUNT first and have the user limit request manually if a configurable number of features (to prevent RAM outage) is exceeded.