[Geoserver-users] returning extent as response for the resultant query records from microsoft sql server in geoserver

I have data in the GeoServer coming from Microsoft’s SQL server. I want to use CQL filter with WMS to query and get 4000k records as a result. I need to know is there any way my CQl filter with WMS can return extent for the 4k records in the resultant response?If the result is 2k records, then it should return the extent for those.For ex,

http://localhost:8080/geoserver/wfs?service=wfs&version=1.1.0&request=getfeature&typename=topp:states&CQL_FILTER=STATE_NAME=%27Idaho%27&resulttype=hits

returns 1 record as below in XML

<wfs:FeatureCollection xmlns:it.geosolutions="[http://www.geo-solutions.it](http://www.geo-solutions.it)"    xmlns:cite="[http://www.opengeospatial.net/cite](http://www.opengeospatial.net/cite)" xmlns:ogc="[http://www.opengis.net/ogc](http://www.opengis.net/ogc)" xmlns:tiger="[http://www.census.gov](http://www.census.gov)" xmlns:sde="[http://geoserver.sf.net](http://geoserver.sf.net)" xmlns:topp="[http://www.openplans.org/topp](http://www.openplans.org/topp)" xmlns:wfs="[http://www.opengis.net/wfs](http://www.opengis.net/wfs)" xmlns:ows="[http://www.opengis.net/ows](http://www.opengis.net/ows)" xmlns:xlink="[http://www.w3.org/1999/xlink](http://www.w3.org/1999/xlink)" xmlns:KFRI="[http://www.kfri.res.in/](http://www.kfri.res.in/)" xmlns:sf="[http://www.openplans.org/spearfish](http://www.openplans.org/spearfish)" xmlns:gml="[http://www.opengis.net/gml](http://www.opengis.net/gml)" xmlns:nurc="[http://www.nurc.nato.int](http://www.nurc.nato.int)" xmlns:xsi="[http://www.w3.org/2001/XMLSchema-instance](http://www.w3.org/2001/XMLSchema-instance)" numberOfFeatures="1" timeStamp="2016-08-01T11:45:42.443Z" xsi:schemaLocation="[http://www.opengis.net/wfs](http://www.opengis.net/wfs) [http://schemas.opengis.net/wfs/1.1.0/wfs.xsd](http://schemas.opengis.net/wfs/1.1.0/wfs.xsd)"/>

In addition,i need the extent also for the feature in the response. And please note that if the response returns 4 features also it should return one extent for all those 4 features instead of returning extent for each feature.

Hi Farook,
no, WFS does not allow to just return the extent, without also returning the features (it’s not like SQL where
aggregations can be performed).

However you can install and use WPS for that purpose, there is a process called Bounds that just
returns the bounds without loading all the features

Cheers
Andrea

···

On Mon, Aug 1, 2016 at 1:59 PM, Farook M <farookrceg@anonymised.com> wrote:

I have data in the GeoServer coming from Microsoft’s SQL server. I want to use CQL filter with WMS to query and get 4000k records as a result. I need to know is there any way my CQl filter with WMS can return extent for the 4k records in the resultant response?If the result is 2k records, then it should return the extent for those.For ex,

http://localhost:8080/geoserver/wfs?service=wfs&version=1.1.0&request=getfeature&typename=topp:states&CQL_FILTER=STATE_NAME=%27Idaho%27&resulttype=hits

returns 1 record as below in XML

<wfs:FeatureCollection xmlns:it.geosolutions="[http://www.geo-solutions.it](http://www.geo-solutions.it)"    xmlns:cite="[http://www.opengeospatial.net/cite](http://www.opengeospatial.net/cite)" xmlns:ogc="[http://www.opengis.net/ogc](http://www.opengis.net/ogc)" xmlns:tiger="[http://www.census.gov](http://www.census.gov)" xmlns:sde="[http://geoserver.sf.net](http://geoserver.sf.net)" xmlns:topp="[http://www.openplans.org/topp](http://www.openplans.org/topp)" xmlns:wfs="[http://www.opengis.net/wfs](http://www.opengis.net/wfs)" xmlns:ows="[http://www.opengis.net/ows](http://www.opengis.net/ows)" xmlns:xlink="[http://www.w3.org/1999/xlink](http://www.w3.org/1999/xlink)" xmlns:KFRI="[http://www.kfri.res.in/](http://www.kfri.res.in/)" xmlns:sf="[http://www.openplans.org/spearfish](http://www.openplans.org/spearfish)" xmlns:gml="[http://www.opengis.net/gml](http://www.opengis.net/gml)" xmlns:nurc="[http://www.nurc.nato.int](http://www.nurc.nato.int)" xmlns:xsi="[http://www.w3.org/2001/XMLSchema-instance](http://www.w3.org/2001/XMLSchema-instance)" numberOfFeatures="1" timeStamp="2016-08-01T11:45:42.443Z" xsi:schemaLocation="[http://www.opengis.net/wfs](http://www.opengis.net/wfs) [http://schemas.opengis.net/wfs/1.1.0/wfs.xsd](http://schemas.opengis.net/wfs/1.1.0/wfs.xsd)"/>

