Re: [Geotools-gt2-users] Question about coordinate systems and WFS

2018-01-09 Thread Ben Caradoc-Davies

Gaby,

on-list, please.

You should be able to use Query.setCoordinateSystemReproject which is I 
think the programmatic equivalent of setting srsName in a WFS GetFeature 
request, but I have not tested whether this in fact works.


Kind regards,
Ben.

On 10/01/18 13:14, Gabriella Turek wrote:

I see, yeah, I suppose I can just throw an exception when the CRS is not 
supported, but
assume that it is to begin with.
So programmatically I would pass the SRSNAME in the Query filter?
Thanx
Gaby

On 10/01/18, 13:06, "Ben Caradoc-Davies"  wrote:

Gaby,

in theory, the WFS GetCapabilities response lists all supported CRSs for
each feature type, but in practice, because this would add 5000+
otherSRS/otherCRS elements for each feature type (enumerating the
contents of the EPSG database), these elements are not encoded. They can
be configured by the server administrator:

http://docs.geoserver.org/latest/en/user/services/wfs/webadmin.html#configuring-additional-srs

In practice, probe by trying a request with a particular CRS and
detecting failure. A CRS in a recent EPSG database will be supported by
recent GeoServer, for similar values of recent.

Use SRSNAME to request that response geometries be reprojected to a
particular CRS. Use a five-parameter BBOX to specify your BBOX in a CRS
other than the default for the feature type. These two CRS do not have
to be the same. They are orthogonal considerations.

For example, using the demo bug sites layer (sf:archsites):

Give me archsites.2 by BBOX (the default CRS is EPSG:26713):

http://localhost:8080/geoserver/wfs?service=WFS=2.0.0=GetFeature=sf:archsites=591949.5,4922999.5,591950.5,4923000.5

Give me archsites.2 reprojected into WGS 84 with SRSNAME (note that the
BBOX is still in EPSG:26713):

http://localhost:8080/geoserver/wfs?service=WFS=2.0.0=GetFeature=sf:archsites=591949.5,4922999.5,591950.5,4923000.5=http://www.opengis.net/def/crs/EPSG/0/4326

Using WGS 84 BBOX coordinates fails because the BBOX defaults to
EPSG:26713 (this returns no features):

http://localhost:8080/geoserver/wfs?service=WFS=2.0.0=GetFeature=sf:archsites=44.4562825,-103.8446375,44.4562835,-103.8446365=http://www.opengis.net/def/crs/EPSG/0/4326

But we can select archsites.2 if we use a five parameter BBOX with WGS
84 coordinates *and* specify that it is in WGS 84:

http://localhost:8080/geoserver/wfs?service=WFS=2.0.0=GetFeature=sf:archsites=44.4562825,-103.8446375,44.4562835,-103.8446365,http://www.opengis.net/def/crs/EPSG/0/4326=http://www.opengis.net/def/crs/EPSG/0/4326

We can leave off the SRSNAME if we want to request in WGS 84 but still
want the response geometries in its native EPSG:26713:

http://localhost:8080/geoserver/wfs?service=WFS=2.0.0=GetFeature=sf:archsites=44.4562825,-103.8446375,44.4562835,-103.8446365,http://www.opengis.net/def/crs/EPSG/0/4326

Kind regards,
Ben.


On 10/01/18 12:16, Gabriella Turek wrote:
> I’ve gotten my client to interrogate a WFS service (thank you Ian!).
> Now I have a question about how to handle CRSs.
> With WFS, I can ask the service what CRS are supported and ask the 
service for maps in a specific CRS.
> Is there something similar for WFS, or do I have to reproject on the 
client side (as needed).
> If the latter, that means that if I am making a query filter that include 
a bbox, the bbox must be in the CRS of the service, correct?
> Thanx
> Gaby
>
>
> 
--
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>

Dr Gabriella Turek
Senior Software Engineer

+64-4-386-0819 | 301 Evans Bay Parade, Greta Point, Wellington | 
www.niwa.co.nz
[NIWA]
To ensure compliance with legal requirements and to maintain cyber security 
standards, NIWA's IT systems are subject to ongoing monitoring, activity 
logging and auditing. This monitoring and auditing service may be provided by 
third parties. Such third parties can access information transmitted to, 
processed by and stored on NIWA's IT systems.
___
> GeoTools-GT2-Users mailing list
> GeoTools-GT2-Users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>

