Search in sources :

Example 1 with GPGeoserverFeatureTypeInfo

use of org.geosdi.geoplatform.connector.geoserver.model.featuretypes.GPGeoserverFeatureTypeInfo in project geo-platform by geosdi.

the class GeoserverConnectorLayersTest method m_getFeatureType.

@Test
public void m_getFeatureType() throws Exception {
    GeoserverLoadWorkspaceLayerRequest geoserverLoadWorkspaceLayerRequest = this.geoserverConnectorStore.loadWorkspaceLayerRequest().withQuietOnNotFound(FALSE).withLayerName("poi").withWorkspaceName("tiger");
    Boolean result = geoserverLoadWorkspaceLayerRequest.exist();
    logger.info("################{}\n", result);
    GeoserverLayer geoserverLayer = geoserverLoadWorkspaceLayerRequest.getResponse();
    logger.info("################{}\n", geoserverLayer);
    GPGeoserverFeatureTypeInfo gpGeoserverFeatureTypeInfo = this.geoserverConnectorStore.loadFeatureTypeWithUrl().withUrl(geoserverLayer.getLayerResource().getHref()).getResponse();
    RESTLayer restLayer = this.restReader.getLayer("tiger", "poi");
    RESTFeatureType featureType = this.restReader.getFeatureType(restLayer);
    assertTrue("#################", gpGeoserverFeatureTypeInfo.getNativeBoundingBox().getMaxx() == featureType.getNativeBoundingBox().getMaxX());
    assertTrue("#################", gpGeoserverFeatureTypeInfo.getNativeBoundingBox().getMaxy() == featureType.getNativeBoundingBox().getMaxY());
    assertTrue("#################", gpGeoserverFeatureTypeInfo.getNativeBoundingBox().getMinx() == featureType.getNativeBoundingBox().getMinX());
    assertTrue("#################", gpGeoserverFeatureTypeInfo.getNativeBoundingBox().getMiny() == featureType.getNativeBoundingBox().getMinY());
    assertTrue("#################", gpGeoserverFeatureTypeInfo.getNativeBoundingBox().getCrs().equals(featureType.getNativeBoundingBox().getCRS()));
    assertTrue("#################", gpGeoserverFeatureTypeInfo.getLatLonBoundingBox().getMaxx() == featureType.getLatLonBoundingBox().getMaxX());
    assertTrue("#################", gpGeoserverFeatureTypeInfo.getLatLonBoundingBox().getMaxy() == featureType.getLatLonBoundingBox().getMaxY());
    assertTrue("#################", gpGeoserverFeatureTypeInfo.getLatLonBoundingBox().getMinx() == featureType.getLatLonBoundingBox().getMinX());
    assertTrue("#################", gpGeoserverFeatureTypeInfo.getLatLonBoundingBox().getMiny() == featureType.getLatLonBoundingBox().getMinY());
    assertTrue("#################", gpGeoserverFeatureTypeInfo.getLatLonBoundingBox().getCrs().equals(featureType.getLatLonBoundingBox().getCRS()));
    assertTrue("#################", gpGeoserverFeatureTypeInfo.getNativeName().equals(featureType.getNativeName()));
    stream(gpGeoserverFeatureTypeInfo.getAttributes().getValues().spliterator(), FALSE).forEach(c -> c.getName());
    stream(featureType.getAttributes().spliterator(), FALSE).forEach(c -> System.out.println(c.getName()));
}
Also used : GeoserverLoadWorkspaceLayerRequest(org.geosdi.geoplatform.connector.geoserver.request.layers.GeoserverLoadWorkspaceLayerRequest) GeoserverLayer(org.geosdi.geoplatform.connector.geoserver.model.layers.GeoserverLayer) IGPGeoserverFeatureTypeInfo(org.geosdi.geoplatform.connector.geoserver.model.featuretypes.IGPGeoserverFeatureTypeInfo) GPGeoserverFeatureTypeInfo(org.geosdi.geoplatform.connector.geoserver.model.featuretypes.GPGeoserverFeatureTypeInfo) RESTLayer(it.geosolutions.geoserver.rest.decoder.RESTLayer) RESTFeatureType(it.geosolutions.geoserver.rest.decoder.RESTFeatureType) GeoserverConnectorTest(org.geosdi.geoplatform.geoserver.GeoserverConnectorTest) Test(org.junit.Test)

