Is this a geotools bug?
When creating a layer from a table the strike_location geography binding is correctly identified by the org.geotools.jdbc.JDBCFeatureSource class as com.vividsolutions.jts.geom.Point. This happens because the SQLDialect subclass org.geotools.data.postgis.PostGisDialect is called to determine the mapping
dialect.getMapping(columns, cx) is called, this method looks up the geography_columns in geography_columns table.
In the SQL view case the sqlType is 1111 but the binding is null. There is different logic to retrieve the binding it uses
dialect.registerSqlTypeNameToClassMappings(sqlTypeNameToClassMappings) but this hashmap doesn't have a mapping for the "geography" type.
This seems like a geotools bug, and from my quick look at the trunk it doesn't look like it has been fixed.
So any suggestions for known good versions of geotools/geoserver to try?
The reason I need this functionality is to allow me to publish a layer where users can do spatial and time based queries, sending the time parameter into the SQL view would let me achieve that. Open to work arounds...
Thanks,
Josh
________________________________________
From: Joshua Groom [Joshua.Groom@anonymised.com]
Sent: Tuesday, 6 March 2012 10:01 a.m.
To: Ben Caradoc-Davies
Cc: geoserver-users@lists.sourceforge.net
Subject: Re: [Geoserver-users] postgis SQL view - geography column not recognised
Hi,
Yes the postgres user which geoserver is using can see the table and the contents are:
josh=# select * from geography_columns;
f_table_catalog | f_table_schema | f_table_name | f_geography_column | coord_dimension | srid | type
-----------------+----------------+--------------+--------------------+-----------------+------+-------
josh | public | lightning | strike_location | 2 | 4326 | Point
Thanks,
Josh
________________________________________
From: Ben Caradoc-Davies [Ben.Caradoc-Davies@anonymised.com]
Sent: Friday, 2 March 2012 6:09 p.m.
To: Joshua Groom
Cc: geoserver-users@lists.sourceforge.net
Subject: Re: [Geoserver-users] postgis SQL view - geography column not recognised
Joshua,
does the user you are connecting with have permission to select from the
view geography_columns (introduced when support for geographies was added)?
Can you "select * from geography_columns" as this user?
For GeoServer to recognise geometry columns in views, they must be
registered in geometry_columns. I suspect a similar rule may apply to
geography columns.
Kind regards,
Ben.
On 02/03/12 12:41, Joshua Groom wrote:
Hi,
I am using
- Geoserver 2.1.2 (have replicated this issue on 2.1.3 as well)
- PostgreSQL 9.1.3 on x86_64-pc-linux-gnu, compiled by gcc-4.6.real (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1, 64-bit
- POSTGIS="1.5.3" GEOS="3.2.2-CAPI-1.6.2" PROJ="Rel. 4.7.1, 23 September 2009" LIBXML="2.7.8" USE_STATS
- Sun Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
I have no problem creating layers by directly publishing tables from Postgis or Oracle 11g and can create SQL Views in oracle 11g but not Postgis.
I am having issues with SQL views connecting to a Postgis datasource with a table defined like so:
CREATE TABLE lightning (
id integer primary key,
timestamp text,
amplitude real,
duration integer,
type text,
strike_location geography(POINT, 4326)
);
CREATE INDEX lightning_gix ON lightning USING GIST ( strike_location );
However when I try to create an SQL view, for example:
select * from lightning
Then the geography column strike_location is not picked up and I see the log message:
WARN [geotools.jdbc] - Could not find mapping for 'strike_location', ignoring the column and setting the feature type read only
The layer can be created if I manually specify SRS and bounding Box it does not appear to have a location associated with it, layer preview doesn't work and GML contains no lat lon information.
Any help would be appreciated.
Thanks,
Josh
--
Ben Caradoc-Davies <Ben.Caradoc-Davies@anonymised.com>
Software Engineer
CSIRO Earth Science and Resource Engineering
Australian Resources Research Centre
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users