Hi, I think that Run Datastore Query should also stay as a general SQL tool so that users can use exactly the same SQL in this tool, in PSQL command line or in pgAdmin SQL window and so on. It might be nice to have a spatial SQL query wizard with syntax highlight and help messages, menu for selecting the available db functions, possibility to save queries and query templates for future use etc. but I think it would be better to make another tool for that purpose and keep this existing tool simple.
However, the tool has already something that can't be copied into other SQL tools. The View, Fence and Selection buttons exist because they offer two extremely useful features: 1) It is very a common task to select features by view, by some rectangle or by selection and having these buttons make it much easier to build the SQL query. 2) When these buttons are used the reference geometries are used as variables instead of copying then into the query as WKT or something. Because of this the SQL Query layers can be refreshed. Basic use case is to make a layer as SELECT * FROM table WHERE attribute='something' AND geom && ${view:SRID} Now you can pan to another location on the map and do Right click - Database - Refresh Database Query and run the same base query again but now the current view is used in the spatial filter. Attach the menu item to some EZ Button and you can fire a new search with one button. Same thing with the fence or selection: draw a new fence or do a new selection, refresh the SQL Query layer and that's it. -Jukka Rahkonen- Uwe Dalluege wrote: > Hi Jukka, > > thank you for clarification! > > Uwe > > Am 10.04.2013 16:08, schrieb Rahkonen Jukka: > > Hi, > > > > It is just a general SQL query tool and you must, or you have a great > > opportunity, to add the test directly into your SQL. This might get > > what you want with PostGIS 2.x > > > > select st_intersection(...) AS geom ... FROM... > > WHERE ST_GeometryType(geom)='ST_Polygon"; > > > > -Jukka- > > > > > > Uwe Dalluege wrote: > >> > >> Hi Jukka, > >> > >> thank you very much for your help! > >> Now it works for me. > >> > >> But I receive two rows with > >> GEOMETRYCOLLECTION EMPTY information > >> in the OJ layer in my example. > >> > >> This selection produces empty geometries because it intersects only > >> one of three geometries. > >> > >> Is it possible to check if the geometry is empty and put it not to the OJ > layer? > >> > >> Uwe > >> Am 10.04.2013 15:25, schrieb Rahkonen Jukka: > >>> Uwe Dalluege wrote: > >>>> > >>>> Hi Jukka, > >>>> > >>>> thank you for this example. > >>>> Do you know whether this works? : > >>>> > >>>> select st_intersection ( geometry, ${fence:0} ) from "Bauernhof" > >>>> > >>>> The table "Bauernhof" contains a geometry-column called "geometry" > >>>> > >>> It works so that the resulting SQL for me looks like select > >>> ST_Intersection(geoloc,ST_GeomFromText('POLYGON > >> ((3424728.225608409 > >>> 6715639.342894198, 3424728.225608409 6715738.683124313, > >>> 3424855.5848777858 6715738.683124313, 3424855.5848777858 > >>> 6715639.342894198, 3424728.225608409 6715639.342894198))',-1)) from > >>> test_table; > >>> > >>> You can see that the rectangular geometry of the fence itself, not > >>> any > >> features inside it, is placed into the query. The number after ":" is > >> SRID, I used -1 in my case. The query itself gives an error when I > >> tested it directly with PSQL "found non-noded intersection > >> between...". OpenJUMP naturally cannot get a result and it is also > >> unable to show any reasonable error message, just a general > java.sql.SQLException. > >>> > >>> -Jukka- > >>> > >>>> Inside the fence there is a polygon intersects the geometry from > >>>> "Bauernhof" > >>>> But this does not work. > >>>> > >>>> 1. I do not see an error message. > >>>> 2. What is the 0 after fence: ? > >>>> > >>>> Regards > >>>> > >>>> uwe > >>>> > >>>> Am 10.04.2013 11:40, schrieb Rahkonen Jukka: > >>>>> Hi, > >>>>> > >>>>> They are helper shortcuts for adding a spatial filter into the query. > >>>>> The result will be something like select * from my_layer where > >>>>> geoloc && ${view:4326} > >>>>> > >>>>> Thus only features intersecting the view, box drawn with the fence > >>>>> tool or > >>>> total extents of the selected features will be selected. > >>>>> > >>>>> -Jukka Rahkonen- > >>>>> > >>>>> Uwe Dalluege wrote: > >>>>> > >>>>>> Hi, > >>>>>> > >>>>>> I like to describe the > >>>>>> function "Run Datastore Query" in my PostGIS tutorial but I can > >>>>>> not find a desciption of this. > >>>>>> What are the buttons > >>>>>> "View, Fence and Selection" good for? > >>>>>> > >>>>>> > >>>>>> Regards > >>>>>> > >>>>>> Uwe > >>>>>> > >>>>>> ----------------------------------------------------------------- > >>>>>> -- > >>>>>> -- > >>>>>> --------- Precog is a next-generation analytics platform capable > >>>>>> of advanced analytics on semi-structured data. The platform > >>>>>> includes APIs for building apps and a phenomenal toolset for data > science. > >>>>>> Developers can use our toolset for easy data analysis & > >>>>>> visualization. Get a free account! > >>>>>> http://www2.precog.com/precogplatform/slashdotnewsletter > >>>>>> _______________________________________________ > >>>>>> Jump-pilot-devel mailing list > >>>>>> Jump-pilot-devel@lists.sourceforge.net > >>>>>> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel > >>>>> > >>>>> ------------------------------------------------------------------ > >>>>> -- > >>>>> -- > >>>>> -------- Precog is a next-generation analytics platform capable of > >>>>> advanced analytics on semi-structured data. The platform includes > >>>>> APIs for building apps and a phenomenal toolset for data science. > >>>>> Developers can use our toolset for easy data analysis & visualization. > >>>>> Get a free account! > >>>>> http://www2.precog.com/precogplatform/slashdotnewsletter > >>>>> _______________________________________________ > >>>>> Jump-pilot-devel mailing list > >>>>> Jump-pilot-devel@lists.sourceforge.net > >>>>> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel > >>>>> > >>> > >>> -------------------------------------------------------------------- > >>> -- > >>> -------- Precog is a next-generation analytics platform capable of > >>> advanced analytics on semi-structured data. The platform includes > >>> APIs for building apps and a phenomenal toolset for data science. > >>> Developers can use our toolset for easy data analysis & visualization. > >>> Get a free account! > >>> http://www2.precog.com/precogplatform/slashdotnewsletter > >>> _______________________________________________ > >>> Jump-pilot-devel mailing list > >>> Jump-pilot-devel@lists.sourceforge.net > >>> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel > >>> > > > > ---------------------------------------------------------------------- > > -------- Precog is a next-generation analytics platform capable of > > advanced analytics on semi-structured data. The platform includes APIs > > for building apps and a phenomenal toolset for data science. > > Developers can use our toolset for easy data analysis & visualization. > > Get a free account! > > http://www2.precog.com/precogplatform/slashdotnewsletter > > _______________________________________________ > > Jump-pilot-devel mailing list > > Jump-pilot-devel@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel > > ------------------------------------------------------------------------------ Precog is a next-generation analytics platform capable of advanced analytics on semi-structured data. The platform includes APIs for building apps and a phenomenal toolset for data science. Developers can use our toolset for easy data analysis & visualization. Get a free account! http://www2.precog.com/precogplatform/slashdotnewsletter _______________________________________________ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel