Java Code Examples for org.locationtech.jts.geom.MultiPolygon#getSRID()

The following examples show how to use org.locationtech.jts.geom.MultiPolygon#getSRID() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XMultiPolygonAdapter.java    From geofence with GNU General Public License v2.0 5 votes vote down vote up
@Override
public String marshal(MultiPolygon the_geom) throws ParseException {
    if (the_geom != null) {
        WKTWriter wktWriter = new WKTWriter();
        if (the_geom.getSRID() == 0)
            the_geom.setSRID(4326);

        return wktWriter.write(the_geom);
    } else {
        throw new ParseException("Geometry obj is null.");
    }
}
 
Example 2
Source File: GeometryUtility.java    From geofence with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates the multi polygon.
 *
 * @param pol
 *            the pol
 * @return the multi polygon
 */
public MultiPolygon createMultiPolygon(Polygon[] pol)
{
    MultiPolygon multiPoly = this.factory.createMultiPolygon(pol);
    if (multiPoly.getSRID() == 0)
    {
        multiPoly.setSRID(4326);
    }

    return multiPoly;
}
 
Example 3
Source File: GeometryUtility.java    From geofence with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates the multi polygon.
 *
 * @param wkt
 *            the wkt
 * @return the multi polygon
 * @throws ParseException
 *             the parse exception
 */
public MultiPolygon createMultiPolygon(String wkt) throws ParseException
{
    MultiPolygon multiPoly = this.multiPolAdapter.unmarshal(wkt);
    if (multiPoly.getSRID() == 0)
    {
        multiPoly.setSRID(4326);
    }

    return multiPoly;
}
 
Example 4
Source File: GeometryUtility.java    From geofence with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates the wkt from multi polygon.
 *
 * @param multiPoly
 *            the multi poly
 * @return the string
 * @throws ParseException
 *             the parse exception
 */
public String createWKTFromMultiPolygon(MultiPolygon multiPoly) throws ParseException
{
    if (multiPoly.getSRID() == 0)
    {
        multiPoly.setSRID(4326);
    }

    return this.multiPolAdapter.marshal(multiPoly);
}