Skip to content

Commit 0251714

Browse files
author
Sandro Santilli
committed
Enhance format documentation
- Stub section for "arrayjson" (#96) - Add references to wikipedia articles for most formats - Document "shapefile" format - Add note about numerical rounding in JSON format (#113)
1 parent 77acd25 commit 0251714

File tree

1 file changed

+41
-2
lines changed

1 file changed

+41
-2
lines changed

doc/API.md

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Supported query string parameters:
1212

1313
'format': Specifies which format to use for the response.
1414
Supported formats: JSON (the default), GeoJSON,
15-
TopoJSON, CSV, SVG, SHP
15+
TopoJSON, CSV, SVG, SHP, arraybuffer
1616

1717
'filename': Sets the filename to use for the query result
1818
file attachment
@@ -37,6 +37,9 @@ Supported query string parameters:
3737
Response formats
3838
----------------
3939

40+
41+
### JSON
42+
4043
The standard response from the CartoDB SQL API is JSON. If you are
4144
building a web-application, the lightweight JSON format allows you to
4245
quickly integrate data from the SQL API.
@@ -69,6 +72,12 @@ The JSON response is as follows:
6972
}
7073
```
7174

75+
Note that values of numerical fields will be rounded to at most 16 significant
76+
digits due to a limit in the JSON format itself. If more precision is needed
77+
the caller can cast those fields to text using SQL constructs.
78+
79+
### GeoJSON
80+
7281
Alternatively, you can use the GeoJSON specification for returning data
7382
from the API. To do so, simply supply the format parameter as GeoJSON.
7483

@@ -99,7 +108,37 @@ The GeoJSON response is follows:
99108
}
100109
```
101110

102-
TODO: csv, kml, svg, topojson responses
111+
### CSV
112+
113+
CSV export format has field names in first line (header),
114+
uses CR/NL line endings and EWKT format for geometri fields.
115+
116+
See https://github.com/postgis/postgis/blob/svn-trunk/doc/ZMSgeoms.txt#L173
117+
118+
### KML
119+
120+
See http://en.wikipedia.org/wiki/KML
121+
122+
### SVG
123+
124+
See http://en.wikipedia.org/wiki/SVG
125+
126+
### TopoJSON
127+
128+
See http://en.wikipedia.org/wiki/Topojson
129+
130+
### SHP
131+
132+
Shapefile output composed by .shp, .shx, .dbf and .prj files
133+
compressed in a .zip.
134+
135+
See http://en.wikipedia.org/wiki/Shapefile
136+
137+
### Arraybuffer
138+
139+
An octet stream binary-encoding each field as a typed array of value.
140+
TODO: write more about this format
141+
See http://github.com/CartoDB/CartoDB-SQL-API/issues/96
103142

104143
Response errors
105144
---------------

0 commit comments

Comments
 (0)