All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.opentripplanner.api.model.GeometryAdapter Maven / Gradle / Ivy

package org.opentripplanner.api.model;

import javax.xml.bind.annotation.adapters.XmlAdapter;

import org.opentripplanner.common.geometry.GeometryUtils;

import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.io.WKTReader;
import org.locationtech.jts.io.gml2.GMLWriter;

public class GeometryAdapter extends XmlAdapter {
    public Geometry unmarshal(String val) throws Exception {
        return new WKTReader(GeometryUtils.getGeometryFactory()).read(val);
    }
    public String marshal(Geometry val) throws Exception {
        GMLWriter writer = new GMLWriter();
        writer.setNamespace(false);
        return writer.write(val);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy