Hi, I made a commit (r4609) adding Spatial databases support for MySQL/MariaDB and Spatialite.
Some points concerning this commit: • FilterQuery and Adhoc queries are supported for all spatial databases • When a wrong WHERE clause is added to a datasource, SQL error is displayed and layer is removed from Panel(*) • Added some icons according to connection type and status: [image: Inline images 1] • MariaDB: supports WKB and natives binary types, (thanks to code from Larry Reeder) • Spatialite: supports Spatialite binary type, WKB and WKT, supports several geometry_column metadata table layout. • Spatialite database file can be choosen with a FileChooser instead of classic server/dbname/user/pwd fields, as they are not relevant for Spatialite: [image: Inline images 2] Microsoft® SQL Server support should come soon. (*) Michaël & ede: To manage SQL errors when adding a database layer, I modified ImageCacheRenderer: this is actually here the error is detected (and by default, only a warning is issued, which is fine: sometime, FeatureCollection returns a NoSuchFeatureException because of an extent error, and in this case, the layer should be added to the LayerPanel). AFAIU, when choosing a layer from a datastore, the OJ Layer is added to the panel, then a separate thread tries to load the Features. This thread triggers the actual SQL code for the layer. Instead of testing the layer each time a WHERE clause is added/modified, I chose to catch the SQLException in ImageCacheRenderer thread, then I remove the layer from the Panel. In case of other error types, layer is added to the Panel. Nicolas On 13 December 2015 at 12:20, <edgar.sol...@web.de> wrote: > the functionally correct approach of course would be adding the layer only > after the request went trough fine. you can create layers and feature > collections and throw them away if it wont work out. > > ..ede > > On 13.12.2015 00:17, Nicolas Ribot wrote: > > Yes good idea, I will add a test before loading a layer. > > > > Nicolas > > > > On 12 December 2015 at 20:22, Michaël Michaud < > m.michael.mich...@orange.fr <mailto:m.michael.mich...@orange.fr>> wrote: > > > > Hi Nicolas, > > > > Thanks for your answer. > > > > Just one idea about the problem Jukka has mentionned : > > Maybe the query should be tested before the Layer is created. > > A way to do that would be to add (or replace) the LIMIT clause with > value 0 to have a lightweight query > > giving the opportunity to catch a SQLException. > > May not be the cleanest way to solve the problem though (several > classes to patch). > > > > Michaël > > > > Le 12/12/2015 16:31, Nicolas Ribot a écrit : > >> Hi Michaël, > >> > >> Thanks for the insight. > >> > >> I'm currently refactoring a bit the SpatialDatabases code. > >> The error you pointed out showed me some problems with current > code, and as you noted, I have to instantiate a correct, concrete class for > each detected DSConnection. > >> > >> I'm finalising my todo list, but right now, FilterQuery and > AdhocQuery can be ran on Postgis, Oracle, MySQL and Spatialite databases > the same way. > >> > >> I'm currently finishing the support for Spatialite, that can be > tricky: geometry column can contain WKT, WKB or native Spatialite binary > format. Still have to correct the ValueConvert to correctly detect and > convert each type. > >> > >> MySQL support is added with support for both WKB storage, internal > binary storage (code from DBQuery). > >> Layer extent is now correctly retrieved but has to be tested on big > datasets (it merely uses a textual aggregation of all geometries to build > the resulting envelope). > >> > >> I think I will be able to commit fixes soon. > >> > >> I'm stuck, though, on the problem Jukka mentioned: if you add a > wrong where clause to the layer to load, error is detected in the > com.vividsolutions.jump.workbench.ui.renderer.ImageCachingRenderer( line > 90) where the error message is displayed in Window toolbar. > >> I can display an ErrorDialog with SQL error, but do not know how to > cleanly remove the layer from the panel. > >> > >> Nicolas > >> > >> > >> On 12 December 2015 at 15:29, Michaël Michaud < > m.michael.mich...@orange.fr <mailto:m.michael.mich...@orange.fr>> wrote: > >> > >> Hi Nicolas, > >> > >> I had a look but did not find an easy way to fix the problem. > >> > >> In SpatialDatabasesDSConnection you added a comment that it is > no more necessary to subclass to PostGIS... > >> > >> On the other hand, > >> - SpatialDatabasesDSConnection instantiates > >> - SpatialDatabasesResultSetConverter which in turn instantiates > >> - SpatialDatabasesFeatureInputStream which instantiates > >> - SpatialDatabasesResultSetConverter which instiates a new > >> - SpatialDatabasesValueConverterFactory > >> > >> The getConverter method of the later just return null which > seems the root cause > >> of my NPE. > >> > >> Seems like the concrete class should still be a subclass of > SpatialDatabasesDSConnection. > >> What do you think ? > >> > >> Another (maybe related) question : In the component to connect > a new database, there > >> is a combobox with a single value "PostGIS". Should we add > other drivers in order to > >> instantiate proper connection for each driver. There is > commented code from you in > >> JumpConfiguration class showing that you already have > implemented such a solution > >> in the past) > >> > >> Michaël > >> > >> > >> Le 08/12/2015 10:30, Nicolas Ribot a écrit : > >>> Hi Michaël, > >>> > >>> I will look at it. > >>> > >>> Nicolas > >>> > >>> On 7 December 2015 at 23:12, Michaël Michaud <<mailto: > m.michael.mich...@orange.fr>m.michael.mich...@orange.fr <mailto: > m.michael.mich...@orange.fr>> wrote: > >>> > >>> Hi > >>> > >>> Waw, thanks for this refactoring Nicolas ! > >>> > >>> Just noticed the following regression > >>> > >>> in the File > Execute Query plugin > >>> If I try to query a postgis table as I did before, I get > the following NPE : > >>> java.lang.NullPointerException > >>> at > com.vividsolutions.jump.datastore.spatialdatabases.SpatialDatabasesResultSetConverter.init(SpatialDatabasesResultSetConverter.java:72) > >>> > >>> The same NPE occurs with the read/write postgis driver > >>> > >>> Any idea ? > >>> > >>> Michaël > >>> > >>> > >>> Le 07/12/2015 18:16, Nicolas Ribot a écrit : > >>>> Hi, > >>>> > >>>> Oracle Spatial support has been added to OJ core > (read-only). > >>>> It works the same way as Postgis support: define a DB > connection to Oracle and choose spatial layers from the list of found > layers to display them in OJ > >>>> > >>>> Oracle 9i -> 12c supported (though only tested recently > with Oracle 11i and 12c). > >>>> > >>>> The SpatialDatabases plugin also contains code to support > MariaDB/MySQL and Spatialite. (SQL Server in the pipe...) > >>>> > >>>> I was thinking about adding this code to the core, too. > >>>> What do you think ? > >>>> > >>>> Nicolas > >>>> > >>>> > >>>> > >>>> > >>>> > > ------------------------------------------------------------------------------ > >>>> Go from Idea to Many App Stores Faster with Intel(R) XDK > >>>> Give your users amazing mobile app experiences with > Intel(R) XDK. > >>>> Use one codebase in this all-in-one HTML5 development > environment. > >>>> Design, debug & build mobile apps & 2D/3D high-impact > games for multiple OSs. > >>>> > http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140 > >>>> > >>>> > >>>> _______________________________________________ > >>>> Jump-pilot-devel mailing list > >>>> Jump-pilot-devel@lists.sourceforge.net <mailto: > Jump-pilot-devel@lists.sourceforge.net> > >>>> > https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel > >>> > >>> > >>> > > ------------------------------------------------------------------------------ > >>> Go from Idea to Many App Stores Faster with Intel(R) XDK > >>> Give your users amazing mobile app experiences with > Intel(R) XDK. > >>> Use one codebase in this all-in-one HTML5 development > environment. > >>> Design, debug & build mobile apps & 2D/3D high-impact > games for multiple OSs. > >>> > http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140 > >>> _______________________________________________ > >>> Jump-pilot-devel mailing list > >>> Jump-pilot-devel@lists.sourceforge.net <mailto: > Jump-pilot-devel@lists.sourceforge.net> > >>> > https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel > >>> > >>> > >>> > >>> > >>> > > ------------------------------------------------------------------------------ > >>> Go from Idea to Many App Stores Faster with Intel(R) XDK > >>> Give your users amazing mobile app experiences with Intel(R) > XDK. > >>> Use one codebase in this all-in-one HTML5 development > environment. > >>> Design, debug & build mobile apps & 2D/3D high-impact games > for multiple OSs. > >>> > http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140 > >>> > >>> > >>> _______________________________________________ > >>> Jump-pilot-devel mailing list > >>> Jump-pilot-devel@lists.sourceforge.net <mailto: > Jump-pilot-devel@lists.sourceforge.net> > >>> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel > >> > >> > >> > > ------------------------------------------------------------------------------ > >> > >> _______________________________________________ > >> Jump-pilot-devel mailing list > >> Jump-pilot-devel@lists.sourceforge.net <mailto: > Jump-pilot-devel@lists.sourceforge.net> > >> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel > >> > >> > >> > >> > >> > > ------------------------------------------------------------------------------ > >> > >> > >> _______________________________________________ > >> Jump-pilot-devel mailing list > >> Jump-pilot-devel@lists.sourceforge.net <mailto: > Jump-pilot-devel@lists.sourceforge.net> > >> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel > > > > > > > > ------------------------------------------------------------------------------ > > > > _______________________________________________ > > Jump-pilot-devel mailing list > > Jump-pilot-devel@lists.sourceforge.net <mailto: > Jump-pilot-devel@lists.sourceforge.net> > > https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel > > > > > > > > > > > ------------------------------------------------------------------------------ > > > > > > > > _______________________________________________ > > Jump-pilot-devel mailing list > > Jump-pilot-devel@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel > > > > > ------------------------------------------------------------------------------ > _______________________________________________ > Jump-pilot-devel mailing list > Jump-pilot-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel >
------------------------------------------------------------------------------
_______________________________________________ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel