Skip to content

Commit

Permalink
added search tables and changed to search by feature id
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesse Eichar committed Sep 19, 2012
1 parent 7ae946b commit 6b8d0ec
Show file tree
Hide file tree
Showing 5 changed files with 2,763 additions and 16 deletions.
Expand Up @@ -99,6 +99,7 @@
import org.opengis.feature.simple.SimpleFeatureType;
import org.opengis.filter.FilterFactory2;
import org.opengis.filter.Or;
import org.opengis.filter.identity.Identifier;
import org.opengis.referencing.crs.CoordinateReferenceSystem;

import com.vividsolutions.jts.geom.Geometry;
Expand Down Expand Up @@ -736,14 +737,13 @@ private FeatureIterator<SimpleFeature> getIdentifiedFeature(String gmlId, Filter
{
FeatureIterator<SimpleFeature> iter;
String[] ids = gmlId.split(":", 2)[1].split(",");
List<org.opengis.filter.Filter> filters = new ArrayList<org.opengis.filter.Filter>(ids.length);
Set<Identifier> identifiers = new HashSet<Identifier>();
for (String id : ids) {
filters.add(filterFactory.equals(filterFactory.property(idField), filterFactory.literal(id)));
identifiers.add(filterFactory.featureId(typeName+"."+id));
}
Or equalFilter = filterFactory.or(filters);
DefaultQuery query = new DefaultQuery(typeName, equalFilter, new String[]{idField,"the_geom"});
DefaultQuery query = new DefaultQuery(typeName, filterFactory.id(identifiers), new String[]{"the_geom"});
FeatureCollection<SimpleFeatureType, SimpleFeature> features = _datastore.getFeatureSource(typeName).getFeatures(
equalFilter);
query);
iter = features.features();
return iter;
}
Expand Down
Expand Up @@ -392,17 +392,17 @@ ALTER TABLE ONLY xlinks ALTER COLUMN gid SET DEFAULT nextval('xlinks_gid_seq'::r
ALTER TABLE ONLY xlinks
ADD CONSTRAINT xlinks_pkey PRIMARY KEY (gid);

create table countries_search as select "ID","LAND",ST_Buffer(ST_Transform(the_geom, 4326), .001) from countries;
ALTER TABLE countries_search RENAME st_buffer TO the_geom;
alter TABLE countries_search OWNER TO "www-data";
-- create table countries_search as select "ID","LAND",ST_Buffer(ST_Transform(the_geom, 4326), .001) from countries;
-- ALTER TABLE countries_search RENAME st_buffer TO the_geom;
-- alter TABLE countries_search OWNER TO "www-data";

create table kantone_search as select "KANTONSNR","NAME",ST_Buffer(ST_Transform(the_geom, 4326), .001) from "kantoneBB";
ALTER TABLE kantone_search RENAME st_buffer TO the_geom;
alter TABLE kantone_search OWNER TO "www-data";
-- create table kantone_search as select "KANTONSNR","NAME",ST_Buffer(ST_Transform(the_geom, 4326), .001) from "kantoneBB";
-- ALTER TABLE kantone_search RENAME st_buffer TO the_geom;
-- alter TABLE kantone_search OWNER TO "www-data";

create table gemeinden_search as select "OBJECTVAL","GEMNAME",ST_Buffer(ST_Transform(the_geom, 4326), .001) from "gemeindenBB";
ALTER TABLE gemeinden_search RENAME st_buffer TO the_geom;
alter TABLE gemeinden_search OWNER TO "www-data";
-- create table gemeinden_search as select "OBJECTVAL","GEMNAME",ST_Buffer(ST_Transform(the_geom, 4326), .001) from "gemeindenBB";
-- ALTER TABLE gemeinden_search RENAME st_buffer TO the_geom;
-- alter TABLE gemeinden_search OWNER TO "www-data";

DELETE FROM geometry_columns where f_table_name='countriesBB' OR f_table_name='countries' OR f_table_name='non_validated' OR
f_table_name='xlinks' OR f_table_name='spatialIndex' OR f_table_name='gemeindenBB' OR f_table_name='kantoneBB' OR
Expand Down
2,746 changes: 2,746 additions & 0 deletions web/src/main/webapp/WEB-INF/classes/setup/sql/data/postgis-search-default.sql

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion web/src/main/webapp/WEB-INF/override-config-jeichar.xml
Expand Up @@ -13,7 +13,7 @@
<port>8190</port>
</properties>
<file name=".*/WEB-INF/config-gui.xml">
<replaceText xpath="geoserver.url">http://tc-geocat0i.bgdi.admin.ch/geoserver</replaceText>
<replaceText xpath="geoserver.url">http://tc-geocat0i.bgdi.admin.ch/geoserver/</replaceText>
<replaceXML xpath="mapSearch/layers">
<layer server="http://tc-geocat0i.bgdi.admin.ch/geoserver/wms" tocName="Kantone" params="{layers: 'gn:kantoneBB', transparent: 'true', format: 'image/png'}" options="{isBaseLayer: true}" />
</replaceXML>
Expand Down
3 changes: 2 additions & 1 deletion web/src/main/webapp/WEB-INF/overrides-config-geocat.xml
Expand Up @@ -93,6 +93,7 @@
<file path="WEB-INF/classes/setup/sql/data" filePrefix="postgis-kantoneBB-"/>
<file path="WEB-INF/classes/setup/sql/data" filePrefix="postgis-non_validated-"/>
<file path="WEB-INF/classes/setup/sql/data" filePrefix="postgis-xlinks-"/>
<file path="WEB-INF/classes/setup/sql/data" filePrefix="postgis-search-"/>
<file path="WEB-INF/classes/setup/sql/data" filePrefix="geometry_columns-"/>
</addXml>
</file>
Expand Down Expand Up @@ -243,7 +244,7 @@
<serverStage>${serverStage}</serverStage>
</addXml>
<addXml xpath="">
<geoserver.url>http://${wfs.host}:${wfs.port}/geoserver</geoserver.url>
<geoserver.url>http://${wfs.host}:${wfs.port}/geoserver/</geoserver.url>
</addXml>
<replaceAtt xpath="mapSearch" attName="options" value="{projection: 'EPSG:4326', maxExtent: new OpenLayers.Bounds(5,45,10,55), units: 'degrees', restrictedExtent: new OpenLayers.Bounds(5,45,10,55)}"/>
<replaceAtt xpath="mapViewer" attName="options" value="{projection: 'EPSG:4326', maxExtent: new OpenLayers.Bounds(5,45,10,55), units: 'degrees', restrictedExtent: new OpenLayers.Bounds(5,45,10,55)}"/>
Expand Down

0 comments on commit 6b8d0ec

Please sign in to comment.