I was able to figure out an answer to my question, so I’ll post it here for
others to find.
For Question 1, it looks like there is no answer: There is no way to set
any sort of layer attribute that will affect rendering options that are
available via WMS requests. Looking at the org.geoserver.wms package, its
pretty clear that the ONLY attributes that are considered when choosing
rendering options like which quantizer to use are set by the incoming WMS
parameters.
For Question 2, I found my solution. Working from a LayerInfo instance,
its possible to work with a related GeoServerTileLayerInfo instance. Here
is a chunk of example code.
The gwc reference was passed in during Spring bean construction via the
gwcFacade reference, e.g.:
<constructor-arg index="1" ref="gwcFacade"/>
= = = = = = = = = = = = = = = = = = = = = = = =
= = = = = = = = = = = = = = = = = = = = = = = =
RegexParameterFilter filter = new RegexParameterFilter();
filter.setKey(“format_options");
filter.setRegex(“.*");
filter.setDefaultValue("antialiasing:none;quantizer:octree;");
LayerInfo li = catalog.getLayerByName(“MyLayerName");
GeoServerTileLayer tileLayer = gwc.getTileLayer(li);
GeoServerTileLayerInfo tileLayerInfo = tileLayer.getInfo();
tileLayerInfo.addParameterFilter(filter);
= = = = = = = = = = = = = = = = = = = = = = = =
= = = = = = = = = = = = = = = = = = = = = = = =
Cheers,
Eric Everman
CIDA - Center for Integrated Data Analytics
US Geological Survey
Middleton, WI
http://cida.usgs.gov/
On Mon, Jan 19, 2015 at 3:59 PM, Everman, Eric <[email protected]> wrote:
> Here is an example of my Java code adding a layer. How could I
> specify non-antialiased and the octree quantizer for this layer so that I
> *don’t* need to specify those options via WMS?
>
> = = = = = = = = = = = = = = = = = = = = = = = =
> = = = = = = = = = = = = = = = = = = = = = = = =
> Map<String, Serializable> dsParams = new HashMap<>();
> dsParams.put("shapefile", state.shapeFile.toURI().toURL());
> dsParams.put("dbase_file", state.dbfFile.toURI().toURL());
> dsParams.put("namespace", state.namespace.getURI());
> dsParams.put("dbase_field", state.idFieldInDbf);
> dsParams.put("lastUsedMS", System.currentTimeMillis());
> DataStoreInfoImpl info = new DataStoreInfoImpl(catalog);
>
> //A custom datastore created by Tom Kunicki
> info.setType(DBASE_SHAPEFILE_JOIN_DATASTORE_NAME);
> info.setWorkspace(state.workspace);
> info.setEnabled(true);
> info.setName(state.layerName);
> info.setConnectionParameters(dsParams);
> CatalogBuilder cb = new CatalogBuilder(catalog);
> catalog.add(info);
> DataAccess<? extends FeatureType, ? extends Feature> dataStore =
> info.getDataStore(new NullProgressListener());
> List<Name> names = dataStore.getNames();
> Name allData = names.get(0);
> ProjectionPolicy srsHandling = ProjectionPolicy.FORCE_DECLARED;
> cb.setWorkspace(info.getWorkspace());
> cb.setStore(info);
> FeatureTypeInfo fti =
> cb.buildFeatureType(dataStore.getFeatureSource(allData));
> fti.setSRS(state.projectedSrs);
> fti.setName(state.layerName);
> fti.setTitle(state.layerName);
> fti.setDescription(state.description);
> fti.setAbstract(state.description);
> fti.setProjectionPolicy(srsHandling);
> cb.setupBounds(fti);
> LayerInfo li = cb.buildLayer(fti);
> if (state.defaultStyle != null) {
> li.setDefaultStyle(state.defaultStyle);
> }
> catalog.add(fti);
> catalog.add(li);
>
> = = = = = = = = = = = = = = = = = = = = = = = =
> = = = = = = = = = = = = = = = = = = = = = = = =
>
>
> Eric Everman
> CIDA - Center for Integrated Data Analytics
> US Geological Survey
> Middleton, WI
> http://cida.usgs.gov/
>
> On Sun, Jan 18, 2015 at 3:25 PM, Everman, Eric <[email protected]> wrote:
>
>> [Sorry if a double post - my first message didn’t show up]
>>
>> I’m adding data stores and layers in a WPS process. I’d like those
>> layers to be tile-cached, non-antialiased and use the octree quantizer
>> (non-default for this type of layer).
>>
>> So two questions:
>> 1) Is there some way in the Java LayerInfo object (or some other catalog
>> object) to force a layer to render as non-antialiased with the octree
>> quantizer?
>>
>> 2) How do I set attributes that appear on the Tile Caching tab of the
>> layer admin pages, particularly the parameter filters, via the Java API?
>>
>>
>> I realize I can force the rendering options in WMS requests by adding
>> this vendor param:
>> format_options=antialiasing:none;quantizer:octree
>> However, that causes caching misses without the appropriate GWC parameter
>> filters set on the layer tile cache page (thus question #2).
>>
>>
>>
>>
>> Thanks in advance for any suggestions or pointers,
>>
>>
>> Eric Everman
>>
>> CIDA - Center for Integrated Data Analytics
>> US Geological Survey
>> Middleton, WI
>> http://cida.usgs.gov/
>>
>
>
------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users