Examples of CRSEnvelope


Examples of org.geotools.data.ows.CRSEnvelope

                // env = layer.getLatLonBoundingBox();
                env = layer.getEnvelope(crs);
            } else {
                GeneralEnvelope layerDefinedEnv = layer.getEnvelope(DefaultGeographicCRS.WGS84);

                CRSEnvelope bbox;
                String epsg4326 = "EPSG:4326"; //$NON-NLS-1$
                String epsg4269 = "EPSG:4269"; //$NON-NLS-1$

                if (boundingBoxes.size() < 4) {
                    // This is a silly heuristic but the idea is that if there are only a few bboxes
                    // then one of them is likely the *natural* crs and that crs should be used.

                    bbox = boundingBoxes.values().iterator().next();
                } else if (boundingBoxes.containsKey(epsg4326)) {
                    bbox = boundingBoxes.get(epsg4326);
                } else if (boundingBoxes.containsKey(epsg4269)) {
                    bbox = boundingBoxes.get(epsg4269);
                } else {
                    bbox = boundingBoxes.values().iterator().next();
                }
                try {
                    if (bbox.getEPSGCode().equals(epsg4269) || bbox.getEPSGCode().equals(epsg4326)) {
                        // It is lat long so lets use the layer definition
                        env = layerDefinedEnv;
                        crs = DefaultGeographicCRS.WGS84;
                    } else {
                        crs = CRS.decode(bbox.getEPSGCode());
                        env = new ReferencedEnvelope(bbox.getMinX(), bbox.getMaxX(),
                                bbox.getMinY(), bbox.getMaxY(), crs);
                    }
                } catch (NoSuchAuthorityCodeException e) {
                    crs = DefaultGeographicCRS.WGS84;
                    env = layer.getEnvelope(crs);
                } catch (FactoryException e) {
View Full Code Here

Examples of org.geotools.data.ows.CRSEnvelope

        Map<String, CRSEnvelope> boundingBoxes = layer.getBoundingBoxes();
        if (boundingBoxes.isEmpty()) {
            crs = DefaultGeographicCRS.WGS84;
            env = layer.getEnvelope(crs);
        } else {
            CRSEnvelope bbox;
            String epsg4326 = "EPSG:4326"; //$NON-NLS-1$
            String epsg4269 = "EPSG:4269"; //$NON-NLS-1$
            if (boundingBoxes.containsKey(epsg4326)) {
                bbox = (CRSEnvelope) boundingBoxes.get(epsg4326);
            } else if (boundingBoxes.containsKey(epsg4269)) {
                bbox = (CRSEnvelope) boundingBoxes.get(epsg4269);
            } else {
                bbox = (CRSEnvelope) boundingBoxes.values().iterator().next();
            }
            try {
                crs = CRS.decode(bbox.getEPSGCode());
                env = new ReferencedEnvelope(bbox.getMinX(), bbox.getMaxX(), bbox.getMinY(),
                        bbox.getMaxY(), crs);
            } catch (NoSuchAuthorityCodeException e) {
                crs = DefaultGeographicCRS.WGS84;
                env = layer.getEnvelope(crs);
            } catch (FactoryException e) {
                crs = DefaultGeographicCRS.WGS84;
View Full Code Here

Examples of org.geotools.data.ows.CRSEnvelope

            double minX = bounds.getMinimum(0);
            double maxX = bounds.getMaximum(0);
            double minY = bounds.getMinimum(1);
            double maxY = bounds.getMaximum(1);
   
            CRSEnvelope bbox = new CRSEnvelope(srs, minX, minY, maxX, maxY);
            tileset.setBoundingBox(bbox);
            tileset.setCoorindateReferenceSystem(srs);
   
            Map<String, Serializable> properties = resource.getPersistentProperties();
            Integer width = Integer.parseInt((String) properties.get(PreferenceConstants.P_TILESET_WIDTH));
View Full Code Here

Examples of org.geotools.data.ows.CRSEnvelope

    assertEquals(10.0, ScaleUtils.calculateClosestScale(SCALES, 30.0, .7),0.0001);
  }
 
  @Test
  public void calculateResolutions(){
      ReferencedEnvelope envelope = new ReferencedEnvelope(new CRSEnvelope("WGS84(DD)", //$NON-NLS-1$
              143.83482400000003, -43.648056, 148.47914100000003, -39.573891));

      assertEquals(0.009015193399753197, ScaleUtils.calculateResolutionFromScale(envelope, 1000000.0, 256),0.0001);
      assertEquals(9.015193399753199E-4, ScaleUtils.calculateResolutionFromScale(envelope, 100000.0, 256),0.0001);
      assertEquals(4.5075966998765993E-4, ScaleUtils.calculateResolutionFromScale(envelope, 50000.0, 256),0.0001);
View Full Code Here

Examples of org.geotools.data.ows.CRSEnvelope

         * org.geotools.xml.schema.ElementValue[], org.xml.sax.Attributes, java.util.Map)
         */
        @SuppressWarnings("unchecked")
        public Object getValue( Element element, ElementValue[] value, Attributes attrs, Map hints )
                throws SAXException, OperationNotSupportedException {
            CRSEnvelope bbox = new CRSEnvelope();

            String crs = attrs.getValue("CRS"); //$NON-NLS-1$
            if (crs == null || crs.length() == 0) {
                crs = attrs.getValue("crs"); //$NON-NLS-1$
            }
            if (crs == null || crs.length() == 0) {
                crs = attrs.getValue("SRS"); //$NON-NLS-1$
            }
            if (crs == null || crs.length() == 0) {
                crs = attrs.getValue("srs"); //$NON-NLS-1$
            }

            if (crs == null || crs.length() == 0) {
                throw new SAXException("Bounding Box element contains no CRS/SRS attribute"); //$NON-NLS-1$
            }

            bbox.setEPSGCode(crs.toUpperCase());
            bbox.setMinX(Double.parseDouble(attrs.getValue("minx"))); //$NON-NLS-1$
            bbox.setMaxX(Double.parseDouble(attrs.getValue("maxx"))); //$NON-NLS-1$
            bbox.setMinY(Double.parseDouble(attrs.getValue("miny"))); //$NON-NLS-1$
            bbox.setMaxY(Double.parseDouble(attrs.getValue("maxy"))); //$NON-NLS-1$

            return bbox;
        }
View Full Code Here

Examples of org.geotools.data.ows.CRSEnvelope

                    String srs = (String) value[i].getValue();
                    tileset.setCoorindateReferenceSystem(srs);
                }

                if (sameName(elems[1], value[i])) {
                    CRSEnvelope bbox = (CRSEnvelope) value[i].getValue();
                    tileset.setBoundingBox(bbox);
                }

                if (sameName(elems[2], value[i])) {
                    String resolutions = (String) value[i].getValue();
View Full Code Here

Examples of org.geotools.data.ows.CRSEnvelope

                GridSubsetFactory.createGridSubSet(gridSetBroker.WORLD_EPSG3857, bounds3785, 0, 30));

        if (additionalBounds != null && additionalBounds.size() > 0) {
            Iterator<CRSEnvelope> iter = additionalBounds.values().iterator();
            while (iter.hasNext()) {
                CRSEnvelope env = iter.next();
                SRS srs = null;
                if (env.getEPSGCode() != null) {
                    srs = SRS.getSRS(env.getEPSGCode());
                }

                if (srs == null) {
                    log.error(env.toString() + " has no EPSG code");
                } else if (srs.getNumber() == 4326 || srs.getNumber() == 900913
                        || srs.getNumber() == 3857) {
                    log.debug("Skipping " + srs.toString() + " for " + name);
                } else {
                    String gridSetName = name + ":" + srs.toString();
                    BoundingBox extent = new BoundingBox(env.getMinX(), env.getMinY(),
                            env.getMaxX(), env.getMaxY());

                    GridSet gridSet = GridSetFactory.createGridSet(gridSetName, srs, extent, false,
                            25, null, 0.00028, 256, 256, false);
                    grids.put(gridSetName, GridSubsetFactory.createGridSubSet(gridSet));
                }
View Full Code Here

Examples of org.geotools.data.ows.CRSEnvelope

     *      java.util.Map)
     */
    public Object getValue(Element element, ElementValue[] value,
        Attributes attrs, Map hints) throws SAXException,
        OperationNotSupportedException {
      CRSEnvelope bbox = new CRSEnvelope();

      bbox.setMinX(Double.parseDouble(attrs.getValue("minx")));
      bbox.setMaxX(Double.parseDouble(attrs.getValue("maxx")));
      bbox.setMinY(Double.parseDouble(attrs.getValue("miny")));
      bbox.setMaxY(Double.parseDouble(attrs.getValue("maxy")));

      return bbox;
    }
View Full Code Here

Examples of org.geotools.data.ows.CRSEnvelope

     *      java.util.Map)
     */
    public Object getValue(Element element, ElementValue[] value,
        Attributes attrs, Map hints) throws SAXException,
        OperationNotSupportedException {
      CRSEnvelope bbox = new CRSEnvelope();

      String crs = attrs.getValue("CRS");
      if (crs == null || crs.length() == 0) {
        crs = attrs.getValue("SRS");

        if (crs == null || crs.length() == 0) {
          throw new SAXException(
              "Bounding Box element contains no CRS/SRS attribute");
        }
      }

      bbox.setEPSGCode(crs.toUpperCase());
      bbox.setMinX(Double.parseDouble(attrs.getValue("minx")));
      bbox.setMaxX(Double.parseDouble(attrs.getValue("maxx")));
      bbox.setMinY(Double.parseDouble(attrs.getValue("miny")));
      bbox.setMaxY(Double.parseDouble(attrs.getValue("maxy")));

      return bbox;
    }
View Full Code Here

Examples of org.geotools.data.ows.CRSEnvelope

            assertTrue(layer.getSrs().contains("EPSG:42304"));
            assertTrue(layer.getSrs().contains("EPSG:42101"));
            assertTrue(layer.getSrs().contains("EPSG:4269"));
            assertTrue(layer.getSrs().contains("EPSG:4326"));
           
            CRSEnvelope llbbox = layer.getLatLonBoundingBox();
            validateBoundingBox(llbbox, -172.367, 35.6673, -11.5624, 83.8293);
           
           
            assertEquals(layer.getBoundingBoxes().size(), 1);
            assertNotNull(layer.getBoundingBoxes().get("EPSG:42304"));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.