|
@@ -11,6 +11,9 @@ |
|
@@ -11,6 +11,9 @@ |
11
|
#include "dmpserverrequest.h"
|
11
|
#include "dmpserverrequest.h"
|
12
|
#include "dmpserverproject.h"
|
12
|
#include "dmpserverproject.h"
|
13
|
#include "dmpmapserverutil.h"
|
13
|
#include "dmpmapserverutil.h"
|
|
|
14
|
+#include "dmppgsqlsourcepools.h"
|
|
|
15
|
+
|
|
|
16
|
+using namespace mapserver;
|
14
|
namespace DmpWms
|
17
|
namespace DmpWms
|
15
|
{
|
18
|
{
|
16
|
void writeGetCapabilities( const DmpServerContext &context, const DmpWmsParameters& params,
|
19
|
void writeGetCapabilities( const DmpServerContext &context, const DmpWmsParameters& params,
|
|
@@ -66,7 +69,7 @@ namespace DmpWms |
|
@@ -66,7 +69,7 @@ namespace DmpWms |
66
|
// xmlRoot.add("<xmlattr>.xmlns","http://www.opengis.net/wms");
|
69
|
// xmlRoot.add("<xmlattr>.xmlns","http://www.opengis.net/wms");
|
67
|
// xmlRoot.add("<xmlattr>.xmlns:sld","http://www.opengis.net/sld");
|
70
|
// xmlRoot.add("<xmlattr>.xmlns:sld","http://www.opengis.net/sld");
|
68
|
// xmlRoot.add("<xmlattr>.xsi:schemaLocation","http://www.opengis.net/wms http://schemas.opengis.net/wms/1.3.0/capabilities_1_3_0.xsd http://www.opengis.net/sld http://schemas.opengis.net/sld/1.1.0/sld_capabilities.xsd");
|
71
|
// xmlRoot.add("<xmlattr>.xsi:schemaLocation","http://www.opengis.net/wms http://schemas.opengis.net/wms/1.3.0/capabilities_1_3_0.xsd http://www.opengis.net/sld http://schemas.opengis.net/sld/1.1.0/sld_capabilities.xsd");
|
69
|
- xmlRoot.add("<xmlattr>.version", version);
|
72
|
+ xmlRoot.add("<xmlattr>.version", "1.3.0");
|
70
|
}
|
73
|
}
|
71
|
|
74
|
|
72
|
boost::property_tree::ptree ptService;
|
75
|
boost::property_tree::ptree ptService;
|
|
@@ -147,14 +150,9 @@ namespace DmpWms |
|
@@ -147,14 +150,9 @@ namespace DmpWms |
147
|
|
150
|
|
148
|
void addCapabilitiesLayers(boost::property_tree::ptree &pt,const DmpProject* project, std::string& name, std::string& title)
|
151
|
void addCapabilitiesLayers(boost::property_tree::ptree &pt,const DmpProject* project, std::string& name, std::string& title)
|
149
|
{
|
152
|
{
|
|
|
153
|
+
|
150
|
std::string srs = "EPSG:" + std::__cxx11::to_string(project->crs().srid());
|
154
|
std::string srs = "EPSG:" + std::__cxx11::to_string(project->crs().srid());
|
151
|
|
155
|
|
152
|
- boost::property_tree::ptree ptProject;
|
|
|
153
|
- // ptProject.add("<xmlattr>.queryable","1");
|
|
|
154
|
- ptProject.add("Name", name);
|
|
|
155
|
- ptProject.add("Title", title);
|
|
|
156
|
- ptProject.add("CRS", srs);
|
|
|
157
|
-
|
|
|
158
|
|
156
|
|
159
|
double minx,miny,maxx,maxy;
|
157
|
double minx,miny,maxx,maxy;
|
160
|
|
158
|
|
|
@@ -162,12 +160,25 @@ namespace DmpWms |
|
@@ -162,12 +160,25 @@ namespace DmpWms |
162
|
for (int i=0; i<vectorLayers.size(); i++)
|
160
|
for (int i=0; i<vectorLayers.size(); i++)
|
163
|
{
|
161
|
{
|
164
|
DmpMapLayer* layer = vectorLayers[i];
|
162
|
DmpMapLayer* layer = vectorLayers[i];
|
|
|
163
|
+ DmpVectorLayer* vectorLayer = (DmpVectorLayer*)layer;
|
|
|
164
|
+ if( vectorLayer->srid().empty())
|
|
|
165
|
+ {
|
|
|
166
|
+ shared_ptr<mapserver::DmpPgsql> pPgsqlConn = mapserver::DmpPgsqlSourcePools::get_instance()->GetPgsqlConn(layer->source());
|
|
|
167
|
+ if (pPgsqlConn == nullptr) break;
|
|
|
168
|
+ DmpMapServerUtil::initVectorLayerSrid(pPgsqlConn, vectorLayer);
|
|
|
169
|
+ }
|
|
|
170
|
+
|
165
|
if(i ==0)
|
171
|
if(i ==0)
|
166
|
{
|
172
|
{
|
167
|
minx = layer->extent().xmin();
|
173
|
minx = layer->extent().xmin();
|
168
|
miny = layer->extent().ymin();
|
174
|
miny = layer->extent().ymin();
|
169
|
maxx = layer->extent().xmax();
|
175
|
maxx = layer->extent().xmax();
|
170
|
maxy = layer->extent().ymax();
|
176
|
maxy = layer->extent().ymax();
|
|
|
177
|
+ if(project->crs().srid()==0)
|
|
|
178
|
+ {
|
|
|
179
|
+ DmpVectorLayer* vectorLayer = (DmpVectorLayer*)layer;
|
|
|
180
|
+ srs = "EPSG:" + vectorLayer->srid();
|
|
|
181
|
+ }
|
171
|
}
|
182
|
}
|
172
|
else
|
183
|
else
|
173
|
{
|
184
|
{
|
|
@@ -177,13 +188,19 @@ namespace DmpWms |
|
@@ -177,13 +188,19 @@ namespace DmpWms |
177
|
if(maxy < layer->extent().ymax()) maxy = layer->extent().ymax();
|
188
|
if(maxy < layer->extent().ymax()) maxy = layer->extent().ymax();
|
178
|
}
|
189
|
}
|
179
|
}
|
190
|
}
|
|
|
191
|
+
|
|
|
192
|
+ boost::property_tree::ptree ptProject;
|
|
|
193
|
+ // ptProject.add("<xmlattr>.queryable","1");
|
|
|
194
|
+ ptProject.add("Name", name);
|
|
|
195
|
+ ptProject.add("Title", title);
|
|
|
196
|
+ ptProject.add("CRS", srs);
|
180
|
|
197
|
|
181
|
- boost::property_tree::ptree ptGeographicBoundingbox;
|
|
|
182
|
- ptGeographicBoundingbox.add("westBoundLongitude", minx);
|
|
|
183
|
- ptGeographicBoundingbox.add("eastBoundLongitude", maxx);
|
|
|
184
|
- ptGeographicBoundingbox.add("southBoundLatitude", miny);
|
|
|
185
|
- ptGeographicBoundingbox.add("northBoundLatitude", maxy);
|
|
|
186
|
- ptProject.add_child("EX_GeographicBoundingBox",ptGeographicBoundingbox);
|
198
|
+ //boost::property_tree::ptree ptGeographicBoundingbox;
|
|
|
199
|
+ //ptGeographicBoundingbox.add("westBoundLongitude", minx);
|
|
|
200
|
+ //ptGeographicBoundingbox.add("eastBoundLongitude", maxx);
|
|
|
201
|
+ //ptGeographicBoundingbox.add("southBoundLatitude", miny);
|
|
|
202
|
+ //ptGeographicBoundingbox.add("northBoundLatitude", maxy);
|
|
|
203
|
+ //ptProject.add_child("EX_GeographicBoundingBox",ptGeographicBoundingbox);
|
187
|
|
204
|
|
188
|
boost::property_tree::ptree ptBoundingbox;
|
205
|
boost::property_tree::ptree ptBoundingbox;
|
189
|
ptBoundingbox.add("<xmlattr>.CRS", srs);
|
206
|
ptBoundingbox.add("<xmlattr>.CRS", srs);
|
|
@@ -216,15 +233,15 @@ namespace DmpWms |
|
@@ -216,15 +233,15 @@ namespace DmpWms |
216
|
boost::property_tree::ptree ptLayer;
|
233
|
boost::property_tree::ptree ptLayer;
|
217
|
ptLayer.add("<xmlattr>.queryable","1");
|
234
|
ptLayer.add("<xmlattr>.queryable","1");
|
218
|
ptLayer.add("Name", layer->name());
|
235
|
ptLayer.add("Name", layer->name());
|
219
|
- ptLayer.add("Title", layer->title());
|
236
|
+ ptLayer.add("Title", layer->title().empty()? layer->name():layer->title());
|
220
|
ptLayer.add("CRS", srs);
|
237
|
ptLayer.add("CRS", srs);
|
221
|
|
238
|
|
222
|
- boost::property_tree::ptree ptGeographicBoundingbox;
|
|
|
223
|
- ptGeographicBoundingbox.add("westBoundLongitude", layer->extent().xmin());
|
|
|
224
|
- ptGeographicBoundingbox.add("eastBoundLongitude", layer->extent().xmax());
|
|
|
225
|
- ptGeographicBoundingbox.add("southBoundLatitude", layer->extent().ymin());
|
|
|
226
|
- ptGeographicBoundingbox.add("northBoundLatitude", layer->extent().ymax());
|
|
|
227
|
- ptLayer.add_child("EX_GeographicBoundingBox",ptGeographicBoundingbox);
|
239
|
+ //boost::property_tree::ptree ptGeographicBoundingbox;
|
|
|
240
|
+ //ptGeographicBoundingbox.add("westBoundLongitude", layer->extent().xmin());
|
|
|
241
|
+ //ptGeographicBoundingbox.add("eastBoundLongitude", layer->extent().xmax());
|
|
|
242
|
+ //ptGeographicBoundingbox.add("southBoundLatitude", layer->extent().ymin());
|
|
|
243
|
+ //ptGeographicBoundingbox.add("northBoundLatitude", layer->extent().ymax());
|
|
|
244
|
+ //ptLayer.add_child("EX_GeographicBoundingBox",ptGeographicBoundingbox);
|
228
|
|
245
|
|
229
|
boost::property_tree::ptree ptBoundingbox;
|
246
|
boost::property_tree::ptree ptBoundingbox;
|
230
|
ptBoundingbox.add("<xmlattr>.CRS", srs);
|
247
|
ptBoundingbox.add("<xmlattr>.CRS", srs);
|