csv-import (was:Re: [Thuban-devel] Re: Lots of interesting code in precision farming application)

Moritz Lennert mlennert at club.worldonline.be
Mon Nov 29 23:15:31 CET 2004


Replying to myself in order to complement what I said:

On Mon, November 29, 2004 11:44, Moritz Lennert said:
> Dear Jan and Bernhard,
>
> On Sat, November 27, 2004 13:29, Jan-Oliver Wagner said:
>> On Sat, Nov 27, 2004 at 10:40:03AM +0100, Moritz Lennert wrote:
>>>
>>> If noone else (with more experience) is planning on doing so, I am willing
>>> to
>>> try to extract the csv-import functions as a seperate extension.
>>
>> that'll be great. Note that this involves also some work on
>> MemoryShapestores in case you want to load the data directly into Thuban.
>> There is an alternaive of indirectly loading it by first producing s
> shapefile formatted file. See gns2shp for an example.
>>
>
> There is a form of MemoryShapestores in Ole's code if I am not mistaken. I
> think this is the way to go. Having to create new shapefiles is not very
> elegant in my opinion. Thuban should be able to load the new data directly.
>
> But I guess we should agree on one implementation of a MemoryShapestore. This
> is up to you developers to decide, as I don't know/understand the code enough
> to decide this.
>



The MemoryShapeStore in Ole's Code is in data_fake.py. To my innocent eyes it
looks quite complete and self-contained (the import from punkt is actually not
needed).

But again: it is up to you to decide on one single implementation. And I would
need this decision in order to continue working on a new csv import extension.

>
>
> On Sat, November 27, 2004 17:58, Bernhard Herzog said:
>> "Moritz Lennert" <mlennert at club.worldonline.be> writes:
>>
>> There are probably others.  I haven't really looked at any of them.  I'd
> probably prefer the one from the python standard library because that's the
> one most likely to be maintained in the future.  TO avoid requiring python
> 2.3 we could probably ship a copy with Thuban.
>
> I agree with you that cvs.py looks like the best solution. However, this would
> probably mean writing most of the extension from scratch and not taking much
> of Ole's code, or ?

I've looked at csv.py in more detail and I like it a lot, especially because
of the apprarently very flexible automatic file format recognition which
should allow reading most csv formats.

I could imagine a first step of just parsing a csv file and writing a new
MemoryShape. This should be quite easy with an existing MemoryShapeStore and
csv.py.

Then in a second step we could write an import wizard for fine-tuning the
import if necessary.

Moritz




More information about the Thuban-devel mailing list

This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)