GeoServer HTML ImageMap extension?

View: New views
7 Messages — Rating Filter:   Alert me  

GeoServer HTML ImageMap extension?

by Mauro Bartolomeoli :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

All in all your approach seems more complete, so it may make sense
> to try to add
Ok, good.
>
  
>> Also, I'm quite new to GeoTools/GeoServer programming so we surely 
>> need some review on the code by some expert.
>>
>> I include some documentation on our plugin at the bottom of the 
>> message, so that you can decide what is good and what is bad and 
>> maybe produce a single unified plugin.
>>
>> Here is the documentation (any suggestion is appreciated):
>>
>> HTMLImageMap GetMapProducer 1.0 for GeoServer 1.5.x
>>
>> USAGE
>> ---------------------------
>>
>> The HTMLImageMap GetMapProducer adds support for an additional output 
>> format for
>> WMS GetMap requests. The new format is associated to the "text/html" 
>> mime type
>> and produces an HTML 4.0 image map as defined by W3C.
    
>
> I looked around, could not find an official "imagemap" mime type...
> given that imagemaps are in fact part of html, it seems it makes
> sense to have them be "text/html".
> So it means you're producing a full blown html page right?
  
At the moment I'm outputting just the <map>...</map> fragment (it's 
trivial to add an enclosing <html><body>...</body></html> if it's 
needed). Our current approach is "less is better", so we don't return 
anything else other than the ImageMap.
> Do you present it to the user as is, or do some javascript wizardry
> to merge it with another html page?
  
