[Geoserver-users] Freemarker templates and Google Earth

Wow. Very cool, I must say to see this in action. :slight_smile: But of course, there are a few problems…

I have developed some simple freemarker templates to output KML to Google earth via Geoserver from a PostGIS backend. I can control output of the description, name, and time now, which is nice. However, is it possible to control the markers that are used? I have defined a SLD based on a given attribute in the dataset to control styling. The style shows up as expected in OpenLayers, but does not seem to work properly with Google Earth. All points come out with the same color.

Am I missing something here?

Thanks again,
Jason

Can you send your SLD file to us? And possibly screenshots? It should pick up things from the SLD. Though it should be noted that external graphics work the best by far with Google Earth. If you're using well known marks in SLD then GeoServer can only really make use of the color. We may in the future try to make some improvements to use some default icons to support the others, but the way Google Earth works is by just referencing image files. The 'icon' section of http://docs.codehaus.org/display/GEOSDOC/02+Google+Earth+KML+Styling+Guide has an example.

Or are you wanting to control the placemark of a line or polygon? That we don't yet have support for. If you're interested in it then add it to our task tracker - http://jira.codehaus.org/browse/GEOS

best regards,

Chris

Jason Pickering wrote:

Wow. Very cool, I must say to see this in action. :slight_smile: But of course, there are a few problems....

I have developed some simple freemarker templates to output KML to Google earth via Geoserver from a PostGIS backend. I can control output of the description, name, and time now, which is nice. However, is it possible to control the markers that are used? I have defined a SLD based on a given attribute in the dataset to control styling. The style shows up as expected in OpenLayers, but does not seem to work properly with Google Earth. All points come out with the same color.

Am I missing something here?

Thanks again,
Jason

!DSPAM:4005,46c31c14151755219720167!
------------------------------------------------------------------------

-------------------------------------------------------------------------
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/

!DSPAM:4005,46c31c14151755219720167!
  ------------------------------------------------------------------------

_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

!DSPAM:4005,46c31c14151755219720167!
  

Hi Jason,

Can you be a bit more specific about what you are trying to accomplish.
You are trying to change the placemark icon? Or just the color of it?

Could you perhaps include the sld you are using? Thanks

-Justin

Jason Pickering wrote:

Wow. Very cool, I must say to see this in action. :slight_smile: But of course,
there are a few problems....

I have developed some simple freemarker templates to output KML to
Google earth via Geoserver from a PostGIS backend. I can control output
of the description, name, and time now, which is nice. However, is it
possible to control the markers that are used? I have defined a SLD
based on a given attribute in the dataset to control styling. The style
shows up as expected in OpenLayers, but does not seem to work properly
with Google Earth. All points come out with the same color.

Am I missing something here?

Thanks again,
Jason

!DSPAM:4007,46c31c14151741849620573!

------------------------------------------------------------------------

-------------------------------------------------------------------------
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/

!DSPAM:4007,46c31c14151741849620573!

------------------------------------------------------------------------

_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

!DSPAM:4007,46c31c14151741849620573!

--
Justin Deoliveira
The Open Planning Project
http://topp.openplans.org

Unfortunately, I cannot send any screen shots at the moment, due to the nature of the data and where I work. :frowning: Maybe soon though, once I get everything up and running and approved.

Anyway, I did not see that document. I see how to do it now, I think, using this type of code


   <Graphic>
     <ExternalGraphic>
        <OnlineResource xlink:type="simple" xlink:href="http:
//maps.google.com/mapfiles/kml/pal3/icon55.png"/>
        <Format>image/png</Format>
     </ExternalGraphic>
   </Graphic>

Shame on me for not digging deeper in the documentation, but it isn’t so easy to navigate through everything on the docs.codehaus.org website for us newbies! :wink:

Thanks as usual for your help. I will take a look at the documentation and get back to you with any more problems.

Best regards,
Jason

On 8/15/07, Justin Deoliveira <jdeolive@anonymised.com> wrote:

Hi Jason,

Can you be a bit more specific about what you are trying to accomplish.
You are trying to change the placemark icon? Or just the color of it?

Could you perhaps include the sld you are using? Thanks

-Justin

Jason Pickering wrote:

Wow. Very cool, I must say to see this in action. :slight_smile: But of course,
there are a few problems…

I have developed some simple freemarker templates to output KML to
Google earth via Geoserver from a PostGIS backend. I can control output
of the description, name, and time now, which is nice. However, is it
possible to control the markers that are used? I have defined a SLD
based on a given attribute in the dataset to control styling. The style
shows up as expected in OpenLayers, but does not seem to work properly
with Google Earth. All points come out with the same color.

Am I missing something here?

Thanks again,
Jason

!DSPAM:4007,46c31c14151741849620573!



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/

!DSPAM:4007,46c31c14151741849620573!



Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

!DSPAM:4007,46c31c14151741849620573!

–
Justin Deoliveira
The Open Planning Project
http://topp.openplans.org

