Hi Jody,
I’ve created a Jira issue, <http://jira.codehaus.org/browse/GEOT-4983>
GEOT-4983 - Map Legend Example, and attached the source code for review.
Best,
Hal
From: Jody Garnett [mailto:jody.garn...@gmail.com]
Sent: Friday, December 19, 2014 11:07 AM
To: Hal Mirsky
Cc: Andy Turner; geotools geotools-gt2-users@lists. sourceforge. net
Subject: Re: [Geotools-gt2-users] Choropleth map legend
We have some instructions (in GitHub) on how to contribute:
https://github.com/geotools/geotools/blob/master/CONTRIBUTING.md
TLDR: Need to ask you to email a "code contribution license" to OSGeo so they
are cool with us accepting work from you.
Ideally you would create a JIRA issue (and attach the source code to the issue).
I will package it up as a page for our user guide ... I am actually super happy
you got DirectLayer to work - I have been wanting to add a tutorial on that one
for a while.
--
Jody
--
Jody Garnett
On 19 December 2014 at 09:20, Hal Mirsky <hmir...@aseg.com> wrote:
Hi Jody,
Resending to the list.
I have an example program that illustrates how to put a legend on a map that I
can share.
The program allows the user to open one or more Shapefiles and specify style
information for each one. It then creates a legend layer using the feature
types and styles. The main program is a modified version of StyleLab. The
legend is a subclass of DirectLayer. There are also a few ‘helper’ classes to
make this a standalone demo.
What’s the next step to post the example?
Thanks,
Hal
From: Jody Garnett [mailto:jody.garn...@gmail.com]
Sent: Thursday, November 27, 2014 3:29 PM
To: Hal Mirsky
Cc: Andy Turner; geotools geotools-gt2-users@lists. sourceforge. net
Subject: Re: [Geotools-gt2-users] Choropleth map legend
That would be a killer example for the docs Hal - are you in position to share
your code?
Jody Garnett
On Tue, Nov 25, 2014 at 2:22 PM, Hal Mirsky <hmir...@aseg.com> wrote:
Andy,
I derived a class from DirectLayer and implemented the draw method which
worked great.
Some of the legend text was dynamic (e.g. low/high values for each color).
A little interesting to figure out the size of rectangles I needed to draw
for each legend item. Here's a snippet:
private Font titlef = new Font("Ariel", Font.BOLD, 12);
private Font itemf = new Font("Ariel", Font.BOLD, 10);
Rectangle2D titleLabelRect = titlef.getStringBounds(title, new
FontRenderContext(null, RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT,
RenderingHints.VALUE_FRACTIONALMETRICS_DEFAULT));
Rectangle2D itemLabelRect = itemf.getStringBounds(label, new
FontRenderContext(null, RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT,
RenderingHints.VALUE_FRACTIONALMETRICS_DEFAULT));
// now get the height of the title rectangle and height to use for each
legend item:
th = (int) titleLabelRect.getHeight();
ih = (int) itemLabelRect.getHeight(); // height of site label. Also used
as icon size
...
Hope this helps,
Hal
-----Original Message-----
From: Andy Turner [mailto:a.g.d.tur...@leeds.ac.uk]
Sent: Tuesday, November 25, 2014 11:36 AM
To: geotools-gt2-users@lists.sourceforge.net
Subject: [Geotools-gt2-users] Choropleth map legend
Hi,
I would like to have a map legend for the choropleth maps I am generating,
please will you help?
To style the main part of the map I have followed an example using
ColorBrewer and FilterFactory2. I have a Classifier by calling evaluate on a
Function from the FilterFactory2.
I've have searched and found others asking about this [1], but no answers.
[1]
http://gis.stackexchange.com/questions/22962/create-a-color-scale-legend-for
<http://gis.stackexchange.com/questions/22962/create-a-color-scale-legend-for-choropleth-map-using-geotools-or-other-open-sou>
-choropleth-map-using-geotools-or-other-open-sou
Thanks,
Andy
http://www.geog.leeds.ac.uk/people/a.turner/index.html
----------------------------------------------------------------------------
--
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from
Actuate! Instantly Supercharge Your Business Reports and Dashboards with
Interactivity, Sharing, Native Excel Exports, App Integration & more Get
technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751
<http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk>
&iu=/4140/ostg.clktrk
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751
<http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk>
&iu=/4140/ostg.clktrk
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
------------------------------------------------------------------------------
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
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users