Everything is solved when i use srid:3857 as my main srid and it also gives me a nice Mercator projection. I will wait for st_intersects to support spatialindex before i will use h2gis professionally. Anyway don't forget to check out my project for some nice (very basic) cartography:
https://github.com/ffk27/h2gisviewer Op donderdag 17 maart 2016 14:53:02 UTC+1 schreef Bernd Lauert: > > Boudningbox and srid should be the same. This is currently my code. > > com.vividsolutions.jts.geom.Polygon bboxG = new > GeometryFactory().createPolygon(new Coordinate[]{new > Coordinate(minX,maxY),new Coordinate(maxX,maxY),new Coordinate(maxX,minY),new > Coordinate(minX,minY),new Coordinate(minX,maxY)}); > bboxG.setSRID(28992); > String bbox = "ST_Transform(?," + laag.getSrid() + ")"; > String query = "SELECT count(*) FROM " + laag.getName() + " WHERE " + > geometry_column + " && "+bbox+" AND ST_Intersects("+geometry_column+", > "+bbox+");"; > PreparedStatement stmt = ((JDBCLayer) > laag).getConnection().prepareStatement(query); > stmt.setObject(1,bboxG); > stmt.setObject(2,bboxG); > > > > > Op woensdag 16 maart 2016 09:13:01 UTC+1 schreef Nicolas Fortin (OrbisGIS): >> >> Hi, >> >> I don't think your bounding box and the geometry CRS are the same in your >> query. >> >> You should also use rs.getObject("the_geom"), it returns a jts Geometry >> object. The same way for prepared statements parameters you should use >> setObject(p, myBBox) >> >> Regards, >> >> Nicolas FORTIN >> >> H2GIS team member >> >> Développeur d’applications - AI >> Laboratoire d’Acoustique Environnementale (LAE) >> Ifsttar Nantes, Route de Bouaye, CS 4, 44344 Bouguenais Cedex >> >> >> Le mardi 15 mars 2016 18:57:16 UTC+1, Bernd Lauert a écrit : >>> >>> Thank you, >>> >>> I discovered that when i'm only using srid:4326 layers there are no >>> problems at all and its working perfect. When i add a srid:28992 layer as >>> first layer my 4326 layers are 1 at 30 times not displayed. When i use my >>> srid:28992 layers as last layer it works 9 at 10 times but that one time >>> when it doesen't work one of my 4326 layer is gone or all the 4326 layers >>> are gone. Also the h2gis i get when i use orbisgis maven h2gis-dist seems a >>> little bit more stable then the zip from h2gis.org. I will keep >>> experimenting and give updates. >>> >>>> >>>> -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/h2-database. For more options, visit https://groups.google.com/d/optout.
