More

Send csv with polygon or line in gps data

Send csv with polygon or line in gps data


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))


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.


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

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.


Watch the video: ArcGIS: How to Automatically Convert CSV Files to Points, Lines, and Polygons