Java Code Examples for org.locationtech.jts.geom.MultiPolygon#setSRID()
The following examples show how to use
org.locationtech.jts.geom.MultiPolygon#setSRID() .
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: RuleReaderServiceImplTest.java From geofence with GNU General Public License v2.0 | 5 votes |
protected MultiPolygon buildMultiPolygon(String multip) { try { WKTReader reader = new WKTReader(); MultiPolygon mp = (MultiPolygon) reader.read(multip); mp.setSRID(4326); return mp; } catch (ParseException ex) { throw new RuntimeException("Unexpected exception: " + ex.getMessage(), ex); } }
Example 2
Source File: ServiceTestBase.java From geofence with GNU General Public License v2.0 | 5 votes |
protected MultiPolygon parseMultiPolygon(String wkt) { try { WKTReader wktReader = new WKTReader(); MultiPolygon the_geom = (MultiPolygon) wktReader.read(wkt); the_geom.setSRID(4326); return the_geom; } catch (ParseException e) { throw new IllegalArgumentException("Unparsabe WKT", e); } }
Example 3
Source File: BaseDAOTest.java From geofence with GNU General Public License v2.0 | 5 votes |
protected MultiPolygon buildMultiPolygon() { try { WKTReader reader = new WKTReader(); MultiPolygon mp = (MultiPolygon) reader.read(MULTIPOLYGONWKT); mp.setSRID(4326); return mp; } catch (ParseException ex) { throw new RuntimeException("Unexpected exception: " + ex.getMessage(), ex); } }
Example 4
Source File: XMultiPolygonAdapter.java From geofence with GNU General Public License v2.0 | 5 votes |
@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 5
Source File: GeometryUtility.java From geofence with GNU General Public License v2.0 | 5 votes |
/** * 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 6
Source File: GeometryUtility.java From geofence with GNU General Public License v2.0 | 5 votes |
/** * 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 7
Source File: GeometryUtility.java From geofence with GNU General Public License v2.0 | 5 votes |
/** * 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); }
Example 8
Source File: GeoJSONTest.java From arctic-sea with Apache License 2.0 | 4 votes |
private MultiPolygon randomMultiPolygon(int srid) { MultiPolygon geometry = geometryFactory .createMultiPolygon(new Polygon[] { randomPolygon(srid), randomPolygon(srid), randomPolygon(srid) }); geometry.setSRID(srid); return geometry; }