Search in sources :

Example 31 with PointType

use of org.geotoolkit.gml.xml.v321.PointType in project arctic-sea by 52North.

the class GmlEncoderv321 method createMultiPointFromJtsGeometry.

private void createMultiPointFromJtsGeometry(MultiPoint geom, MultiPointType xbMultiPoint, String id) throws EncodingException {
    for (int i = 0; i < geom.getNumGeometries(); i++) {
        Geometry geometry = geom.getGeometryN(i);
        if (geometry instanceof Point) {
            PointType pt = xbMultiPoint.addNewPointMember().addNewPoint();
            pt.setId(id + "_" + i);
            createPointFromJtsGeometry((Point) geometry, pt);
        }
    }
}
Also used : EnvelopeOrGeometry(org.n52.shetland.util.EnvelopeOrGeometry) Geometry(org.locationtech.jts.geom.Geometry) AbstractGeometry(org.n52.shetland.ogc.gml.AbstractGeometry) MultiPointType(net.opengis.gml.x32.MultiPointType) PointType(net.opengis.gml.x32.PointType) MultiPoint(org.locationtech.jts.geom.MultiPoint) Point(org.locationtech.jts.geom.Point) MultiPoint(org.locationtech.jts.geom.MultiPoint) Point(org.locationtech.jts.geom.Point)

Example 32 with PointType

use of org.geotoolkit.gml.xml.v321.PointType in project geotoolkit by Geomatys.

the class WfsXMLBindingTest method marshallingTest.

@Test
public void marshallingTest() throws JAXBException {
    WFSCapabilitiesType capa = new WFSCapabilitiesType();
    List<FeatureTypeType> featList = new ArrayList<FeatureTypeType>();
    LatLongBoundingBoxType bbox = new LatLongBoundingBoxType(29.8, -90.1, 30, -89.9);
    FeatureTypeType ft1 = new FeatureTypeType(new QName("http://www.opengis.net/ows-6/utds/0.3", "Building", "utds"), "", "urn:ogc:def:crs:EPSG::4979", Arrays.asList(bbox));
    featList.add(ft1);
    FeatureTypeListType featureList = new FeatureTypeListType(null, featList);
    capa.setFeatureTypeList(featureList);
    StringWriter sw = new StringWriter();
    marshaller.marshal(capa, sw);
    DeleteElementType del = null;
    TransactionType transac = new TransactionType("WFS", "1.1.0", null, AllSomeType.ALL, del);
    PropertyIsLikeType pis = new PropertyIsLikeType("NAME", "Ashton", "*", "?", "\\");
    org.geotoolkit.ogc.xml.v100.ObjectFactory factory = new org.geotoolkit.ogc.xml.v100.ObjectFactory();
    final JAXBElement<? extends ComparisonOpsType> jbPis = factory.createPropertyIsLike(pis);
    FilterType filter = new FilterType(null, jbPis, null, null);
    CoordType dp = new CoordType(21400.0, 2001368.0);
    PointType pt = new PointType(dp);
    pt.setSrsName("urn:ogc:def:crs:epsg:7.4:27582");
    PropertyType property = new PropertyType("the_geom", pt);
    UpdateElementType update = new UpdateElementType(Arrays.asList(property), filter, new QName("http://www.opengis.net/gml", "NamedPlaces"));
    transac.getInsertOrUpdateOrDelete().add(update);
// marshaller.marshal(transac, System.out);
}
Also used : QName(javax.xml.namespace.QName) ArrayList(java.util.ArrayList) FilterType(org.geotoolkit.ogc.xml.v100.FilterType) StringWriter(java.io.StringWriter) PointType(org.geotoolkit.gml.xml.v212.PointType) PropertyIsLikeType(org.geotoolkit.ogc.xml.v100.PropertyIsLikeType) CoordType(org.geotoolkit.gml.xml.v212.CoordType)

Example 33 with PointType

use of org.geotoolkit.gml.xml.v321.PointType in project geotoolkit by Geomatys.

the class PropertyTypeTest method getValueGeometryNewTest.

/**
 * Test simple Record Marshalling.
 *
 * @throws javax.xml.bind.JAXBException
 */