In addition,i need the extent also for the feature in the response. And please note that if the response returns 4 features also it should return one extent for all those 4 features instead of returning extent for each feature.



Geoserver-users mailing list
Geoserver-users@anonymised.comsts.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

==
GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.

Ing. Andrea Aime

@geowolf
Technical Lead

GeoSolutions S.A.S.
Via di Montramito 3/A
55054 Massarosa (LU)
phone: +39 0584 962313

fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

AVVERTENZE AI SENSI DEL D.Lgs. 196/2003

Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy’s New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc.


Hi Andrea,

Thanks for the response. If the returning is feature is 4, will the WPS return 1 extent for all the 4 returning features instead of 4 individual extents?

Thanks,
Farook

···

Hi Farook,
no, WFS does not allow to just return the extent, without also returning the features (it’s not like SQL where
aggregations can be performed).

However you can install and use WPS for that purpose, there is a process called Bounds that just
returns the bounds without loading all the features

Cheers
Andrea

On Mon, Aug 1, 2016 at 11:19 PM, Andrea Aime <andrea.aime@anonymised.com> wrote:

On Mon, Aug 1, 2016 at 1:59 PM, Farook M <farookrceg@anonymised.com.> wrote:

I have data in the GeoServer coming from Microsoft’s SQL server. I want to use CQL filter with WMS to query and get 4000k records as a result. I need to know is there any way my CQl filter with WMS can return extent for the 4k records in the resultant response?If the result is 2k records, then it should return the extent for those.For ex,

http://localhost:8080/geoserver/wfs?service=wfs&version=1.1.0&request=getfeature&typename=topp:states&CQL_FILTER=STATE_NAME=%27Idaho%27&resulttype=hits

returns 1 record as below in XML

<wfs:FeatureCollection xmlns:it.geosolutions="[http://www.geo-solutions.it](http://www.geo-solutions.it)"    xmlns:cite="[http://www.opengeospatial.net/cite](http://www.opengeospatial.net/cite)" xmlns:ogc="[http://www.opengis.net/ogc](http://www.opengis.net/ogc)" xmlns:tiger="[http://www.census.gov](http://www.census.gov)" xmlns:sde="[http://geoserver.sf.net](http://geoserver.sf.net)" xmlns:topp="[http://www.openplans.org/topp](http://www.openplans.org/topp)" xmlns:wfs="[http://www.opengis.net/wfs](http://www.opengis.net/wfs)" xmlns:ows="[http://www.opengis.net/ows](http://www.opengis.net/ows)" xmlns:xlink="[http://www.w3.org/1999/xlink](http://www.w3.org/1999/xlink)" xmlns:KFRI="[http://www.kfri.res.in/](http://www.kfri.res.in/)" xmlns:sf="[http://www.openplans.org/spearfish](http://www.openplans.org/spearfish)" xmlns:gml="[http://www.opengis.net/gml](http://www.opengis.net/gml)" xmlns:nurc="[http://www.nurc.nato.int](http://www.nurc.nato.int)" xmlns:xsi="[http://www.w3.org/2001/XMLSchema-instance](http://www.w3.org/2001/XMLSchema-instance)" numberOfFeatures="1" timeStamp="2016-08-01T11:45:42.443Z" xsi:schemaLocation="[http://www.opengis.net/wfs](http://www.opengis.net/wfs) [http://schemas.opengis.net/wfs/1.1.0/wfs.xsd](http://schemas.opengis.net/wfs/1.1.0/wfs.xsd)"/>

In addition,i need the extent also for the feature in the response. And please note that if the response returns 4 features also it should return one extent for all those 4 features instead of returning extent for each feature.



Geoserver-users mailing list
Geoserver-users@anonymised.comsts.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

==
GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.

