[gdal-dev] CSV to GeoRSS: problem with pubDate field

Even Rouault even.rouault at spatialys.com
Sun Aug 6 01:41:10 PDT 2017


On lundi 31 juillet 2017 10:37:41 CEST aborruso wrote:
> Hi,
> I'm using GDAL 2.3.0dev to convert a CSV to GeoRSS, but I'm not able to set
> properly pubDate field.
> 
> My test input CSV is (tab separated):
> 
> title	description	guid	link	pubDate
> titolo	des	http://www.tin.it/1	http://www.tin.it/1	Wed, 11 Jul 2007 
15:39:21
> GMT
> 
> I run:
> 
> ogr2ogr  -f GeoRSS  georss.xml source.csv source
> 
> And I have "ERROR 1: Wrong field type for pubDate" error and this XML
> output:
> 
> <?xml version="1.0"?>
> <rss version="2.0" xmlns:georss="http://www.georss.org/georss">
>   <channel>
>     <title>title</title>
>     <description>channel_description</description>
>     <link>channel_link</link>
>     <item>
>       <title>titolo</title>
>       <description>des</description>
>       <guid>http://www.tin.it/1</guid>
>       <link>http://www.tin.it/1</link>
>     </item>
>   </channel>
> </rss>
> 
> It's almost perfect, but without pubDate. How to set it in my source CSV?

The issue is that the GeoRSS driver expects the pubDate field to be of OGR type DateTime 
but the formatting "Wed, 11 Jul 2007 15:39:21 GMT" is not recognized by OGR. So if instead 
you put "2007/07/11 15:39:21" as the pubDate value in your CSV and add " -oo 
AUTODETECT_TYPE=YES" this will work. The GeoRSS writer will format the date as "Wed, 11 
Jul 2007 15:39:21 GMT" in the output file.

ogr2ogr  -f GeoRSS  georss.xml source.csv -oo AUTODETECT_TYPE=YES

Even


-- 
Spatialys - Geospatial professional services
http://www.spatialys.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20170806/8e97756c/attachment.html>


More information about the gdal-dev mailing list