Example 2 with GPGeoserverFeatureTypeInfo

use of org.geosdi.geoplatform.connector.geoserver.model.featuretypes.GPGeoserverFeatureTypeInfo in project geo-platform by geosdi.

the class GeoserverConnectorLayersTest method o_publishDBLayer.

@Ignore
@Test
public void o_publishDBLayer() throws Exception {
    GeoserverCreateFeatureTypeRequest createFeatureTypeRequest = this.geoserverConnectorStore.createFeatureTypeRequest();
    createFeatureTypeRequest.withWorkspace("sf").withStore("store_vito");
    IGPGeoserverFeatureTypeInfo featureTypeBody = new GPGeoserverFeatureTypeInfo();
    featureTypeBody.setNativeCRS("GEOGCS["WGS 84", \n" + "  DATUM["World Geodetic System 1984", \n" + "    SPHEROID["WGS 84", 6378137.0, 298.257223563, AUTHORITY["EPSG","7030"]], \n" + "    AUTHORITY["EPSG","6326"]], \n" + "  PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]], \n" + "  UNIT["degree", 0.017453292519943295], \n" + "  AXIS["Geodetic longitude", EAST], \n" + "  AXIS["Geodetic latitude", NORTH], \n" + "  AUTHORITY["EPSG","4326"]]");
    featureTypeBody.setSrs("EPSG:4326");
    featureTypeBody.setEnabled(TRUE);
    featureTypeBody.setTitle("layer_test");
    featureTypeBody.setName("test");
    GPGeoserverNativeBoundingBox nativeBoundingBox = new GPGeoserverNativeBoundingBox();
    nativeBoundingBox.setMinx(-74.0118315772888);
    nativeBoundingBox.setMaxx(-74.00153046439813);
    nativeBoundingBox.setMiny(40.70754683896324);
    nativeBoundingBox.setMaxy(40.719885123828675);
    nativeBoundingBox.setCrs("EPSG:4326");
    featureTypeBody.setNativeBoundingBox(nativeBoundingBox);
    GPGeoserverLatLonBoundingBox latLonBoundingBox = new GPGeoserverLatLonBoundingBox();
    latLonBoundingBox.setMinx(-74.0118315772888);
    latLonBoundingBox.setMaxx(-74.00857344353275);
    latLonBoundingBox.setMiny(40.70754683896324);
    latLonBoundingBox.setMaxy(40.711945649065406);
    latLonBoundingBox.setCrs("EPSG:4326");
    featureTypeBody.setLatLonBoundingBox(latLonBoundingBox);
    IGPFeatureTypeAttribute featureTypeAttribute = new GPFeatureTypeAttribute();
    featureTypeAttribute.setName("the_geom");
    featureTypeAttribute.setBinding("org.locationtech.jts.geom.Point");
    featureTypeAttribute.setNillable(TRUE);
    featureTypeAttribute.setMinOccurs(0);
    featureTypeAttribute.setMinOccurs(1);
    IGPFeatureTypeAttributes featureTypeAttributes = new GPFeatureTypeAttributes();
    featureTypeAttributes.setValues(asList(featureTypeAttribute));
    featureTypeBody.setAttributes(featureTypeAttributes);
    createFeatureTypeRequest.withFeatureTypeBody(featureTypeBody);
    logger.info("################{}\n", createFeatureTypeRequest.getResponse());
}
Also used : GPGeoserverNativeBoundingBox(org.geosdi.geoplatform.connector.geoserver.model.bbox.GPGeoserverNativeBoundingBox) GPFeatureTypeAttribute(org.geosdi.geoplatform.connector.geoserver.model.featuretypes.attribute.GPFeatureTypeAttribute) IGPFeatureTypeAttribute(org.geosdi.geoplatform.connector.geoserver.model.featuretypes.attribute.IGPFeatureTypeAttribute) IGPGeoserverFeatureTypeInfo(org.geosdi.geoplatform.connector.geoserver.model.featuretypes.IGPGeoserverFeatureTypeInfo) GPGeoserverFeatureTypeInfo(org.geosdi.geoplatform.connector.geoserver.model.featuretypes.GPGeoserverFeatureTypeInfo) IGPFeatureTypeAttributes(org.geosdi.geoplatform.connector.geoserver.model.featuretypes.attribute.IGPFeatureTypeAttributes) IGPFeatureTypeAttribute(org.geosdi.geoplatform.connector.geoserver.model.featuretypes.attribute.IGPFeatureTypeAttribute) GPGeoserverLatLonBoundingBox(org.geosdi.geoplatform.connector.geoserver.model.bbox.GPGeoserverLatLonBoundingBox) IGPGeoserverFeatureTypeInfo(org.geosdi.geoplatform.connector.geoserver.model.featuretypes.IGPGeoserverFeatureTypeInfo) GPFeatureTypeAttributes(org.geosdi.geoplatform.connector.geoserver.model.featuretypes.attribute.GPFeatureTypeAttributes) IGPFeatureTypeAttributes(org.geosdi.geoplatform.connector.geoserver.model.featuretypes.attribute.IGPFeatureTypeAttributes) GeoserverCreateFeatureTypeRequest(org.geosdi.geoplatform.connector.geoserver.request.featuretypes.GeoserverCreateFeatureTypeRequest) Ignore(org.junit.Ignore) GeoserverConnectorTest(org.geosdi.geoplatform.geoserver.GeoserverConnectorTest) Test(org.junit.Test)

