Search in sources :

Example 41 with DirectPositionType

use of org.geotoolkit.gml.xml.v311.DirectPositionType in project arctic-sea by 52North.

the class GmlEncoderv321 method createPointFromJtsGeometry.

/**
 * Creates a XML Point from a SOS Point.
 *
 * @param jtsPoint
 *            SOS Point
 * @param xbPoint
 *            XML Point
 */
private void createPointFromJtsGeometry(Point jtsPoint, PointType xbPoint) {
    DirectPositionType xbPos = xbPoint.addNewPos();
    xbPos.setSrsName(getSrsName(jtsPoint));
    xbPos.setStringValue(JTSHelper.getCoordinatesString(jtsPoint));
}
Also used : DirectPositionType(net.opengis.gml.x32.DirectPositionType)

Example 42 with DirectPositionType

use of org.geotoolkit.gml.xml.v311.DirectPositionType in project geo-platform by geosdi.

the class AreaSearchRequestFilter method createEnvelope.

/**
 * @param bbox
 * @return {@link EnvelopeType}
 */
private EnvelopeType createEnvelope(BBox bbox) {
    EnvelopeType envelope = new EnvelopeType();
    DirectPositionType lower = new DirectPositionType();
    lower.setValue(Arrays.asList(bbox.getMinX(), bbox.getMinY()));
    envelope.setLowerCorner(lower);
    DirectPositionType upper = new DirectPositionType();
    upper.setValue(Arrays.asList(bbox.getMaxX(), bbox.getMaxY()));
    envelope.setUpperCorner(upper);
    return envelope;
}
Also used : EnvelopeType(org.geosdi.geoplatform.xml.gml.v311.EnvelopeType) DirectPositionType(org.geosdi.geoplatform.xml.gml.v311.DirectPositionType)

Example 43 with DirectPositionType

use of org.geotoolkit.gml.xml.v311.DirectPositionType 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 44 with DirectPositionType

use of org.geotoolkit.gml.xml.v311.DirectPositionType 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 45 with DirectPositionType

use of org.geotoolkit.gml.xml.v311.DirectPositionType 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

DirectPositionType (org.geotoolkit.gml.xml.v311.DirectPositionType)24 ArrayList (java.util.ArrayList)14 PointType (org.geotoolkit.gml.xml.v311.PointType)14 Test (org.junit.Test)11 StringWriter (java.io.StringWriter)10 DirectPositionType (net.opengis.gml.v_3_1_1.DirectPositionType)10 DirectPositionType (org.geotoolkit.gml.xml.v321.DirectPositionType)10 EnvelopeType (org.geotoolkit.gml.xml.v311.EnvelopeType)9 StringReader (java.io.StringReader)8 JAXBElement (javax.xml.bind.JAXBElement)8 EnvelopeType (net.opengis.gml.v_3_1_1.EnvelopeType)7 Geometry (org.locationtech.jts.geom.Geometry)7 Coordinate (org.locationtech.jts.geom.Coordinate)6 BBOXType (net.opengis.filter.v_1_1_0.BBOXType)5 CoordinateReferenceSystem (org.opengis.referencing.crs.CoordinateReferenceSystem)5 DirectPositionType (net.opengis.gml.x32.DirectPositionType)4 FeaturePropertyType (org.geotoolkit.gml.xml.v311.FeaturePropertyType)4 SamplingPointType (org.geotoolkit.sampling.xml.v100.SamplingPointType)4 FilterType (net.opengis.filter.v_1_1_0.FilterType)3 DirectPositionType (net.opengis.gml.v_3_2_1.DirectPositionType)3