Hi Everyone,
Sorry to bother you yet again with this, but I had yet another question. I managed to solve the problem that I had yesterday regarding styling of KML with freemarker templates, in combination with an SLD. That seems to work fine now. However, I am having some formatting issues with dates. I created a time.ftl template with the following information…

${timeattribute.value?date}

what is returned in the KML is this…

0006-03-17T00:00:00

From the database, I get this…

“2006-03-17” which is returned in a Postgres date type.

I have tried various combinations of Freemarker built-ins (as per the Freemarker documenation and the Geoserver examples), without any luck, often ending in an exception.

I would like the formatting of the date, to be maintained like it is in the original data “yyyy-mm-dd” but it seems that the “2” from “2006” gets deleted for some reason.

Any pointers would be appreciated.

Thanks and best regards,
Jason

On 8/15/07, Justin Deoliveira <jdeolive@anonymised.com > wrote:

Hi Jason,

Can you be a bit more specific about what you are trying to accomplish.
You are trying to change the placemark icon? Or just the color of it?

Could you perhaps include the sld you are using? Thanks

-Justin

Jason Pickering wrote:

Wow. Very cool, I must say to see this in action. :slight_smile: But of course,
there are a few problems…

I have developed some simple freemarker templates to output KML to
Google earth via Geoserver from a PostGIS backend. I can control output
of the description, name, and time now, which is nice. However, is it
possible to control the markers that are used? I have defined a SLD
based on a given attribute in the dataset to control styling. The style
shows up as expected in OpenLayers, but does not seem to work properly
with Google Earth. All points come out with the same color.

Am I missing something here?

Thanks again,
Jason

!DSPAM:4007,46c31c14151741849620573!



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/

!DSPAM:4007,46c31c14151741849620573!



Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

!DSPAM:4007,46c31c14151741849620573!

–
Justin Deoliveira
The Open Planning Project
http://topp.openplans.org

Jason Pickering ha scritto:

Hi Everyone,
Sorry to bother you yet again with this, but I had yet another question. I managed to solve the problem that I had yesterday regarding styling of KML with freemarker templates, in combination with an SLD. That seems to work fine now. However, I am having some formatting issues with dates. I created a time.ftl template with the following information....

${timeattribute.value?date}

what is returned in the KML is this..

<TimeStamp>
            <when>0006-03-17T00:00:00</when>
</TimeStamp>

From the database, I get this...

"2006-03-17" which is returned in a Postgres date type.

I have tried various combinations of Freemarker built-ins (as per the Freemarker documenation and the Geoserver examples), without any luck, often ending in an exception.

Jason,
I had a cursory look at the code but could not see anything obvious.
Question, does the problem appear even with the sample data or only
with your dataset (I'm not the one who wrote the KML support, so I'm
left guessing as well)? If your dataset is somewhat special, can you
send me and Justin a copy by private mail?

Cheers
Andrea

Hi Jason,

First off its never a bother :).

Secondly picked up on a bug so nice work!!. I have to look into it a bit
more but I believe that what is happening is this.

When the date gets pulled out of the database it gets thrown into a java
Date object... at which point the date has no format. When the date gets
thrown into freemarker its gets converted to a string using the default
java date format which converts it to the format MM/dd/yy HH:ss.

So... long story short try the freemarker statement:

${timeattribute.value?date("MM/dd/yy HH:ss")}

Let me know if this works for you.I have created a jira task to remedy
this.

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

Feel free to sign up as a watcher for it. Then you can grab the nightly
build after it is fixed.

-Justin

Jason Pickering wrote:

Hi Everyone,
Sorry to bother you yet again with this, but I had yet another question.
I managed to solve the problem that I had yesterday regarding styling of
KML with freemarker templates, in combination with an SLD. That seems to
work fine now. However, I am having some formatting issues with dates. I
created a time.ftl template with the following information....

${timeattribute.value?date}

what is returned in the KML is this..

<TimeStamp>
            <when>0006-03-17T00:00:00</when>
</TimeStamp>

From the database, I get this...

"2006-03-17" which is returned in a Postgres date type.

I have tried various combinations of Freemarker built-ins (as per the
Freemarker documenation and the Geoserver examples), without any luck,
often ending in an exception.

I would like the formatting of the date, to be maintained like it is in
the original data "yyyy-mm-dd" but it seems that the "2" from "2006"
gets deleted for some reason.

Any pointers would be appreciated.

Thanks and best regards,
Jason

