rufuspollock-okfn / dataconverters

Python library and command line tool for converting data from one format to another
http://okfnlabs.org/dataconverters/
100 stars 33 forks source link

KML -> Records (GeoJSON) #5

Open rufuspollock opened 12 years ago

rufuspollock commented 12 years ago

Suggest we just have a kml_parse method that yields iterator over geojson style python dicts.

Implementation

Various options here.

Note this is not supported by Fiona bindings for gdal (atm)

Other libraries:

gka commented 12 years ago

QGIS can do that.

napo commented 12 years ago

QGIS uses GDAL/OGR for this reason is very easy use the python interfaces to OGR/GDAL This is the command line

ogr2ogr -f "GeoJSON" file.geojson file.kml
nigelbabu commented 11 years ago

I've written some code for the KML bits in a branch. Can someone give me a reality check on whether I'm headed in the right direction? I intend to add a Python Geo Interface if this is indeed the right direction.

rufuspollock commented 11 years ago

Not sure why you need the Python Geo Interface - could you not just return geojson style python record objects (doing the python geo interface will require you creating proper "Record" objects which then implement that interface).

Regarding the code, as I'm not a KML expert, it is hard to tell whether this is right - could you add an example test (even a failing one) - that would at least tell me which kml file to look at it and an idea of what you expect output to be.

nigelbabu commented 11 years ago

Implementing the Python Geo Interface has the advantage that if I do geojson.dumps(), it will convert the object to geojson.

Well, I think the problem is, I'm not sure what the output should be. I already do have a test with prints out the current output. You can see if you run nosetests -d

rufuspollock commented 11 years ago

@nigelbabu have you pushed all the code you have here or do you still have stuff on disk?

nigelbabu commented 11 years ago

@rgrp I have nothing on-disk. I'm hoping to talk to Adria and get some help to kick this code off my plate.