Hi,
I have not followed this discussion closely but I wonder if you could make a process that is doing the same as these WFS requests:
Find a state with least employed (min):
Find a state with most employed (max):
-Jukka Rahkonen-
Bonventi Matthieu wrote:
···
Hello, (forgot to check answer all)
Sorry to bother you.
I am still trying to figure out something to get the minimum and maximum value of the feature collection and calculate the color.
I am a beginner so I understood only 50% of what you said in mails. I am trying to understand how geotools function and processes work but I only got headaches until now.
What you told me was to use a transformation process to get access the whole collection.
"By the way, forgot one thing… there is a function that can see the whole collection, it’s the rendering
transformation one.
So I guess if you wanted, you could use that one to do the computation, and bake directly into the
attributes the color you want, and then in the style you just pick the color."
I didn’t understand what did you mean there. How I can get the current value (of the polygon I want to fill with a color), the current max and the current min to compute a color code ?
I think I missed something somewhere. In the SLD I will have a which takes juste one argument ? (My feature collection) and a which I will use to fill the polygon. But how do I get the value from the transformation process to till the polygon with a certain color. I mean could you possibly explain me the whole process with simple words and examples ? Because I can’t get it.
Again sorry to bother you,
Thank you very much
2015-02-09 13:21 GMT+01:00 Bonventi Matthieu <matthieu.bonventi@…403…>:
'If you want to go that way yes… otherwise you just extend the feature type with a “color” attribute and use
it directly in the style.
A rendering transformation can do worse things (change raster into vector and vice versa), adding an
attribute is kind of light lifting for it ;-)’
It seems simple to you but not for me…I am on the same poblem for weeks now And I am still not able to get some results, I hope you will be able to help me
Thank you
2015-02-09 13:03 GMT+01:00 Bonventi Matthieu <matthieu.bonventi@…403…>:
I think I don’t understand how the whole thing is functionning . I try to code , the first part is :
@DescribeProcess(title = “DynamicColorCompute”, description = “xxxx”)
public class DynamicColorCompute implements GSProcess {
@DescribeResult(name = “result”, description = “xxx”)
public SimpleFeatureCollection execute(
// process data
@DescribeParameter(name = “data”, description = “Features containing the data points”) SimpleFeatureCollection obsFeatures, ProgressListener progressListener)
throws ProcessException {
FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();
Expression = ff.property(obsFeatures);
MaxVisitor maxVisitor = new MaxVisitor(expression);
collection.accepts(maxVisitor, null);
CalcResult resultmax = maxVisitor.getResult();
Object max = resultmax.getValue();
MinVisitor minVisitor = new MinVisitor(expression);
collection.accepts(minVisitor, null);
CalcResult resultmin = minVisitor.getResult();
Object min = resultmin.getValue();
}
}
Is it the right way to get the min value and max value ? But how can I connect it with that part of code (which need to have a value as input with the min and max) :
private Color getRGBcolor(float value,float minValue,float maxValue,float saturation,float brightness) {
float hue = (value - minValue) / (maxValue - minValue);
if (hue < 0.0f || hue > 1.0f) {
return null;
}
int rgb = Color.HSBtoRGB(adjustedGradient(hue), saturation, brightness);
return new Color(rgb);
}
private float adjustedGradient(float hue) {
return hue * 0.32f;
}
2015-02-09 12:10 GMT+01:00 Bonventi Matthieu <matthieu.bonventi@…403…>:
Plus, how can I access the current feature to code the color ? I mean what I need to contribute the new attribute is the current value,the min and the max.
2015-02-09 11:33 GMT+01:00 Bonventi Matthieu <matthieu.bonventi@…403…>:
Hello Andrea,Jody,
I am back to work and I just want to check something.
First, let’s back to the problem, The process will be :
1/ get dataset through the ‘data’ paramter of the tranformation function
2/ access the all data collection to get be able to get the min and the max
3/ compute the hue color code
4/ return it to the sld where I call the function I made 2 weeks ago to color it
Basically If I understood, The tranformation process get the data set, compute something and send it back to the symbolizer.
Secondly, You told me I should use the tranformation process one. So you mean I have to use the heatmap ? I read the code and find
@DescribeProcess(title = "Heatmap", description = "Computes a heatmap surface over a set of irregular data points as a GridCoverage.")
public class HeatmapProcess implements GSProcess {
@DescribeResult(name = "result", description = "The heat map surface as a raster")
public GridCoverage2D execute(
// process data
@DescribeParameter(name = "data", description = "Features containing the data points") SimpleFeatureCollection obsFeatures
So I should be able to get the min and max from obsFeatures right ? My question is what I have to put instead of GridCoverage2D Because Actually I don't want any tranformation, just compute a value using the min and max of the collection and return that value to the sld to proceed with the coloration ?
I hope I don’t bother your with all these questions but at the end maybe we will have a dynamic Choropleth map, interesting isn’t it ?
Best regards
2015-01-30 21:44 GMT+01:00 Andrea Aime <andrea.aime@…1268…>:
On Fri, Jan 30, 2015 at 8:53 PM, Jody Garnett <jody.garnett@…403…> wrote:
That is a good idea … although this is probably the whole collection for the current bounding box. All we would have to do is be able to assign the result to an environment variable to complete the workflow.
If you want to go that way yes… otherwise you just extend the feature type with a “color” attribute and use
it directly in the style.
A rendering transformation can do worse things (change raster into vector and vice versa), adding an
attribute is kind of light lifting for it
Cheers
Andrea
–
==
GeoServer Professional Services from the experts! Visit
http://goo.gl/NWWaa2 for more information.
==
Ing. Andrea Aime
@geowolf
Technical Lead
GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549
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.
–
Matthieu BONVENTI
–
Matthieu BONVENTI
–
Matthieu BONVENTI
–
Matthieu BONVENTI
–
Matthieu BONVENTI