Tengo un problema con el filtro OGC.
Mi capa en OpenLayers tiene este filtro:
filter: new OpenLayers.Filter.Comparison({
type: OpenLayers.Filter.Comparison.BETWEEN,
property: "datetime",
lowerBoundary: "2013-01-10T12:11:50.501Z",
upperBoundary: "2013-01-10T12:11:55.501Z"
})
y el correo al servidor es:
<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
<ogc:PropertyIsBetween>
<ogc:PropertyName>datetime</ogc:PropertyName>
<ogc:LowerBoundary>
<ogc:Literal>2013-01-10T12:11:50.501Z</ogc:Literal>
</ogc:LowerBoundary>
<ogc:UpperBoundary>
<ogc:Literal>2013-01-10T12:11:55.501Z</ogc:Literal>
</ogc:UpperBoundary>
</ogc:PropertyIsBetween>
</ogc:Filter>
pero la respuesta es:
<wfs:FeatureCollection numberOfFeatures="0" timeStamp="2013-01-10T12:11:15.100Z" xsi:schemaLocation="AidAssistant http://127.0.0.1:8080/geoserver/wfs?service=WFS&version=1.1.0&request=DescribeFeatureType&typeName=AidAssistant%3Av_dati_sensori_geom_BNU1 http://www.opengis.net/wfs http://127.0.0.1:8080/geoserver/schemas/wfs/1.1.0/wfs.xsd" xmlns:ogc="http://www.opengis.net/ogc" xmlns:tiger="http://www.census.gov" xmlns:cite="http://www.opengeospatial.net/cite" xmlns:nurc="http://www.nurc.nato.int" xmlns:sde="http://geoserver.sf.net" xmlns:wfs="http://www.opengis.net/wfs" xmlns:topp="http://www.openplans.org/topp" xmlns:it.geosolutions="http://www.geo-solutions.it" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:AidAssistant="AidAssistant" xmlns:sf="http://www.openplans.org/spearfish" xmlns:ows="http://www.opengis.net/ows" xmlns:gml="http://www.opengis.net/gml" xmlns:xlink="http://www.w3.org/1999/xlink">
<gml:featureMembers></gml:featureMembers>
</wfs:FeatureCollection>
He intentado utilizar este filtro:
filter: new OpenLayers.Filter.Logical({
type: OpenLayers.Filter.Logical.AND,
filters: [
new OpenLayers.Filter.Comparison({
type: OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO,
property: "datetime",
value: 2013-01-10T12:25:40.612Z
}),
new OpenLayers.Filter.Comparison({
type: OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO,
property: "datetime",
value: 2013-01-10T12:25:50.612Z
})
]
})
y el puesto es:
<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
<ogc:And>
<ogc:PropertyIsGreaterThanOrEqualTo>
<ogc:PropertyName>datetime</ogc:PropertyName>
<ogc:Literal>2013-01-10T12:25:40.612Z</ogc:Literal>
</ogc:PropertyIsGreaterThanOrEqualTo>
<ogc:PropertyIsLessThanOrEqualTo>
<ogc:PropertyName>datetime</ogc:PropertyName>
<ogc:Literal>2013-01-10T12:25:50.612Z</ogc:Literal>
</ogc:PropertyIsLessThanOrEqualTo>
</ogc:And>
</ogc:Filter>
y la respuesta es la misma, 0 características.
Hay características en mi capa, de hecho si hago esta petición:
http://127.0.0.1:8080/geoserver/wfs?service=wfs&version=1.1.0&request=GetFeature&typeName=AidAssistant:v_dati_sensori_geom_BNU1&srsName=EPSG:404000&sortBy=datetime+D
Recibo muchas características.
Pero si pruebo esto:
http://127.0.0.1:8080/geoserver/wfs?service=wfs&version=1.1.0&request=GetFeature&typeName=AidAssistant:v_dati_sensori_geom_BNU1&srsName=EPSG:404000&filter=%3Cogc:Filter%20xmlns:ogc=%22http://www.opengis.net/ogc%22%3E%3Cogc:PropertyIsGreaterThanOrEqualTo%3E%3Cogc:PropertyName%3Edatetime%3C/ogc:PropertyName%3E%3Cogc:Literal%3E2013-01-10T12:25:40.612Z%3C/ogc:Literal%3E%3C/ogc:PropertyIsGreaterThanOrEqualTo%3E%3C/ogc:Filter%3E
Recibo 0 funciones.
Perdón por el largo post :(
¿Puede alguien ayudarme?
Gracias.
Actualización: Puede que haya encontrado el error. Geoserver para hacer esta consulta en la DB:
SELECT "node_id","datetime","geom".STAsBinary() as "geom"
FROM "v_dati_sensori_geom_BNU1" WHERE "datetime" BETWEEN '2013-01-3 16:45:53.000' AND '2013-01-10 16:45:58.000'
pero esto no funciona porque la consulta correcta en SQL SERVER es:
SELECT "node_id","datetime","geom".STAsBinary() as "geom"
FROM "v_dati_sensori_geom_BNU1" WHERE "datetime"
BETWEEN convert(datetime, '2013-01-3 16:45:53.000', 120) AND convert(datetime, '2013-01-10 16:45:58.000', 120)
¿Solución a este problema?