@Test
public void getValueGeometryNewTest() throws JAXBException {
    String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" + '\n' + "<wfs:Transaction xmlns:wfs=\"http://www.opengis.net/wfs\" xmlns:gml=\"http://www.opengis.net/gml\" version=\"1.1.0\" service=\"WFS\" >" + '\n' + "    <wfs:Update>" + '\n' + "        <wfs:Property>" + '\n' + "            <wfs:Name>something</wfs:Name>" + '\n' + "            <wfs:Value>" + '\n' + "               <gml:Point srsName=\"urn:ogc:def:crs:epsg:7.4:4326\" >" + '\n' + "                   <gml:pos>2.1 12.6</gml:pos>" + '\n' + "               </gml:Point>" + '\n' + "            </wfs:Value>" + '\n' + "        </wfs:Property>" + '\n' + "    </wfs:Update>" + '\n' + "</wfs:Transaction>" + '\n';
    TransactionType result = (TransactionType) unmarshaller.unmarshal(new StringReader(xml));
    assertTrue(result.getInsertOrUpdateOrDelete().size() == 1);
    assertTrue(result.getInsertOrUpdateOrDelete().get(0) instanceof UpdateElementType);
    UpdateElementType update = (UpdateElementType) result.getInsertOrUpdateOrDelete().get(0);
    assertTrue(update.getProperty().size() == 1);
    PropertyType property = update.getProperty().get(0);
    PointType pt = new PointType(null, new DirectPositionType(2.1, 12.6));
    pt.setSrsName("urn:ogc:def:crs:epsg:7.4:4326");
    assertEquals(pt, property.getValue());
}
Also used : DirectPositionType(org.geotoolkit.gml.xml.v311.DirectPositionType) StringReader(java.io.StringReader) PointType(org.geotoolkit.gml.xml.v311.PointType)

Example 34 with PointType

use of org.geotoolkit.gml.xml.v321.PointType in project geotoolkit by Geomatys.

the class WfsXMLBindingTest method marshallingTest.

@Test
public void marshallingTest() throws JAXBException {
    WFSCapabilitiesType capa = new WFSCapabilitiesType();
    List<FeatureTypeType> featList = new ArrayList<>();
    List<String> otherSRS = Arrays.asList("urn:ogc:def:crs", "crs:EPSG::32615", "crs:EPSG::5773");
    WGS84BoundingBoxType bbox = new WGS84BoundingBoxType(29.8, -90.1, 30, -89.9);
    FeatureTypeType ft1 = new FeatureTypeType(new QName("http://www.opengis.net/ows-6/utds/0.3", "Building", "utds"), "", "urn:ogc:def:crs:EPSG::4979", otherSRS, Arrays.asList(bbox));
    featList.add(ft1);
    FeatureTypeListType featureList = new FeatureTypeListType(null, featList);
    capa.setFeatureTypeList(featureList);
    StringWriter sw = new StringWriter();
    marshaller.marshal(capa, sw);
    DeleteElementType del = null;
    TransactionType transac = new TransactionType("WFS", "1.1.0", null, AllSomeType.ALL, del);
    PropertyIsLikeType pis = new PropertyIsLikeType("NAME", "Ashton", "*", "?", "\\");
    FilterType filter = new FilterType(pis);
    DirectPositionType dp = new DirectPositionType(21400.0, 2001368.0);
    PointType pt = new PointType(null, dp);
    pt.setSrsName("urn:ogc:def:crs:epsg:7.4:27582");
    PropertyType property = new PropertyType(new QName("the_geom"), new ValueType(pt));
    UpdateElementType update = new UpdateElementType(null, Arrays.asList(property), filter, new QName("http://www.opengis.net/gml", "NamedPlaces"), null);
    transac.getInsertOrUpdateOrDelete().add(update);
// marshaller.marshal(transac, System.out);
}
Also used : DirectPositionType(org.geotoolkit.gml.xml.v311.DirectPositionType) WGS84BoundingBoxType(org.geotoolkit.ows.xml.v100.WGS84BoundingBoxType) QName(javax.xml.namespace.QName) ArrayList(java.util.ArrayList) FilterType(org.geotoolkit.ogc.xml.v110.FilterType) StringWriter(java.io.StringWriter) PointType(org.geotoolkit.gml.xml.v311.PointType) PropertyIsLikeType(org.geotoolkit.ogc.xml.v110.PropertyIsLikeType)

Example 35 with PointType

use of org.geotoolkit.gml.xml.v321.PointType in project geotoolkit by Geomatys.

the class WfsXMLBindingTest method marshallingTest.

