[mapguide-commits] r5209 - in trunk/MgDev:
Server/src/Services/Feature Server/src/Wfs Web/src/HttpHandler
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Wed Sep 29 04:09:46 EDT 2010
Author: liuar
Date: 2010-09-29 08:09:46 +0000 (Wed, 29 Sep 2010)
New Revision: 5209
Modified:
trunk/MgDev/Server/src/Services/Feature/FilterUtil.cpp
trunk/MgDev/Server/src/Services/Feature/ServerFeatureService.cpp
trunk/MgDev/Server/src/Wfs/OgcWfsService.config.awd
trunk/MgDev/Web/src/HttpHandler/WmsMapUtil.cpp
trunk/MgDev/Web/src/HttpHandler/WmsMapUtil.h
Log:
Ticket #1421 OGC WFS 1.1.0 Support
13 Test wfs:wfs-1.1.0-Basic-GetFeature-tc8.1 (s0001/d1e35137_1/d1e740_1/d1e25217_1/d1e6162_1)
Assertion: A KVP parameter value that denotes a bounding box shall conform to the general syntax specified in subclause 10.2.3. If no CRS reference is provided, a service-defined default value must be assumed.
The API GetWfsFeature? which response to the GetFeature? request doesn't support mutilple spatial query like:
(surfaceProperty ENVELOPEINTERSECTS GeomFromText('POLYGON((-180 -90,180 -90,180 90,-180 90,-180 -90))')) OR (pointProperty ENVELOPEINTERSECTS GeomFromText('POLYGON((-180 -90,180 -90,180 90,-180 90,-180 -90))')) OR (curveProperty ENVELOPEINTERSECTS GeomFromText('POLYGON((-180 -90,180 -90,180 90,-180 90,-180 -90))'))
It just do query on the default geometry property, and features responsed to the client is less then expected. I extended the GetWfsFeature? API to make sure MapGuide could process the spatial query on multiple geometry properties.
NOTE: Some FDO providers don't support OR with spatial query like Postgis/Posstgres? Provider.
Another problem is that WFS 1.1.0 support URN SRS like (urn:ogc:def:crs:EPSG::4326) which is not supported by MapGuide. In order to support the URN SRS, I did a work around to replace the text "urn:ogc:def:crs:EPSG:" with "EPSG".
Modified: trunk/MgDev/Server/src/Services/Feature/FilterUtil.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/FilterUtil.cpp 2010-09-29 07:53:06 UTC (rev 5208)
+++ trunk/MgDev/Server/src/Services/Feature/FilterUtil.cpp 2010-09-29 08:09:46 UTC (rev 5209)
@@ -157,7 +157,10 @@
// This is a workaround for GML3. For Name and Description properties, there will be a "gml:" prefix
// Remove the prefix to make sure Name and Description properties can be found by FDO API.
size_t pos = m_propName.find_first_of(L":");
- m_propName = m_propName.substr(pos+1);
+ if(pos != STRING::npos)
+ {
+ m_propName = m_propName.substr(pos+1);
+ }
return m_propName;
}
Modified: trunk/MgDev/Server/src/Services/Feature/ServerFeatureService.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/ServerFeatureService.cpp 2010-09-29 07:53:06 UTC (rev 5208)
+++ trunk/MgDev/Server/src/Services/Feature/ServerFeatureService.cpp 2010-09-29 08:09:46 UTC (rev 5209)
@@ -1808,17 +1808,29 @@
//and set it to the FDO feature query
if (!wfsFilter.empty())
{
- //create a modifiable copy of the filter
- STRING ogcFilter = wfsFilter;
STRING GEOM_PROP_TAG = L"%MG_GEOM_PROP%"; //NOXLATE
- size_t geomPropPos = 0;
- while((geomPropPos = ogcFilter.find(GEOM_PROP_TAG, geomPropPos)) != STRING::npos)
+ STRING fdoFilterString = L""; //NOXLATE
+
+ Ptr<MgPropertyDefinitionCollection> properties = fc->GetProperties();
+ MgOgcFilterUtil u;
+ if(wfsFilter.find(GEOM_PROP_TAG, 0) != STRING::npos)
{
- ogcFilter = ogcFilter.replace(geomPropPos, GEOM_PROP_TAG.length(), fc->GetDefaultGeometryPropertyName());
+ for(int i = 0; i<properties->GetCount(); i++)
+ {
+ Ptr<MgPropertyDefinition> prop = properties->GetItem(i);
+ if(prop->GetPropertyType() == MgFeaturePropertyType::GeometricProperty)
+ {
+ STRING ogcFilter = MgUtil::ReplaceString(wfsFilter,GEOM_PROP_TAG.c_str(),prop->GetName().c_str());
+
+ if(!fdoFilterString.empty())
+ {
+ fdoFilterString += L" OR ";
+ }
+ fdoFilterString += u.Ogc2FdoFilter(ogcFilter, trans, prop->GetName(), properties);
+ }
+ }
}
- Ptr<MgPropertyDefinitionCollection> properties = fc->GetProperties();
- MgOgcFilterUtil u;
- STRING fdoFilterString = u.Ogc2FdoFilter(ogcFilter, trans, geomPropName, properties);
+
options->SetFilter(fdoFilterString);
}
Modified: trunk/MgDev/Server/src/Wfs/OgcWfsService.config.awd
===================================================================
--- trunk/MgDev/Server/src/Wfs/OgcWfsService.config.awd 2010-09-29 07:53:06 UTC (rev 5208)
+++ trunk/MgDev/Server/src/Wfs/OgcWfsService.config.awd 2010-09-29 08:09:46 UTC (rev 5209)
@@ -270,7 +270,7 @@
<!-- Add translate elements here to map any particularly -->
<!-- troublesome SRS to some appropriate WKT. -->
<Define item="SRS.WKT.map">
- <translate from="urn:ogc:def:crs:EPSG::4326">GEOGCS["LL84",DATUM["WGS84",SPHEROID["WGS84",6378137.000,298.25722293]],PRIMEM["Greenwich",0],UNIT["Degree",0.01745329251994]]</translate>
+ <translate from="URN:OGC:DEF:CRS:EPSG::4326">GEOGCS["LL84",DATUM["WGS84",SPHEROID["WGS84",6378137.000,298.25722293]],PRIMEM["Greenwich",0],UNIT["Degree",0.01745329251994]]</translate>
<translate from="CRS:84">GEOGCS["LL84",DATUM["WGS84",SPHEROID["WGS84",6378137.000,298.25722293]],PRIMEM["Greenwich",0],UNIT["Degree",0.01745329251994]]</translate>
</Define>
Modified: trunk/MgDev/Web/src/HttpHandler/WmsMapUtil.cpp
===================================================================
--- trunk/MgDev/Web/src/HttpHandler/WmsMapUtil.cpp 2010-09-29 07:53:06 UTC (rev 5208)
+++ trunk/MgDev/Web/src/HttpHandler/WmsMapUtil.cpp 2010-09-29 08:09:46 UTC (rev 5209)
@@ -187,6 +187,9 @@
void MgWmsMapUtil::SrsToWktMapping(MgOgcServer& oWms,STRING sSRS,REFSTRING sWKT)
{
+
+ ProcessURNSrs(sSRS);
+
// Plan A is to look for a user-defined mapping. This allows a config
// file to contain overrides for incorrect, incomplete, or new reference
// systems. Input is an SRS string, output is (user-defined) WKT.
@@ -320,3 +323,9 @@
coord1 = 0.0- coord1;
coord2 = 0.0- coord2;
}
+
+void MgWmsMapUtil::ProcessURNSrs(REFSTRING sSRS)
+{
+ sSRS = MgUtil::ToUpper(sSRS);
+ sSRS = MgUtil::ReplaceString(sSRS,L"URN:OGC:DEF:CRS:EPSG:",L"EPSG");
+}
Modified: trunk/MgDev/Web/src/HttpHandler/WmsMapUtil.h
===================================================================
--- trunk/MgDev/Web/src/HttpHandler/WmsMapUtil.h 2010-09-29 07:53:06 UTC (rev 5208)
+++ trunk/MgDev/Web/src/HttpHandler/WmsMapUtil.h 2010-09-29 08:09:46 UTC (rev 5209)
@@ -47,6 +47,8 @@
static void SwapCoords(double(& coord)[4]);
// Help method to make coordinates about-turn
static void ReverseCoords(double& coord1, double& coord2);
+ // Help method to convert URN SRS(urn:ogc:def:crs:EPSG::4326) to EPSG SRS (EPSG:4326)
+ static void ProcessURNSrs(REFSTRING sSRS);
};
#endif // _FS_WMS_MAP_UTIL_H
More information about the mapguide-commits
mailing list