On 8/15/07, *Justin Deoliveira* <jdeolive@anonymised.com
<mailto:jdeolive@anonymised.com> > wrote:

    Hi Jason,

    Can you be a bit more specific about what you are trying to accomplish.
    You are trying to change the placemark icon? Or just the color of it?

    Could you perhaps include the sld you are using? Thanks

    -Justin

    Jason Pickering wrote:
    > Wow. Very cool, I must say to see this in action. :slight_smile: But of course,
    > there are a few problems....
    >
    > I have developed some simple freemarker templates to output KML to
    > Google earth via Geoserver from a PostGIS backend. I can control
    output
    > of the description, name, and time now, which is nice.
    However, is it
    > possible to control the markers that are used? I have defined a SLD
    > based on a given attribute in the dataset to control styling. The
    style
    > shows up as expected in OpenLayers, but does not seem to work
    properly
    > with Google Earth. All points come out with the same color.

    >
    > Am I missing something here?
    >
    > Thanks again,
    > Jason
    >
    >
    >
    >
    >
    >
    ------------------------------------------------------------------------
    >
    >
    -------------------------------------------------------------------------
    > 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/
    >
    > !DSPAM:4007,46c31c14151741849620573!
    >
    >
    >
    ------------------------------------------------------------------------
    >
    > _______________________________________________
    > Geoserver-users mailing list
    > Geoserver-users@lists.sourceforge.net
    <mailto:Geoserver-users@lists.sourceforge.net>
    > https://lists.sourceforge.net/lists/listinfo/geoserver-users
    >
    >
    > !DSPAM:4007,46c31c14151741849620573!

    --
    Justin Deoliveira
    The Open Planning Project
    http://topp.openplans.org

!DSPAM:4007,46c3f143314271637810514!

------------------------------------------------------------------------

-------------------------------------------------------------------------
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/

!DSPAM:4007,46c3f143314271637810514!

------------------------------------------------------------------------

_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

!DSPAM:4007,46c3f143314271637810514!

--
Justin Deoliveira
The Open Planning Project
http://topp.openplans.org

Hi Justin,
I have a jira account, so I will keep an eye on the issue. Yup, this seems to have fixed it.

I have some issues with the nightly builds, which seem to be related to my local setup and spatial views, but I will give them a try again.

Thanks for your help!

Best regards,
Jason

On 8/16/07, Justin Deoliveira <jdeolive@anonymised.com > wrote:

Hi Jason,

First off its never a bother :).

Secondly picked up on a bug so nice work!!. I have to look into it a bit
more but I believe that what is happening is this.

When the date gets pulled out of the database it gets thrown into a java
Date object… at which point the date has no format. When the date gets
thrown into freemarker its gets converted to a string using the default
java date format which converts it to the format MM/dd/yy HH:ss.

So… long story short try the freemarker statement:

${timeattribute.value?date(“MM/dd/yy HH:ss”)}

Let me know if this works for you.I have created a jira task to remedy
this.

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

Feel free to sign up as a watcher for it. Then you can grab the nightly
build after it is fixed.

-Justin

Jason Pickering wrote:

Hi Everyone,
Sorry to bother you yet again with this, but I had yet another question.
I managed to solve the problem that I had yesterday regarding styling of
KML with freemarker templates, in combination with an SLD. That seems to
work fine now. However, I am having some formatting issues with dates. I
created a time.ftl template with the following information…

${timeattribute.value?date}

what is returned in the KML is this…

0006-03-17T00:00:00

From the database, I get this…

“2006-03-17” which is returned in a Postgres date type.

I have tried various combinations of Freemarker built-ins (as per the
Freemarker documenation and the Geoserver examples), without any luck,
often ending in an exception.

I would like the formatting of the date, to be maintained like it is in
the original data “yyyy-mm-dd” but it seems that the “2” from “2006”
gets deleted for some reason.

Any pointers would be appreciated.

Thanks and best regards,
Jason

On 8/15/07, Justin Deoliveira < jdeolive@anonymised.com
mailto:[jdeolive@anonymised.com](mailto:jdeolive@anonymised.com) > wrote:

Hi Jason,

Can you be a bit more specific about what you are trying to accomplish.
You are trying to change the placemark icon? Or just the color of it?

Could you perhaps include the sld you are using? Thanks

-Justin

Jason Pickering wrote:

Wow. Very cool, I must say to see this in action. :slight_smile: But of course,
there are a few problems…

I have developed some simple freemarker templates to output KML to
Google earth via Geoserver from a PostGIS backend. I can control
output
of the description, name, and time now, which is nice.
However, is it
possible to control the markers that are used? I have defined a SLD
based on a given attribute in the dataset to control styling. The
style
shows up as expected in OpenLayers, but does not seem to work
properly
with Google Earth. All points come out with the same color.

Am I missing something here?

Thanks again,
Jason



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/

!DSPAM:4007,46c31c14151741849620573!



Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
<mailto:Geoserver-users@lists.sourceforge.net >
https://lists.sourceforge.net/lists/listinfo/geoserver-users

!DSPAM:4007,46c31c14151741849620573!

–
Justin Deoliveira
The Open Planning Project
http://topp.openplans.org

!DSPAM:4007,46c3f143314271637810514!



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/

!DSPAM:4007,46c3f143314271637810514!



Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

!DSPAM:4007,46c3f143314271637810514!

–
Justin Deoliveira
The Open Planning Project
http://topp.openplans.org