--
Ben Caradoc-Davies 
Director
Transient Software Limited 
New Zealand








--
Ben Caradoc-Davies 
Director
Transient Software Limited 
New Zealand

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

Re: [Geotools-gt2-users] Question about coordinate systems and WFS

2018-01-09 Thread Ben Caradoc-Davies

Gaby,

in theory, the WFS GetCapabilities response lists all supported CRSs for 
each feature type, but in practice, because this would add 5000+ 
otherSRS/otherCRS elements for each feature type (enumerating the 
contents of the EPSG database), these elements are not encoded. They can 
be configured by the server administrator:

http://docs.geoserver.org/latest/en/user/services/wfs/webadmin.html#configuring-additional-srs

In practice, probe by trying a request with a particular CRS and 
detecting failure. A CRS in a recent EPSG database will be supported by 
recent GeoServer, for similar values of recent.


Use SRSNAME to request that response geometries be reprojected to a 
particular CRS. Use a five-parameter BBOX to specify your BBOX in a CRS 
other than the default for the feature type. These two CRS do not have 
to be the same. They are orthogonal considerations.


For example, using the demo bug sites layer (sf:archsites):

Give me archsites.2 by BBOX (the default CRS is EPSG:26713):
http://localhost:8080/geoserver/wfs?service=WFS=2.0.0=GetFeature=sf:archsites=591949.5,4922999.5,591950.5,4923000.5

Give me archsites.2 reprojected into WGS 84 with SRSNAME (note that the 
BBOX is still in EPSG:26713):

http://localhost:8080/geoserver/wfs?service=WFS=2.0.0=GetFeature=sf:archsites=591949.5,4922999.5,591950.5,4923000.5=http://www.opengis.net/def/crs/EPSG/0/4326

Using WGS 84 BBOX coordinates fails because the BBOX defaults to 
EPSG:26713 (this returns no features):

http://localhost:8080/geoserver/wfs?service=WFS=2.0.0=GetFeature=sf:archsites=44.4562825,-103.8446375,44.4562835,-103.8446365=http://www.opengis.net/def/crs/EPSG/0/4326

But we can select archsites.2 if we use a five parameter BBOX with WGS 
84 coordinates *and* specify that it is in WGS 84:

http://localhost:8080/geoserver/wfs?service=WFS=2.0.0=GetFeature=sf:archsites=44.4562825,-103.8446375,44.4562835,-103.8446365,http://www.opengis.net/def/crs/EPSG/0/4326=http://www.opengis.net/def/crs/EPSG/0/4326

We can leave off the SRSNAME if we want to request in WGS 84 but still 
want the response geometries in its native EPSG:26713:

http://localhost:8080/geoserver/wfs?service=WFS=2.0.0=GetFeature=sf:archsites=44.4562825,-103.8446375,44.4562835,-103.8446365,http://www.opengis.net/def/crs/EPSG/0/4326

Kind regards,
Ben.


On 10/01/18 12:16, Gabriella Turek wrote:

I’ve gotten my client to interrogate a WFS service (thank you Ian!).
Now I have a question about how to handle CRSs.
With WFS, I can ask the service what CRS are supported and ask the service for 
maps in a specific CRS.
Is there something similar for WFS, or do I have to reproject on the client 
side (as needed).
If the latter, that means that if I am making a query filter that include a 
bbox, the bbox must be in the CRS of the service, correct?
Thanx
Gaby


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users



--
Ben Caradoc-Davies 
Director
Transient Software Limited 
New Zealand

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users


[Geotools-gt2-users] Question about coordinate systems and WFS

2018-01-09 Thread Gabriella Turek
I’ve gotten my client to interrogate a WFS service (thank you Ian!).
Now I have a question about how to handle CRSs.
With WFS, I can ask the service what CRS are supported and ask the service for 
maps in a specific CRS.
Is there something similar for WFS, or do I have to reproject on the client 
side (as needed). 
If the latter, that means that if I am making a query filter that include a 
bbox, the bbox must be in the CRS of the service, correct?
Thanx
Gaby


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users


