--- dao/FuldDaekningWorker/src/dk/daoas/fulddaekning/BoundingBox.java 2014/09/11 08:14:40 2200 +++ dao/FuldDaekningWorker/src/dk/daoas/fulddaekning/BoundingBox.java 2014/12/10 07:36:40 2239 @@ -27,11 +27,24 @@ } public void validateBbox() throws BoundingBoxException { - if ( Math.abs(latitudeMax-latitudeMin)> 1.0) - throw new BoundingBoxException("For stor latitude forskel"); - if ( Math.abs(longitudeMax-longitudeMin)> 1.0) - throw new BoundingBoxException("For stor longitude forskel"); + double latDiff = Math.abs(latitudeMax - latitudeMin); + if ( latDiff > 1.0) { + throw new BoundingBoxException("For stor latitude forskel / " + latDiff); + } + + double lngDiff = Math.abs(longitudeMax - longitudeMin); + if ( lngDiff > 1.0) { + throw new BoundingBoxException("For stor longitude forskel / " + lngDiff); + } + + GeoPoint min = new GeoPoint(latitudeMin, longitudeMin); + GeoPoint max = new GeoPoint(latitudeMax, longitudeMax); + double afstand = GeoPoint.beregnAfstand(min, max); + + if (afstand >= 80.0) { //hvis cross afstand er over 80 km - så er postnummeret for stort + throw new BoundingBoxException("For stor cross afstand " + afstand); + } } public void adjustToMargin() {