Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for point fields / multiple csv columns to one field #26

Open
ndanielsen opened this issue Jul 25, 2016 · 3 comments
Open

Support for point fields / multiple csv columns to one field #26

ndanielsen opened this issue Jul 25, 2016 · 3 comments

Comments

@ndanielsen
Copy link

Great project! I love it! Wondering if i can import a csv that contains geographical data.

For example, something like this

c = CopyMapping(
MyModel,
"./data.csv",
dict(point=['x', 'y'], number='NUMBER')
)
c.save()

Here's a row from the dataset for example:
['-77.0297110577', '38.9291522717', '11802074', '8330232', 'False', 'P173', 'NO PARKING STREET CLEANING', '3200 BLOCK 13TH ST NW EAST SIDE', 'DC', '4D', '806540', '5618.0', '397424', '140141', 'Parking_Violations_in_April_2010.csv', '2010-04-06T09:39:00.000Z']

@palewire
Copy link
Owner

Hmm. I never thought to try this. What happens if you preformat the points as WKT format or something that PostGIS expects?

@jsfenfen
Copy link

+1
It looks like this, or something pretty close to it, would work--see this SO answer. A few years ago I was doing something comparable by using django.contrib.gis.geos.GEOSGeometry -- for a geosgeometry g, g.hex work(ed), though I can't remember why I went that route.

@palewire
Copy link
Owner

I'm all for trying it, I just want the API syntax we select to be as clear as possible. Generally this library is modeled on the layout of Django's LayerMapping tool for loading shapefiles. You see anything there we could crib from?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants