46 #include <boost/test/unit_test.hpp> 60 std::string url =
"http://demo.geo-solutions.it/geoserver/ows";
63 std::string version =
"1.3.0";
67 std::string connInfo(
"wms://?URI=" + encodedURL +
"&VERSION=" + version +
"&USERDATADIR=" + usrDataDir);
73 BOOST_CHECK(ds->isOpened());
86 std::string url =
"http://demo.geo-solutions.it/geoserver/ows";
91 std::string version =
"1.3.0";
99 BOOST_CHECK(ds.get() ==
nullptr);
101 connInfo =
"wms://?URI=" + encodedURL;
107 connInfo =
"wms://?VERSION=" + version;
113 connInfo =
"wms://?USERDATADIR=" + usrDataDir;
119 connInfo =
"wms://?URI=" + encodedURL +
"&VERSION=" + version;
125 connInfo =
"wms://?URI=" + encodedURL +
"&USERDATADIR=" + usrDataDir;
131 connInfo =
"wms://?VERSION=" + version +
"&USERDATADIR=" + usrDataDir;
148 std::string url =
"http://demo.geo-solutions.it/geoserver/ows";
151 std::string version =
"1.3.0";
155 std::string connInfo(
"wms://?URI=" + encodedURL +
"&VERSION=" + version +
"&USERDATADIR=" + usrDataDir);
163 std::shared_ptr<te::ws::ogc::WMSClient> client = wmsDs->
getWMSClient();
167 std::vector<te::ws::ogc::wms::Layer> layers = capability.
m_layer.
m_layers;
171 for(
size_t i = 0; i < layers.size(); i++)
173 if(layers[i].m_name ==
"tasmania")
175 request.
m_layers.push_back(layers[i].m_name);
177 if(layers[i].m_styles.size() > 0)
179 request.
m_styles.push_back(layers[i].m_styles[0].m_name);
182 request.
m_srs =
"EPSG:4326";
186 bbox.
m_maxX = layers[i].m_geoBoundingBox.m_eastBoundLongitude;
187 bbox.
m_maxY = layers[i].m_geoBoundingBox.m_northBoundLatitude;
188 bbox.
m_minX = layers[i].m_geoBoundingBox.m_westBoundLongitude;
189 bbox.
m_minY = layers[i].m_geoBoundingBox.m_southBoundLatitude;
197 BOOST_CHECK(request.
m_layers.size() == 1);
201 BOOST_CHECK(response.m_buffer.empty() ==
false);
202 BOOST_CHECK(response.m_size > 0);
203 BOOST_CHECK(response.m_format ==
"image/png");
216 std::string url =
"http://demo.geo-solutions.it/geoserver/ows";
219 std::string version =
"1.3.0";
223 std::string connInfo(
"wms://?URI=" + encodedURL +
"&VERSION=" + version +
"&USERDATADIR=" + usrDataDir);
231 std::shared_ptr<te::ws::ogc::WMSClient> client = wmsDs->
getWMSClient();
235 std::vector<te::ws::ogc::wms::Layer> layers = capability.
m_layer.
m_layers;
239 for(
size_t i = 0; i < layers.size(); i++)
241 if(layers[i].m_name ==
"tasmania")
243 request.
m_layers.push_back(layers[i].m_name);
245 if(layers[i].m_styles.size() > 0)
247 request.
m_styles.push_back(layers[i].m_styles[0].m_name);
250 request.
m_srs =
"EPSG:4326";
254 bbox.
m_maxX = layers[i].m_geoBoundingBox.m_eastBoundLongitude;
255 bbox.
m_maxY = layers[i].m_geoBoundingBox.m_northBoundLatitude;
256 bbox.
m_minX = layers[i].m_geoBoundingBox.m_westBoundLongitude;
257 bbox.
m_minY = layers[i].m_geoBoundingBox.m_southBoundLatitude;
265 BOOST_CHECK(request.
m_layers.size() == 1);
267 std::string imageDiskPath = wmsDs->
saveGetMap(request,
"test_image.png");
269 std::string expectedResult = usrDataDir + std::string(
"/wms/") +
"test_image.png";
271 BOOST_CHECK(imageDiskPath == expectedResult);
static std::unique_ptr< DataSource > make(const std::string &driver, const te::core::URI &connInfo)
std::vector< std::string > m_layers
This is the factory for WMS data sources.
TECOREEXPORT std::string URIEncode(const std::string &srcUri)
Encodes an decoded URI. The algorithm implementation is based on http://www.codeguru.com/cpp/cpp/algorithms/strings/article.php/c12759/URI-Encoding-and-Decoding.htm.
TEOGCWMSDATAACCESSEXPORT te::da::DataSource * Build(const te::core::URI &uri)
An abstract class for data providers like a DBMS, Web Services or a regular file. ...
This XML Schema Document named xlinks xsd has been stored here based on the change request
The Capability WMS 1.3.0 struct.
This is a singleton for managing all data source instances available in the system.
const std::string saveGetMap(const te::ws::ogc::wms::WMSGetMapRequest &request, const std::string &filename)
It execute a WMS GetMap and save the result image on disk. The request will be based on WMSGetMapRequ...
std::shared_ptr< te::ws::ogc::WMSClient > getWMSClient()
static te::dt::Date ds(2010, 01, 01)
std::vector< Layer > m_layers
BOOST_AUTO_TEST_CASE(datasource_open_test)
Data Source for WS OGC WMS.
static ApplicationController & getInstance()
It returns a reference to the singleton instance.
std::vector< std::string > m_styles
BoundingBox m_boundingBox
A factory for data sources.
The WMSGetMapResponse WMS 1.3.0 struct.
Base exception class for WS Core Runtime Library.
Implementation of the data source for the WMS driver.
This file contains utility functions used to manipulate data from a URI.
te::ws::ogc::wms::WMSGetMapResponse getMap(const te::ws::ogc::wms::WMSGetMapRequest &request)
Exception classes for the WS Core Runtime Library.
#define TE_OGC_WMS_DRIVER_IDENTIFIER
The OGC WMS driver identifier string.
static void add(const std::string &dsType, FactoryFnctType f)
Specifies containers for WMS data types.
The base API for controllers of TerraLib applications.
Configuration flags for the Terrralib WS OGC WMS DATA ACCESS module.
The WMSGetMapRequest WMS 1.3.0 struct.
The BoundingBox WMS 1.3.0 struct.