A bit of research shows that shapefile (well DBF) does not support
timestamp. You have the option of storing this in two parts (as a date
attribute and a time attribute) or storing it as a String as you are doing
above. It remains to be seen if our KML code can handle timestamps, to
experiment you will need to use a datastore that supports timestamps such
as PostGIS.

Let me try another line of inquiry .. searching the code.

* I could not find any examples of "when" in any of the test-data kml files
so it is safe to say this feature is not implemented.

* Reading the code there *is* a DateTimeTypeBinding, but it is not
implemented yet:
https://github.com/geotools/geotools/blob/master/modules/extension/xsd/xsd-kml/src/main/java/org/geotools/kml/bindings/DateTimeTypeBinding.java



--
Jody Garnett

On 8 April 2015 at 02:34, Tahina Ralitera <tahina.ralitera...@gmail.com>
wrote:

> Hi,
>
> I am not sure to understand the answer. This is a portion of my source
> code:
>
> SimpleFeatureTypeBuilder typeBuilder = new SimpleFeatureTypeBuilder();
> SimpleDateFormat timestp = new
> SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
> Date dt=javaCalendar.getTime();
>
>
> typeBuilder.setName("Agent");
> typeBuilder.add("geometry", Point.class, DefaultGeographicCRS.WGS84);
> typeBuilder.add("name", String.class);
> typeBuilder.add("TimeStamp", String.class);
>
> SimpleFeatureType TYPE = typeBuilder.buildFeatureType();
>
> DefaultFeatureCollection features = new DefaultFeatureCollection();
>
> features.add( SimpleFeatureBuilder.build( TYPE, new
> Object[]{gf.createPoint(c),"myname",timestp.format(dt) }, null) );
>
> I get that in my KML file:
>
> <kml:Data name="TimeStamp">
>           <kml:value>2015-04-08T11:57:17.885Z</kml:value>
>         </kml:Data>
>
> But what I want to have is:
>
> <TimeStamp>
> <when>.......
> </when>
> </TimeStamp>
>
> 2015-03-24 20:10 GMT+04:00 Jody Garnett <jody.garn...@gmail.com>:
>
>> Try and create a feature type with a timestamp attribute? If it works
>> great, if not modify the KML code to recognize / respect timestamps and
>> send us a pull request.
>>
>> --
>> Jody Garnett
>>
>> On 24 March 2015 at 05:33, Tahina Ralitera <tahina.ralitera...@gmail.com>
>> wrote:
>>
>>> Hi all,
>>>
>>> I use geotools to generate a kml file.
>>>  I want to add timestamp tag inside my KML file:
>>>
>>> <TimeStamp>
>>> <when>.......
>>> </when>
>>> </TimeStamp>
>>> but I don't know how to do that. Could someone help me?
>>>
>>> Thank you,
>>>
>>> Tahina
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Dive into the World of Parallel Programming The Go Parallel Website,
>>> sponsored
>>> by Intel and developed in partnership with Slashdot Media, is your hub
>>> for all
>>> things parallel software development, from weekly thought leadership
>>> blogs to
>>> news, videos, case studies, tutorials and more. Take a look and join the
>>> conversation now. http://goparallel.sourceforge.net/
>>> _______________________________________________
>>> GeoTools-GT2-Users mailing list
>>> GeoTools-GT2-Users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>>>
>>>
>>
>
------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to