The latter, we currently use it in a full blown application where we 
"merge" a raster map with the imagemap at runtime (when it's needed). 
This means two different requests to geoserver, one for the raster map, 
one for the "tooltip" imagemap level. But this is the way we use it. 
Someone else can probably use it in a different way.
>
  
>> Image Maps can be used to cut images in several areas. Each area can 
>> have a link,
>> title or alt attribute.
>>
>> Request Example.
>> http://localhost:8080/geoserver/wms?bbox=-130,24,-66,50&styles=population&Format=text/ 
>>
>> html&request=GetMap&layers=topp:states&width=550&height=250&srs=EPSG:4326 
>>
>>
>> Output Example.
>> <map name="states">
>>    <area shape="poly" id="states.1.0"  coords="360,120 358,121 
>> 357,121 357,122
>> 357,123 357,124 356,124 355,124 354,123 352,123 351,124 351,125 
>> 350,124 350,125
>> 349,125 349,124 348,123 348,122 348,121 348,120 348,118 347,118 
>> 346,117 345,116
>> 344,116 343,115 342,114 341,113 341,112 341,111 341,110 342,110 
>> 342,109 343,108
>> 342,107 340,106 339,107 338,107 338,105 338,104 337,103 336,102 
>> 336,102 335,101
>> 333,100 332,99 332,98 331,97 331,96 331,95 331,94 331,93 332,91 
>> 332,90 333,90 334,90
>> 334,89 335,88 336,86 335,85 334,84 335,83 336,82 336,82 338,82 339,82 
>> 340,81 341,81
>> 341,80 342,79 342,78 342,77 342,76 341,75 340,74 340,73 339,73 338,72 
>> 340,72 344,72
>> 349,72 353,72 354,72 358,72 359,72 363,72 362,74 363,75 364,76 364,78 
>> 365,80 365,82
>> 365,84 365,85 365,86 365,89 365,91 365,95 365,97 365,100 365,101 
>> 365,102 364,103
>> 364,104 364,105 365,106 365,107 365,108 365,109 364,110 364,110 
>> 363,111 363,112
>> 362,113 361,113 362,114 361,115 361,116 360,117 360,118 360,119 
>> 360,120" title="IL"/>
>>    ...
>> </map>
>>
>> Each single feature is rendered as one or more area tag. More than 
>> one area tag is
>> used if the geometry is not compatible with imagemaps constraints, 
>> and a split in
>> more simple geometries is needed.
    
>
> Good. A possible improvement would be to generalize the geometries 
> even further to reduce the size of the image map (just an idea).
  
We already generalize the geometry using a modifiied version of the 
Decimator code I found in the geotools renderer module.
>
  
>> An ID attribute is generated for each area tag. The ID is made up of 
>> two parts:
>> <featureId>.<sequence>, where <featureId> is the id of the feature 
>> containing the
>> geometry rendered in the tag. Sequence is a sequential number (0,1,2, 
>> ...) appended
>> to the id distinguishing different simple geometries in which the 
>> feature could have
>> been splitted.
>>
>> Usage Example.
>> <img src="..." usemap="#states"/>
>>
>> STYLING
>> ----------------------------
>> A little bit of styling is supported through SLD symbolizers. In 
>> particular:
>> - TextSymbolizers are used to append attributes to the area tags. You 
>> can define a
>> Label, whose output will be rendered as an attribute value. By 
>> default, the
>> attribute name is "title" (this permits to define tooltips). You can 
>> define several
>> custom attributes, using different rules, the rule name will be used 
>> as attribute
>> name (eg.
>> <Rule>...<Name>href</Name>...<TextSymbolizer>...</TextSymbolizer>...</Rule> 
>> defines
>> an href attribute, binding links to the rendered areas).
    
>
> Nice!
  
Thanks.
>
  
>> - LineSymbolizers stroke-width parameter is used to define a buffer 
>> along
>> linestrings (defaults to 2px if not defined).
>> - PointSymbolizers Size is used to define circle radius for rendered 
>> points
>> (currently only Marks with a WellKnownName of "circle" are
>>   supported).
    
>
> So this covers the case Robert was talking about already?
  
I think so.
>
> It seems quite full featured and well integrated in the way GeoServer 
> does things. Can I have a look at the code? 
  
Sure, just tell me where I can send a zip (or something else you 
prefer). I'm not really sure if the "reprojection" code I use is 
correct. Due to my inexperience in GeoTools/GeoServer most of the work 
has been done copying and pasting from other modules and so I'm not sure 
about the result quality. Any suggestion is very much appreciated.

Thanks,
Mauro Bartolomeoli


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Geotools-devel mailing list
Geotools-devel@...
https://lists.sourceforge.net/lists/listinfo/geotools-devel

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@...
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Re: GeoServer HTML ImageMap extension?

by aaime :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Mauro Bartolomeoli ha scritto:

>> > It seems quite full featured and well integrated in the way GeoServer
>> > does things. Can I have a look at the code?
>>  
> Sure, just tell me where I can send a zip (or something else you
> prefer). I'm not really sure if the "reprojection" code I use is
> correct. Due to my inexperience in GeoTools/GeoServer most of the work
> has been done copying and pasting from other modules and so I'm not sure
> about the result quality. Any suggestion is very much appreciated.

If you prefer to send a zip, the best way would be to open a jira issue
and attach the zipped source code (without extra libraries and such)
to it.

Cheers
Andrea

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@...
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Re: GeoServer HTML ImageMap extension?

by Mauro Bartolomeoli :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



Andrea Aime wrote:

> Mauro Bartolomeoli ha scritto:
>
>>> > It seems quite full featured and well integrated in the way
>>> GeoServer > does things. Can I have a look at the code?  
>> Sure, just tell me where I can send a zip (or something else you
>> prefer). I'm not really sure if the "reprojection" code I use is
>> correct. Due to my inexperience in GeoTools/GeoServer most of the
>> work has been done copying and pasting from other modules and so I'm
>> not sure about the result quality. Any suggestion is very much
>> appreciated.
>
> If you prefer to send a zip, the best way would be to open a jira issue
> and attach the zipped source code (without extra libraries and such)
> to it.
Done. This is the link:

http://jira.codehaus.org/browse/GEOS-1406

Thanks,
Mauro Bartolomeoli


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@...
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Re: GeoServer HTML ImageMap extension?

by Chris Holmes :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


>
>> > Do you present it to the user as is, or do some javascript wizardry
>> > to merge it with another html page?
>>  
> The latter, we currently use it in a full blown application where we
> "merge" a raster map with the imagemap at runtime (when it's needed).
> This means two different requests to geoserver, one for the raster map,
> one for the "tooltip" imagemap level. But this is the way we use it.
> Someone else can probably use it in a different way.
>
This is super cool.  I like this approach a lot.  Can you do full
javascript pop-ups in your onclick events?  Like instead of just a
tooltip?  If it can do that then we're very close to a way to better
solve the issue of displaying tons of javascript pop-up points on a map.
  I think Google recently paid a lot of money to buy a company for this
very technology - to render out the clickable pop-ups instead of doing
them with javascript.

Chris

[cholmes.vcf]

begin:vcard
fn:Chris Holmes
n:Holmes;Chris
org:The Open Planning Project
adr:;;349 W. 12th Street, #3;New York;NY;10014;USA
email;internet:cholmes@...
title:Managing Director, Strategic Development
x-mozilla-html:FALSE
url:http://topp.openplans.org
version:2.1
end:vcard



-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@...
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Re: GeoServer HTML ImageMap extension?

by Mauro Bartolomeoli :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



Chris Holmes wrote:

>
>>
>>> > Do you present it to the user as is, or do some javascript wizardry
>>> > to merge it with another html page?
>>>  
>> The latter, we currently use it in a full blown application where we
>> "merge" a raster map with the imagemap at runtime (when it's needed).
>> This means two different requests to geoserver, one for the raster
>> map, one for the "tooltip" imagemap level. But this is the way we use
>> it. Someone else can probably use it in a different way.
>>
>
> This is super cool.  I like this approach a lot.  Can you do full
> javascript pop-ups in your onclick events?  Like instead of just a
> tooltip?  If it can do that then we're very close to a way to better
> solve the issue of displaying tons of javascript pop-up points on a
> map.  I think Google recently paid a lot of money to buy a company for
> this very technology - to render out the clickable pop-ups instead of
> doing them with javascript.
>
> Chris
In theory, you can define an SLD like this:

<Rule>
    <Name>onclick</Name>
    ...
    <TextSymbolizer>
       <Label>
             <Function name="strConcat">
                   <Literal>viewInfo('</Literal>
                      <Function name="strConcat">
                               <PropertyName>[the property containing
text or html to view on a popup window]</PropertyName>
                               <Literal>');</Literal>
                      </Function>
             </Function>
       </Label>
    </TextSymbolizer>
    ...
</Rule>


With this SLD (or something similar, I didn't try it), anytime you click
on an area of your map you call the viewTooltip js function with a
property dynamically taken from your feature. In the viewTooltip
function you can obviously open a javascript popup to visualize the
received text. It needs some test to verify crossbrowser issues, but I
think it should work. Is this a good answer to your question?

Thanks,
Mauro Bartolomeoli



-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@...
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Re: GeoServer HTML ImageMap extension?

by Chris Holmes :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



Mauro Bartolomeoli wrote:

>
>
> Chris Holmes wrote:
>>
>>>
>>>> > Do you present it to the user as is, or do some javascript wizardry
>>>> > to merge it with another html page?
>>>>  
>>> The latter, we currently use it in a full blown application where we
>>> "merge" a raster map with the imagemap at runtime (when it's needed).
>>> This means two different requests to geoserver, one for the raster
>>> map, one for the "tooltip" imagemap level. But this is the way we use
>>> it. Someone else can probably use it in a different way.
>>>
>>
>> This is super cool.  I like this approach a lot.  Can you do full
>> javascript pop-ups in your onclick events?  Like instead of just a
>> tooltip?  If it can do that then we're very close to a way to better
>> solve the issue of displaying tons of javascript pop-up points on a
>> map.  I think Google recently paid a lot of money to buy a company for
>> this very technology - to render out the clickable pop-ups instead of
>> doing them with javascript.
>>
>> Chris
> In theory, you can define an SLD like this:
>
> <Rule>
>    <Name>onclick</Name>
>    ...
>    <TextSymbolizer>
>       <Label>
>             <Function name="strConcat">
>                   <Literal>viewInfo('</Literal>
>                      <Function name="strConcat">
>                               <PropertyName>[the property containing
> text or html to view on a popup window]</PropertyName>
>                               <Literal>');</Literal>
>                      </Function>
>             </Function>
>       </Label>
>    </TextSymbolizer>
>    ...
> </Rule>
>
Whoa, this is an interest work around to the fact that we don't
implement our 'label' reading correctly.

<Label>This is city "<ogc:PropertyName>NAME</ogc:PropertyName>"
of state <ogc:PropertyName>STATE</ogc:PropertyName></Label>

Is supposed to be a valid label, that example is in the spec, and we
don't support it.  If you feel like getting in to the geotools level I'd
more than welcome a patch for that, so you wouldn't have to use
strConcat functions.

>
> With this SLD (or something similar, I didn't try it), anytime you click
> on an area of your map you call the viewTooltip js function with a
> property dynamically taken from your feature. In the viewTooltip
> function you can obviously open a javascript popup to visualize the
> received text. It needs some test to verify crossbrowser issues, but I
> think it should work. Is this a good answer to your question?

Cool, I'm pretty sure that answers my question.  I'm excited to play
with it, sounds like some nice work.

best regards,

Chris

>
> Thanks,
> Mauro Bartolomeoli
>
>
>
> !DSPAM:4005,47163a96229215332866982!
>

[cholmes.vcf]

begin:vcard
fn:Chris Holmes
n:Holmes;Chris
org:The Open Planning Project
adr:;;349 W. 12th Street, #3;New York;NY;10014;USA
email;internet:cholmes@...
title:Managing Director, Strategic Development
x-mozilla-html:FALSE
url:http://topp.openplans.org
version:2.1
end:vcard



-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@...
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Re: GeoServer HTML ImageMap extension?

by telstar :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

If I use a .png/.svg file as symbol, why not generate the element(<area shape="circle") according to the coordinate(center) and the size(radius) of symbol?

Anyone who can send me the .jar file of HTMLImageMapGetMapProducer?
I have failed to build it myself for half a week!!!

Mauro Bartolomeoli wrote:

Andrea Aime wrote:
> Mauro Bartolomeoli ha scritto:
>
>>> > It seems quite full featured and well integrated in the way
>>> GeoServer > does things. Can I have a look at the code?  
>> Sure, just tell me where I can send a zip (or something else you
>> prefer). I'm not really sure if the "reprojection" code I use is
>> correct. Due to my inexperience in GeoTools/GeoServer most of the
>> work has been done copying and pasting from other modules and so I'm
>> not sure about the result quality. Any suggestion is very much
>> appreciated.
>
> If you prefer to send a zip, the best way would be to open a jira issue
> and attach the zipped source code (without extra libraries and such)
> to it.
Done. This is the link:

http://jira.codehaus.org/browse/GEOS-1406

Thanks,
Mauro Bartolomeoli


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel
LightInTheBox - Buy quality products at wholesale price