178 |
178 |
strb.append(storeParams.tableID());
|
179 |
179 |
}
|
180 |
180 |
|
181 |
|
if (limit != null){
|
182 |
|
strb.append(" where " + getFunctionName("ST_Intersects") + "("
|
183 |
|
+ getFunctionName("ST_GeomFromText") + "('");
|
184 |
|
String workAreaWkt = null;
|
185 |
|
try {
|
186 |
|
workAreaWkt = limit.getGeometry().convertToWKT();
|
187 |
|
} catch (Exception e) {
|
188 |
|
throw new CreateGeometryException(e);
|
189 |
|
}
|
190 |
|
strb.append(workAreaWkt);
|
191 |
|
strb.append("', ");
|
192 |
|
|
193 |
|
IProjection proj = storeParams.getCRS();
|
194 |
|
int sridInt = this.getProviderSRID(proj);
|
195 |
|
if (sridInt == -1) {
|
196 |
|
throw new CreateGeometryException(
|
|
181 |
if (limit != null || (storeParams.getBaseFilter() != null
|
|
182 |
&& storeParams.getBaseFilter().trim().length() > 0)){
|
|
183 |
strb.append(" where ");
|
|
184 |
|
|
185 |
if (limit != null) {
|
|
186 |
strb.append(" ( " + getFunctionName("ST_Intersects") + "("
|
|
187 |
+ getFunctionName("ST_GeomFromText") + "('");
|
|
188 |
String workAreaWkt = null;
|
|
189 |
try {
|
|
190 |
workAreaWkt = limit.getGeometry().convertToWKT();
|
|
191 |
} catch (Exception e) {
|
|
192 |
throw new CreateGeometryException(e);
|
|
193 |
}
|
|
194 |
strb.append(workAreaWkt);
|
|
195 |
strb.append("', ");
|
|
196 |
|
|
197 |
IProjection proj = storeParams.getCRS();
|
|
198 |
int sridInt = this.getProviderSRID(proj);
|
|
199 |
if (sridInt == -1) {
|
|
200 |
throw new CreateGeometryException(
|
197 |
201 |
new Exception("CRS is null or unknown."));
|
198 |
|
} else {
|
199 |
|
strb.append(Integer.toString(sridInt));
|
|
202 |
} else {
|
|
203 |
strb.append(Integer.toString(sridInt));
|
|
204 |
}
|
|
205 |
strb.append("), " + getFunctionName("ST_Envelope") + "(");
|
|
206 |
strb.append(escapeFieldName(geometryAttrName));
|
|
207 |
strb.append(")) ) ");
|
|
208 |
|
200 |
209 |
}
|
201 |
|
strb.append("), " + getFunctionName("ST_Envelope") + "(");
|
202 |
|
strb.append(escapeFieldName(geometryAttrName));
|
203 |
|
strb.append(")) ");
|
|
210 |
if (storeParams.getBaseFilter() != null && storeParams.getBaseFilter().trim().length() > 0) {
|
|
211 |
if (limit != null) {
|
|
212 |
strb.append(" and ");
|
|
213 |
}
|
|
214 |
strb.append(" ( ");
|
|
215 |
strb.append(storeParams.getBaseFilter());
|
|
216 |
strb.append(" ) ");
|
|
217 |
}
|
|
218 |
|
204 |
219 |
}
|
205 |
220 |
|
206 |
221 |
final String sql = strb.toString();
|