On 24/10/2011 20:27, Andrea Aime wrote:
On Mon, Oct 24, 2011 at 5:36 PM, Jan De Moerloose
<[email protected] <mailto:[email protected]>>
wrote:
Hi all,
i would like to extend the way in which external graphics can be
resolved in the main Geotools SLD parser.
As far as i know, you can now specify the location of an external
graphic in two ways:
- specify the location as a relative URL w.r.t. the SLD document URL
- specify the location as a java classpath resource
The first case assumes that the document URL is known and reachable,
which is not allways the case (e.g. transfer of SLD over the wire or
configuring SLD in a database and so on). The second case is a nice
fallback in many circumstances but for web applications it is very
common to put graphics in a non-classpath location like the web
context.
My suggestion is to make the location more customizable by adding a
resource locator to the SLD parser:
setOnlineResourceLocator(ResourceLocator resourceLocator);
where ResourceLocator would define the following:
public URL locateResource(String uri);
Do you think this is a good enhancement or did i overlook anything in
the current implementation ?
The SLD specification says that a Graphic can contain a number of
different external resources and marks, with a fallback mechanism:
if the first one cannot be found, the second is looked up, and so on.
Actually I am not really looking for fallbacks, i just want to be able
to refer to external resources in a custom way.
It seems to me what you want is already there, just not transparent.
I guess i'm missing something, but I don't see how i can modify the
current behavior (except for extending SLDParser, of course).
Another option if you need something programmatic you also look into
implementing
your own ExternalGraphicFactory which might have as much fallback logic
as you like (I guess).
Problem is that i don't even reach this factory because my relative path
cannot be turned into a valid url (no protocol) by the SLDParser.
Adding a custom protocol would probably work but make the sld less
portable (simple href behavior assumes that you can just add it to the
base url).
cheers,
Jan
Cheers
Andrea
--
-------------------------------------------------------
Ing. Andrea Aime
GeoSolutions S.A.S.
Tech lead
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 962313
http://www.geo-solutions.it
http://geo-solutions.blogspot.com/
http://www.youtube.com/user/GeoSolutionsIT
http://www.linkedin.com/in/andreaaime
http://twitter.com/geowolf
-------------------------------------------------------
--
Sincerely,
Jan De Moerloose
Geosparc n.v.
http://www.geosparc.com
sponsor of http://www.geomajas.org
------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn
about Cisco certifications, training, and career opportunities.
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel