cartodb: cannot import csv with geojson column working with cartodb

890 views Asked by At

I uploaded a shape file to cartodb

then I exported it as a csv

Now I want to load it from the csv file (I'm studying how to generate a csv like that from other sources)

I have a geojson strng column with all the info of the geometry (a polygon)

then I try to update the_geom with a query like this:

update paisprov2012 set
the_geom = st_setsrid(st_geomfromgeojson(geojson),4326)

And I get this error:

ERROR: Geometry type (MultiPolygon) does not match column type (Point)

SO I try with

ALTER TABLE paisprov2012 ALTER COLUMN the_geom TYPE Polygon using the_geom::Polygon

But I get a

ERROR: cannot cast type geometry to polygon

Any idea?

1

There are 1 answers

0
andrewxhill On BEST ANSWER

Changing of column types didn't work in the old versions of CartoDB (and default column type when all null was point). The first query should work fine now.

The second query will fail because polygon as you are trying to do it isn't a projected polygon.