@Test
public void marshallingTest() throws JAXBException {
    WFSCapabilitiesType capa = new WFSCapabilitiesType();
    List<FeatureTypeType> featList = new ArrayList<>();
    List<String> otherSRS = Arrays.asList("urn:ogc:def:crs", "crs:EPSG::32615", "crs:EPSG::5773");
    WGS84BoundingBoxType bbox = new WGS84BoundingBoxType(29.8, -90.1, 30, -89.9);
    FeatureTypeType ft1 = new FeatureTypeType(new QName("http://www.opengis.net/ows-6/utds/0.3", "Building", "utds"), "", "urn:ogc:def:crs:EPSG::4979", otherSRS, Arrays.asList(bbox));
    featList.add(ft1);
    FeatureTypeListType featureList = new FeatureTypeListType(null, featList);
    capa.setFeatureTypeList(featureList);
    StringWriter sw = new StringWriter();
    marshaller.marshal(capa, sw);
    DeleteType del = null;
    TransactionType transac = new TransactionType("WFS", "1.1.0", null, AllSomeType.ALL, del);
    PropertyIsLikeType pis = new PropertyIsLikeType("NAME", "Ashton", "*", "?", "\\");
    FilterType filter = new FilterType(pis);
    DirectPositionType dp = new DirectPositionType(21400.0, 2001368.0);
    PointType pt = new PointType(null, dp);
    pt.setSrsName("urn:ogc:def:crs:epsg:7.4:27582");
    PropertyType property = new PropertyType(new ValueReference(), pt);
    UpdateType update = new UpdateType(null, Arrays.asList(property), filter, new QName("http://www.opengis.net/gml", "NamedPlaces"), null);
    final ObjectFactory factory = new ObjectFactory();
    transac.getAbstractTransactionAction().add(factory.createUpdate(update));
    sw = new StringWriter();
    marshaller.marshal(transac, sw);
    final List<StoredQueryDescription> descriptions = new ArrayList<>();
    final ParameterExpressionType param = new ParameterExpressionType("param1", "parameter 1", "a test parameter", new QName("http://www.w3.org/2001/XMLSchema", "string", "xs"));
    final List<QName> types = Arrays.asList(new QName("http://test.com", "someType"));
    final QueryType query = new QueryType(filter, types, "2.0.0");
    final QueryExpressionTextType queryEx = new QueryExpressionTextType("urn:ogc:def:queryLanguage:OGC-WFS::WFS_QueryExpression", query, types);
    final StoredQueryDescriptionType des1 = new StoredQueryDescriptionType("query1", "title1", "abstract1", param, queryEx);
    descriptions.add(des1);
    final StoredQueries storesQueries = new StoredQueries(descriptions);
    sw = new StringWriter();
    marshaller.marshal(storesQueries, sw);
    // System.out.println(sw.toString());
    StoredQueryListItemType item = new StoredQueryListItemType("someid", Arrays.asList(new Title("some title")), null);
    ListStoredQueriesResponseType lsqr = new ListStoredQueriesResponseType(Arrays.asList(item));
    sw = new StringWriter();
    marshaller.marshal(lsqr, sw);
    System.out.println(sw.toString());
    item = new StoredQueryListItemType("someid", Arrays.asList(new Title("some title")), Arrays.asList(new QName("")));
    lsqr = new ListStoredQueriesResponseType(Arrays.asList(item));
    sw = new StringWriter();
    marshaller.marshal(lsqr, sw);
    System.out.println(sw.toString());
}
Also used : DirectPositionType(org.geotoolkit.gml.xml.v321.DirectPositionType) ArrayList(java.util.ArrayList) StringWriter(java.io.StringWriter) WGS84BoundingBoxType(org.geotoolkit.ows.xml.v110.WGS84BoundingBoxType) QName(javax.xml.namespace.QName) FilterType(org.geotoolkit.ogc.xml.v200.FilterType) PointType(org.geotoolkit.gml.xml.v321.PointType) PropertyIsLikeType(org.geotoolkit.ogc.xml.v200.PropertyIsLikeType)

Aggregations

PointType (org.geotoolkit.gml.xml.v311.PointType)15 ArrayList (java.util.ArrayList)14 DirectPositionType (org.geotoolkit.gml.xml.v311.DirectPositionType)14 Test (org.junit.Test)13 StringWriter (java.io.StringWriter)9 JAXBElement (javax.xml.bind.JAXBElement)9 PointType (net.opengis.gml.v_3_1_1.PointType)9 PointType (org.geotoolkit.gml.xml.v321.PointType)8 Geometry (org.locationtech.jts.geom.Geometry)8 Coordinate (org.locationtech.jts.geom.Coordinate)7 Point (org.locationtech.jts.geom.Point)6 StringReader (java.io.StringReader)5 List (java.util.List)5 DistanceBufferType (net.opengis.filter.v_1_1_0.DistanceBufferType)4 FeaturePropertyType (org.geotoolkit.gml.xml.v311.FeaturePropertyType)4 SamplingPointType (org.geotoolkit.sampling.xml.v100.SamplingPointType)4 LineString (org.locationtech.jts.geom.LineString)4 LineString (com.vividsolutions.jts.geom.LineString)3 MultiLineString (com.vividsolutions.jts.geom.MultiLineString)3 QName (javax.xml.namespace.QName)3