Example #1
0
 /**
  * Switch the coordinate axis of geometry from or for datasource
  *
  * @param geom Geometry to switch coordinate axis
  * @return Geometry with switched coordinate axis if needed
  * @throws OwsExceptionReport If coordinate axis switching fails
  */
 public Geometry switchCoordinateAxisFromToDatasourceIfNeeded(final Geometry geom)
     throws OwsExceptionReport {
   if (geom != null && !geom.isEmpty()) {
     if (isDatasourceNorthingFirst()) {
       if (!isNorthingFirstEpsgCode(geom.getSRID())) {
         return JTSHelper.switchCoordinateAxisOrder(geom);
       }
       return geom;
     } else {
       if (isNorthingFirstEpsgCode(geom.getSRID())) {
         return JTSHelper.switchCoordinateAxisOrder(geom);
       }
       return geom;
     }
   }
   return geom;
 }
Example #2
0
 /**
  * Switch Geometry coordinates if necessary
  *
  * @param geom Geometry to switch coordinates
  * @return Geometry with switched coordinates
  * @throws OwsExceptionReport If an error occurs
  */
 @Deprecated
 public Geometry switchCoordinateAxisOrderIfNeeded(final Geometry geom) throws OwsExceptionReport {
   if (geom != null
       && isNorthingFirstEpsgCode(geom.getSRID() == 0 ? getStorageEPSG() : geom.getSRID())) {
     return JTSHelper.switchCoordinateAxisOrder(geom);
   } else {
     return geom;
   }
 }
Example #3
0
 private Geometry switchCoordinateAxisIfNeeded(Geometry geometry, int targetSRID)
     throws OwsExceptionReport {
   if (geometry != null && !geometry.isEmpty()) {
     if ((isNorthingFirstEpsgCode(geometry.getSRID()) && isNorthingFirstEpsgCode(targetSRID))
         || (isEastingFirstEpsgCode(geometry.getSRID()) && isEastingFirstEpsgCode(targetSRID))) {
       return geometry;
     }
     return JTSHelper.switchCoordinateAxisOrder(geometry);
   }
   return geometry;
 }
 private List<StreetDistance> createStreetDistance(int numberOfResults) {
   List<StreetDistance> results = new ArrayList<StreetDistance>();
   for (int i = 0; i < numberOfResults; i++) {
     StreetDistance streetDistance =
         StreetDistanceBuilder.streetDistance()
             .withName("name" + i)
             .withCountryCode("FR")
             .withDistance(new Double(i))
             .withGid(new Long(i))
             .withIsIn("city")
             .withLocation(JTSHelper.createPoint(new Float(i + 20), new Float(i + 10)))
             .withLength(new Double(i))
             .build();
     results.add(streetDistance);
   }
   return results;
 }