Example 3 with GPGeoserverFeatureTypeInfo

use of org.geosdi.geoplatform.connector.geoserver.model.featuretypes.GPGeoserverFeatureTypeInfo in project geo-platform by geosdi.

the class GPGeoserverFeatureTypeInfoJacksonTest method d_unmarshallGPGeoserverFeatureTypeInfoFromJsonFileTest.

@Test
public void d_unmarshallGPGeoserverFeatureTypeInfoFromJsonFileTest() throws Exception {
    GPGeoserverFeatureTypeInfo featureTypeInfo = jacksonSupport.getDefaultMapper().readValue(new File(of(new File(".").getCanonicalPath(), "src", "test", "resources", "FeatureTypeInfo").collect(joining(separator, "", ".json"))), GPGeoserverFeatureTypeInfo.class);
    logger.info("#####################GP_GEOSERVER_FEATURE_TYPE_INFO : {}\n", featureTypeInfo);
}
Also used : GPGeoserverFeatureTypeInfo(org.geosdi.geoplatform.connector.geoserver.model.featuretypes.GPGeoserverFeatureTypeInfo) File(java.io.File) Test(org.junit.Test)

Example 4 with GPGeoserverFeatureTypeInfo

use of org.geosdi.geoplatform.connector.geoserver.model.featuretypes.GPGeoserverFeatureTypeInfo in project geo-platform by geosdi.

the class GPGeoserverFeatureTypeInfoJacksonTest method a_unmarshallGPGeoserverFeatureTypeInfoFromXmlFileTest.

@Test
public void a_unmarshallGPGeoserverFeatureTypeInfoFromXmlFileTest() throws Exception {
    GPGeoserverFeatureTypeInfo featureTypeInfo = JACKSON_JAXB_XML_SUPPORT.getDefaultMapper().readValue(new File(of(new File(".").getCanonicalPath(), "src", "test", "resources", "FeatureTypeInfo").collect(joining(separator, "", ".xml"))), GPGeoserverFeatureTypeInfo.class);
    logger.info("@@@@@@@@@@@@@@@@@@@@@@@GP_GEOSERVER_FEATURE_TYPE_INFO : {}\n", featureTypeInfo);
}
Also used : GPGeoserverFeatureTypeInfo(org.geosdi.geoplatform.connector.geoserver.model.featuretypes.GPGeoserverFeatureTypeInfo) File(java.io.File) Test(org.junit.Test)

