1

I want to send a csv with a polygon or line to show it in cartoDB map but when I try to send data to the server I don´t know the exact way to send the info. for polygon some think like this. id,name,description,polygon 1,thename,a description, ((x,y),(x1,y1),(x2,y2))

2
  • I'm facing the same problem, do you have a solution for this issue?
    – 0xFFFF
    Commented Jul 27, 2015 at 9:38
  • Welcome to gis.stackexchange! Please note that a good question on this site is expected to show some degree of research on your part, i.e. what you have tried and - if applicable - code so far. For more info, you can check our faq
    – underdark
    Commented Mar 8, 2016 at 19:29

2 Answers 2

1

You can put your polygons or lines in a geojson column. If necessary, you can transform that column in geometries using the st_geomfromgeojson function.

update yourcsv
set the_geom = st_geomfromgeojson(polygon1)

The question is more or less related: https://stackoverflow.com/questions/18265412/cartodb-cannot-import-csv-with-geojson-column-working-with-cartodb

I don't know the format of your GPS data. Probably it is not difficult to convert it to GeoJSON.

I hope it helps.

1
  • The thin I want to do is import data into a new poligon table in cartodb server from my local database using a csv file but I don´t know the format to tell cartodb that the geo file is poligon and the current format to create the "csv" file. Commented Nov 24, 2014 at 8:39
1

CartoDB will understand polygons like:

POLYGON((10 10, 20 10, 20 20, 10 20, 10 10), (13 13, 17 13, 17 17, 13 17, 13 13))

So you just need to add the "polygon" word before your coordinates for each one, and then, you'll be able to apply this:

update table set the_geom = st_setsrid(st_geomfromtext('POLYGON((10 10, 20 10, 20 20, 10 20, 10 10), (13 13, 17 13, 17 17, 13 17, 13 13))'),4326)

If you have already an uploaded table whose column 'ColumnA' is the polygon text, you can just embed it in the SQL instead of using the text directly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.