Graceful degradation when the native postgis srid cannot be determined
----------------------------------------------------------------------
Key: GEOT-3141
URL: http://jira.codehaus.org/browse/GEOT-3141
Project: GeoTools
Issue Type: Improvement
Affects Versions: 2.6.4
Reporter: Andrea Aime
Assignee: Andrea Aime
Priority: Minor
Fix For: 2.6.5
Now when the native srid cannot be determined (think temporarily empty view at
the startup of a long running application, or sql view in which the user failed
to provide the srid) things basically stop working. With a little change we can
have the functionality back, but at a reduced performance:
{code}
modules/plugin/jdbc/jdbc-postgis/src/main/java/org/geotools/data/postgis/PostgisFilterToSQL.java
index 67fe130..219e98f 100644
@@ -62,7 +62,14 @@ public class PostgisFilterToSQL extends FilterToSQL {
} else {
out.write("ST_GeomFromText('");
out.write(geom.toText());
- out.write("', " + currentSRID + ")");
+ if(currentSRID == null && currentGeometry != null) {
+ // if we don't know at all, use the srid of the geometry we're
comparing against
+ // (much slower since that has to be extracted record by
record as opposed to
+ // being a constant)
+ out.write("', ST_SRID(\"" + currentGeometry.getLocalName() +
"\"))");
+ } else {
+ out.write("', " + currentSRID + ")");
+ }
}
}
{code}
Basically the srid gets sucked from the geometry we compare against. Given it's
not a static value this will likely prevent the usage of a spatial index...
pity, probably better than an error.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit. See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel