CSV to GeoRSS: problem with pubDate field

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

CSV to GeoRSS: problem with pubDate field

aborruso
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?

Thank you,

Andrea

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: CSV to GeoRSS: problem with pubDate field

aborruso
Hi,
does someone of you have an hello world example that works to transform with GDAL a CSV to GeoRSS?

I'm writing here, because I do not find any tips everywhere.

Thank you again
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: CSV to GeoRSS: problem with pubDate field

Even Rouault-2
In reply to this post by aborruso

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


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: CSV to GeoRSS: problem with pubDate field

aborruso
In reply to this post by aborruso
Solved, it was a stupid question: I must use a csvt and set the input pubDate CSV field as `DateTime`.

Thank you
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: CSV to GeoRSS: problem with pubDate field

aborruso
In reply to this post by Even Rouault-2
Hi Even,

Even Rouault-2 wrote
ogr2ogr  -f GeoRSS  georss.xml source.csv -oo AUTODETECT_TYPE=YES
so simple, so powerful.

Thank you very much
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: CSV to GeoRSS: problem with pubDate field

aborruso
In reply to this post by aborruso
Hi all,
I have written a small tutorial related (in italian): https://medium.com/tantotanto/trasformare-un-csv-in-un-feed-rss-7a6bd7b8c2f

Thank you gdal/ogr developers
Loading...