use of org.geosdi.geoplatform.connector.wfs.response.LayerSchemaDTO in project geo-platform by geosdi.
the class InjectGetFeatureModelEvent method dispatch.
@Override
protected void dispatch(WFSGetFeatureHandler handler) {
final GPLayerBean layer = layerSchemaBinder.getSelectedLayer();
final LayerSchemaDTO schema = layerSchemaBinder.getLayerSchemaDTO();
handler.injectGetFeatureModel(new GetFeatureModel() {
@Override
public String getFeatureNameSpace() {
return layer instanceof GPVectorBean ? ((GPVectorBean) layer).getFeatureNameSpace() : schema.getTargetNamespace();
}
@Override
public String getFeatureType() {
int pos = layer.getName().indexOf(":");
return pos > 0 ? layer.getName().substring(pos + 1, layer.getName().length()) : layer.getName();
}
@Override
public String getSrsName() {
return layer.getCrs();
}
@Override
public String getGeometryName() {
return (layer instanceof GPVectorBean) ? ((GPVectorBean) layer).getGeometryName() : schema.getGeometry().getName();
}
@Override
public WMS getWMSLayer() {
return (WMS) wms;
}
});
}
use of org.geosdi.geoplatform.connector.wfs.response.LayerSchemaDTO in project geo-platform by geosdi.
the class FeatureReaderTest method testFeature.
@Test
public void testFeature() throws Exception {
FileInputStream ff = null;
try {
File dftFile = new File(fileDFT);
ff = new FileInputStream(dftFile);
List<LayerSchemaDTO> schemas = featureReaderXSD.read(ff);
Assert.assertNotNull(schemas);
Assert.assertEquals(1, schemas.size());
LayerSchemaDTO layerSchema = schemas.get(0);
Assert.assertNotNull(layerSchema.getTypeName());
String name = layerSchema.getTypeName().substring(layerSchema.getTypeName().indexOf(":") + 1);
Assert.assertNotNull(layerSchema.getTargetNamespace());
Assert.assertNotNull(layerSchema.getGeometry());
List<AttributeDTO> attributes = layerSchema.getAttributes();
Assert.assertNotNull(attributes);
Assert.assertEquals(numAttributes, attributes.size());
for (AttributeDTO att : attributes) {
Assert.assertTrue(att.getMinOccurs() >= 0);
Assert.assertTrue(att.getMaxOccurs() > att.getMinOccurs());
Assert.assertNotNull(att.getName());
Assert.assertNotNull(att.getType());
}
logger.debug("@@@@@@@@@@@@@@@@@@@@LAYER_SCHEMA : {}", layerSchema);
WFSGetFeatureStaxReader featureReader = new WFSGetFeatureStaxReader(layerSchema);
FeatureCollectionDTO fc = featureReader.read(new File(fileGF));
Assert.assertNotNull(fc);
Assert.assertNotNull(fc.getTimeStamp());
Assert.assertEquals(numFeatures, fc.getNumberOfFeatures());
List<FeatureDTO> features = fc.getFeatures();
Assert.assertNotNull(features);
Assert.assertEquals(numFeatures, features.size());
for (FeatureDTO feature : features) {
Assert.assertNotNull(feature.getFID());
Assert.assertTrue(feature.getFID().contains(name));
Assert.assertNotNull(feature.getGeometry());
if (numAttributes == 0) {
Assert.assertTrue(feature.getAttributes().getAttributesMap().isEmpty());
} else {
Assert.assertNotNull(feature.getAttributes());
Map<String, String> fMap = feature.getAttributes().getAttributesMap();
Assert.assertNotNull(fMap);
logger.debug("#################FMAP_SIZE : {}\n", fMap.size());
Assert.assertEquals(numAttributes, fMap.size());
}
logger.debug("@@@@@@@@@@@@@@@@@@@@ {} - {}", feature.getFID(), feature.getAttributes());
logger.debug("GEOMETRY @@@@@@@@@@@@@@@@ : {}", feature.getGeometry());
}
} finally {
if (ff != null) {
ff.close();
}
}
}
use of org.geosdi.geoplatform.connector.wfs.response.LayerSchemaDTO in project geo-platform by geosdi.
the class FeatureReaderNetworkTest method readSFStreamsAllNet.
@Test
public void readSFStreamsAllNet() throws Exception {
List<LayerSchemaDTO> schemas = featureReaderXSD.read(new URL(DESCRIBE_FEATURE_PATH.concat("sf:streams")).openStream());
Assert.assertNotNull(schemas);
Assert.assertEquals(1, schemas.size());
LayerSchemaDTO layerSchema = schemas.get(0);
logger.debug("######################HERE THE SCHEMA FOR : sf:streams : \n{}\n", layerSchema);
}
use of org.geosdi.geoplatform.connector.wfs.response.LayerSchemaDTO in project geo-platform by geosdi.
the class FeatureReaderNetworkTest method readStatesAllNet.
@Test
public void readStatesAllNet() throws Exception {
List<LayerSchemaDTO> schemas = featureReaderXSD.read(new URL(DESCRIBE_FEATURE_PATH.concat("topp:states")).openStream());
Assert.assertNotNull(schemas);
Assert.assertEquals(1, schemas.size());
LayerSchemaDTO layerSchema = schemas.get(0);
logger.debug("######################HERE THE SCHEMA FOR : topp:states : \n{}\n", layerSchema);
}
use of org.geosdi.geoplatform.connector.wfs.response.LayerSchemaDTO in project geo-platform by geosdi.
the class WFSGetFeatureWSTest method statesFeatureLayerV110.
@Test
public void statesFeatureLayerV110() throws Exception {
String typeName = TOPP_STATES.getLocalPart();
LayerSchemaDTO layerSchema = wfsService.describeFeatureType(addressDatastore, typeName, EMPTY_MAP);
logger.debug("\n\n\n@@@ {}", layerSchema);
BBox bBox = new BBox(-75.102613, 40.212597, -72.361859, 41.512517);
FeatureCollectionDTO fc = wfsService.getFeatureByBBox(layerSchema, bBox, EMPTY_MAP);
this.checkFeatureCollection(fc, typeName, 22, 4);
}
Aggregations