Expose nativeCRS attribute of a resource. Close #131. Close #132.

This commit is contained in:
etj 2014-07-10 17:17:35 +02:00
parent 2526337e7d
commit b60e487ffa
2 changed files with 18 additions and 3 deletions

View File

@ -1,7 +1,7 @@
/*
* GeoServer-Manager - Simple Manager Library for GeoServer
*
* Copyright (C) 2007,2011 GeoSolutions S.A.S.
* Copyright (C) 2007,2014 GeoSolutions S.A.S.
* http://www.geo-solutions.it
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
@ -42,7 +42,7 @@ import org.jdom.Namespace;
/**
* Parse a resource (FeatureType or Coverage) returned as XML REST objects.
*
* @author etj
* @author Emanuele Tajariol <etj at geo-solutions.it>
* @author Emmanuel Blondel - emmanuel.blondel1@gmail.com | emmanuel.blondel@fao.org
* @author Henry Rotzoll
*
@ -109,7 +109,11 @@ public class RESTResource {
Namespace.getNamespace("atom", "http://www.w3.org/2005/Atom"));
return atom.getAttributeValue("href");
}
public String getNativeCRS() {
return rootElem.getChildText("nativeCRS");
}
public RESTBoundingBox getNativeBoundingBox() {
RESTBoundingBox bbox = null;
Element bboxElement = rootElem.getChild("nativeBoundingBox");

View File

@ -82,6 +82,17 @@ public class ResourceDecoderTest {
"http://localhost:8080/geoserver/rest/workspaces/topp/coveragestores/granuleTestMosaic.xml");
}
@Test
public void testNativeCRS() {
String expectedCrs = "GEOGCS[\"WGS 84\", \r\n DATUM[\"World Geodetic\n System 1984\", \r\n"
+" SPHEROID[\"WGS 84\", 6378137.0,\n 298.257223563,\n AUTHORITY[\"EPSG\",\"7030\"]], \r\n"
+" AUTHORITY[\"EPSG\",\"6326\"]], \r\n PRIMEM[\"Greenwich\", 0.0,\n AUTHORITY[\"EPSG\",\"8901\"]], \r\n"
+" UNIT[\"degree\", 0.017453292519943295], \r\n AXIS[\"Geodetic longitude\", EAST], \r\n"
+" AXIS[\"Geodetic\n latitude\", NORTH], \r\n AUTHORITY[\"EPSG\",\"4326\"]]";
Assert.assertEquals(expectedCrs, coverage.getNativeCRS());
}
@Test
public void testCRS() {
Assert.assertEquals(coverage.getCRS(), "EPSG:4326");