Re: [Geotools-gt2-users] [Geotools-devel] Replace values in a coverage that instersect with a vector geometry

2018-01-09 Thread Jan Boonen
Hi Ian,

Thanks for you very fast reply (and sorry for having used the wrong mailing
list)! We will investigate how to make the code more efficient, but this
will definitely help to get started with raster processing.

Cheers,

Jan


--
*Geodan*
Buitenhaven 27-A
5211 TP 's-Hertogenbosch (NL)

T +31 (0)73 - 692 5151
M +31 (0)6 - 2395 1191
E jan.boo...@geodan.nl
www.geodan.nl | disclaimer 
--


2018-01-09 14:49 GMT+01:00 Ian Turton :

> (Redirected to user list where it should live)
>
> Here is some working code (https://gist.github.com/ianturton/
> e54c41169ef32f48b1ac9b93c580e165) - but I suspect it could be much more
> efficient.
>
> Ian
>
> On 9 January 2018 at 11:27, Ian Turton  wrote:
>
>> There may be a better way than this but I would start by creating the new
>> raster
>>
>> WritableRaster writableRaster = RasterFactory.createBandedRast
>> er(java.awt.image.DataBuffer.TYPE_DOUBLE, width,
>> height, 1, null);
>> GridCoverageFactory factory = CoverageFactoryFinder.getGridC
>> overageFactory(null);
>> GridCoverage2D gc = factory.create("ResPop", writableRaster, bounds);
>>
>> copying the old one in to it and then clipping my raster to the envelope
>> of the polygon
>>
>>  public GridCoverage2D clip(GridCoverage2D coverage, ReferencedEnvelope
>> envelope) {
>> CoverageProcessor processor = CoverageProcessor.getInstance();
>>
>> // An example of manually creating the operation and parameters we
>> want
>> final ParameterValueGroup param = processor.getOperation("Covera
>> geCrop").getParameters();
>> param.parameter("Source").setValue(coverage);
>> param.parameter("Envelope").setValue(envelope);
>>
>> return (GridCoverage2D) processor.doOperation(param);
>>
>>   }
>>
>> and then step through the remaining pixels - checking if the centre(?)
>> was in the polygon and changing them as required
>>
>> GridEnvelope gridRange2D = grid.getGridGeometry().getGridRange();
>> for(int i=gridRange2D.getLow(0);i>   for(int j=gridRange2D.getLow(1);j>   Point2D p = grid.gridToWorld(new GridCoordinate2D(i,j));
>>   if(poly.contains(p)){
>> int[] dest = new int[1];
>> grid.evaluate(new GridCoordinates2D(i, j), dest );
>> System.out.println(i+","+j+"="+dest[0]);
>> writableRaster.setDataElements(c.x, c.y, data);
>>  }
>>   }
>> }
>>
>> I haven't actually tested any of this but it looks plausible
>>
>> Ian
>>
>> On 9 January 2018 at 09:41, Jan Boonen  wrote:
>>
>>> Hi list,
>>>
>>> For a complex GIS editing application I want to use GeoTools to replace
>>> values in a coverage. The cells, whose values need to be replaced, must be
>>> selected using an intersection with a JTS Geometry. All editing may be done
>>> on in-memory coverages, only the end result will be written to a file.
>>>
>>> I have read through the tutorials and JavaDoc, but thus far I haven't
>>> been able to figure out how to do an intersection on a coverage and how to
>>> replace the value of individual cells. Would anybody be so kind to give me
>>> some hints?
>>>
>>> Thanks in advance!
>>>
>>> Cheers,
>>>
>>> Jan
>>>
>>> 
>>> --
>>> Check out the vibrant tech community on one of the world's most
>>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>>> ___
>>> GeoTools-Devel mailing list
>>> geotools-de...@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/geotools-devel
>>>
>>>
>>
>>
>> --
>> Ian Turton
>>
>
>
>
> --
> Ian Turton
>
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users


Re: [Geotools-gt2-users] [Geotools-devel] Replace values in a coverage that instersect with a vector geometry

2018-01-09 Thread Ian Turton
(Redirected to user list where it should live)

Here is some working code (
https://gist.github.com/ianturton/e54c41169ef32f48b1ac9b93c580e165) - but I
suspect it could be much more efficient.

Ian

On 9 January 2018 at 11:27, Ian Turton  wrote:

> There may be a better way than this but I would start by creating the new
> raster
>
> WritableRaster writableRaster = RasterFactory.
> createBandedRaster(java.awt.image.DataBuffer.TYPE_DOUBLE, width,
> height, 1, null);
> GridCoverageFactory factory = CoverageFactoryFinder.
> getGridCoverageFactory(null);
> GridCoverage2D gc = factory.create("ResPop", writableRaster, bounds);
>
> copying the old one in to it and then clipping my raster to the envelope
> of the polygon
>
>  public GridCoverage2D clip(GridCoverage2D coverage, ReferencedEnvelope
> envelope) {
> CoverageProcessor processor = CoverageProcessor.getInstance();
>
> // An example of manually creating the operation and parameters we want
> final ParameterValueGroup param = processor.getOperation("
> CoverageCrop").getParameters();
> param.parameter("Source").setValue(coverage);
> param.parameter("Envelope").setValue(envelope);
>
> return (GridCoverage2D) processor.doOperation(param);
>
>   }
>
> and then step through the remaining pixels - checking if the centre(?) was
> in the polygon and changing them as required
>
> GridEnvelope gridRange2D = grid.getGridGeometry().getGridRange();
> for(int i=gridRange2D.getLow(0);i   for(int j=gridRange2D.getLow(1);j   Point2D p = grid.gridToWorld(new GridCoordinate2D(i,j));
>   if(poly.contains(p)){
> int[] dest = new int[1];
> grid.evaluate(new GridCoordinates2D(i, j), dest );
> System.out.println(i+","+j+"="+dest[0]);
> writableRaster.setDataElements(c.x, c.y, data);
>  }
>   }
> }
>
> I haven't actually tested any of this but it looks plausible
>
> Ian
>
> On 9 January 2018 at 09:41, Jan Boonen  wrote:
>
>> Hi list,
>>
>> For a complex GIS editing application I want to use GeoTools to replace
>> values in a coverage. The cells, whose values need to be replaced, must be
>> selected using an intersection with a JTS Geometry. All editing may be done
>> on in-memory coverages, only the end result will be written to a file.
>>
>> I have read through the tutorials and JavaDoc, but thus far I haven't
>> been able to figure out how to do an intersection on a coverage and how to
>> replace the value of individual cells. Would anybody be so kind to give me
>> some hints?
>>
>> Thanks in advance!
>>
>> Cheers,
>>
>> Jan
>>
>> 
>> --
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>> ___
>> GeoTools-Devel mailing list
>> geotools-de...@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/geotools-devel
>>
>>
>
>
> --
> Ian Turton
>



-- 
Ian Turton
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users


Re: [Geotools-gt2-users] problems with WFS-NG and no outputFormat specified

2018-01-09 Thread Mark Prins
2018-01-08 16:24 GMT+01:00 Andrea Aime :

> Hi Mark,
> if I'm not misreading the CITE tests a server that is not advertising the
> required formats is not compliant:
>
> https://github.com/opengeospatial/ets-wfs11/blob/master/src/
> main/scripts/ctl/basic/DescribeFeature/DescribeFeatureType-GET.xml#L273
>
> That said, the client is already trying to be tolerant to various
> misbehaviors in the interest of getting a working communication.
> I believe a pull request adding such behavior would be welcomed (although,
> not sure if it's going to be reviewed, being the module
> unsupported...)
>
>
yeah, that sure looks like a test that would fail ifor this case, the WFS
schema however says:



around line 500 in http://schemas.opengis.net/wfs/1.1.0/wfs.xsd suggesting
it may be ommitted.

I'll try and cook up a PR today and we'll see how that fares, I've opened
https://osgeo-org.atlassian.net/browse/GEOT-5924

Thanks, Mark


-- 
Disclaimer;
This message is just a reflection of what I thought at the time of sending.
The message may contain information that is not intended for you or that
you don't understand.
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users