Ing. Andrea Aime

@geowolf
Technical Lead

GeoSolutions S.A.S.
Via di Montramito 3/A
55054 Massarosa (LU)
phone: +39 0584 962313

fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

AVVERTENZE AI SENSI DEL D.Lgs. 196/2003

Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy’s New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc.


On Tue, Aug 2, 2016 at 6:48 AM, Farook M <farookrceg@anonymised.com> wrote:

Hi Andrea,

Thanks for the response. If the returning is feature is 4, will the WPS
return 1 extent for all the 4 returning features instead of 4 individual
extents?

One extent only. E.g., this is an example request against the local
tiger:roads layer:

<?xml version="1.0" encoding="UTF-8"?><wps:Execute version="1.0.0"
service="WPS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot; xmlns="
http://www.opengis.net/wps/1.0.0&quot; xmlns:wfs="http://www.opengis.net/wfs&quot;
xmlns:wps="http://www.opengis.net/wps/1.0.0&quot; xmlns:ows="
http://www.opengis.net/ows/1.1&quot; xmlns:gml="http://www.opengis.net/gml&quot;
xmlns:ogc="http://www.opengis.net/ogc&quot; xmlns:wcs="
http://www.opengis.net/wcs/1.1.1&quot; xmlns:xlink="http://www.w3.org/1999/xlink&quot;
xsi:schemaLocation="http://www.opengis.net/wps/1.0.0
http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd&quot;&gt;
  <ows:Identifier>gs:Bounds</ows:Identifier>
  <wps:DataInputs>
    <wps:Input>
      <ows:Identifier>features</ows:Identifier>
      <wps:Reference mimeType="text/xml" xlink:href="http://geoserver/wfs&quot;
method="POST">
        <wps:Body>
          <wfs:GetFeature service="WFS" version="1.0.0" outputFormat="GML2"
xmlns:tiger="http://www.census.gov">
            <wfs:Query typeName="tiger:tiger_roads"/>
          </wfs:GetFeature>
        </wps:Body>
      </wps:Reference>
    </wps:Input>
  </wps:DataInputs>
  <wps:ResponseForm>
    <wps:RawDataOutput>
      <ows:Identifier>bounds</ows:Identifier>
    </wps:RawDataOutput>
  </wps:ResponseForm>
</wps:Execute>

If I save it into a file in /tmp/bounds.xml and post it to the GeoSolutions
demo GeoServer like this:

curl -H "Content-type: text/xml" -d @/tmp/bounds.xml "
http://demo.geo-solutions.it/geoserver/ows&quot;

then the response is a single bounding box for the entire layer:

<?xml version="1.0" encoding="UTF-8"?><ows:BoundingBox xmlns:xs="
http://www.w3.org/2001/XMLSchema&quot; xmlns:ows="http://www.opengis.net/ows/1.1&quot;
crs="EPSG:4326"><ows:LowerCorner>-74.02722
40.684221</ows:LowerCorner><ows:UpperCorner>-73.907005
40.878178</ows:UpperCorner></ows:BoundingBox>

You can modify the WFS request embedded in the WPS one (acting as the data
source) in order to
filter the features being used to compute the bbox

Cheers
Andrea

--

GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via di Montramito 3/A
55054 Massarosa (LU)
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

*AVVERTENZE AI SENSI DEL D.Lgs. 196/2003*

Le informazioni contenute in questo messaggio di posta elettronica e/o
nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il
loro utilizzo è consentito esclusivamente al destinatario del messaggio,
per le finalità indicate nel messaggio stesso. Qualora riceviate questo
messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
darcene notizia via e-mail e di procedere alla distruzione del messaggio
stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso,
divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od
utilizzarlo per finalità diverse, costituisce comportamento contrario ai
principi dettati dal D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely for
the attention and use of the named addressee(s) and may be confidential or
proprietary in nature or covered by the provisions of privacy act
(Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection
Code).Any use not in accord with its purpose, any disclosure, reproduction,
copying, distribution, or either dissemination, either whole or partial, is
strictly forbidden except previous formal approval of the named
addressee(s). If you are not the intended recipient, please contact
immediately the sender by telephone, fax or e-mail and delete the
information in this message that has been received in error. The sender
does not give any warranty or accept liability as the content, accuracy or
completeness of sent messages and accepts no responsibility for changes
made after they were sent or for other risks which arise as a result of
e-mail transmission, viruses, etc.

-------------------------------------------------------