Example 5 with GPGeoserverFeatureTypeInfo

use of org.geosdi.geoplatform.connector.geoserver.model.featuretypes.GPGeoserverFeatureTypeInfo in project geo-platform by geosdi.

the class GPGeoserverFeatureTypeInfoJacksonTest method e_unmarshallGPGeoserverFeatureTypeInfoFromXmlFileTest.

@Test
public void e_unmarshallGPGeoserverFeatureTypeInfoFromXmlFileTest() throws Exception {
    GPGeoserverFeatureTypeInfo featureTypeInfo = JACKSON_JAXB_XML_SUPPORT.getDefaultMapper().readValue(new File(of(new File(".").getCanonicalPath(), "src", "test", "resources", "FeatureTypeInfo1").collect(joining(separator, "", ".xml"))), GPGeoserverFeatureTypeInfo.class);
    logger.info("@@@@@@@@@@@@@@@@@@@@@@@GP_GEOSERVER_FEATURE_TYPE_INFO : {}\n", featureTypeInfo);
}
Also used : GPGeoserverFeatureTypeInfo(org.geosdi.geoplatform.connector.geoserver.model.featuretypes.GPGeoserverFeatureTypeInfo) File(java.io.File) Test(org.junit.Test)

Aggregations

GPGeoserverFeatureTypeInfo (org.geosdi.geoplatform.connector.geoserver.model.featuretypes.GPGeoserverFeatureTypeInfo)18 Test (org.junit.Test)13 File (java.io.File)7 IGPGeoserverFeatureTypeInfo (org.geosdi.geoplatform.connector.geoserver.model.featuretypes.IGPGeoserverFeatureTypeInfo)6 GPGeoserverLatLonBoundingBox (org.geosdi.geoplatform.connector.geoserver.model.bbox.GPGeoserverLatLonBoundingBox)5 GeoserverConnectorTest (org.geosdi.geoplatform.geoserver.GeoserverConnectorTest)5 GPGeoserverNativeBoundingBox (org.geosdi.geoplatform.connector.geoserver.model.bbox.GPGeoserverNativeBoundingBox)4 GPFeatureTypeAttribute (org.geosdi.geoplatform.connector.geoserver.model.featuretypes.attribute.GPFeatureTypeAttribute)4 GPFeatureTypeAttributes (org.geosdi.geoplatform.connector.geoserver.model.featuretypes.attribute.GPFeatureTypeAttributes)4 IGPFeatureTypeAttribute (org.geosdi.geoplatform.connector.geoserver.model.featuretypes.attribute.IGPFeatureTypeAttribute)4 IGPFeatureTypeAttributes (org.geosdi.geoplatform.connector.geoserver.model.featuretypes.attribute.IGPFeatureTypeAttributes)4 GeoserverLayer (org.geosdi.geoplatform.connector.geoserver.model.layers.GeoserverLayer)4 FileNotFoundException (java.io.FileNotFoundException)3 IOException (java.io.IOException)3 GeoserverCreateFeatureTypeRequest (org.geosdi.geoplatform.connector.geoserver.request.featuretypes.GeoserverCreateFeatureTypeRequest)3 GeoserverLoadFeatureTypeWithUrlRequest (org.geosdi.geoplatform.connector.geoserver.request.featuretypes.GeoserverLoadFeatureTypeWithUrlRequest)3 RESTLayer (it.geosolutions.geoserver.rest.decoder.RESTLayer)2 StringReader (java.io.StringReader)2 List (java.util.List)2 GeoserverVectorLayer (org.geosdi.geoplatform.connector.geoserver.model.layers.vector.GeoserverVectorLayer)2