diff --git a/src/components/BrowserCell/BrowserCell.react.js b/src/components/BrowserCell/BrowserCell.react.js
index 5fad9abbf1..fe6b81eb8c 100644
--- a/src/components/BrowserCell/BrowserCell.react.js
+++ b/src/components/BrowserCell/BrowserCell.react.js
@@ -75,6 +75,8 @@ let BrowserCell = ({ type, value, hidden, width, current, onSelect, onEditChange
content = pieces.join(', ');
} else if (type === 'GeoPoint') {
content = `(${value.latitude}, ${value.longitude})`;
+ } else if (type === 'Polygon') {
+ content = value.coordinates.map(coord => `(${coord})`)
} else if (type === 'Relation') {
content = (
diff --git a/src/dashboard/Data/Browser/Editor.react.js b/src/dashboard/Data/Browser/Editor.react.js
index 6f1876878e..3eb806402d 100644
--- a/src/dashboard/Data/Browser/Editor.react.js
+++ b/src/dashboard/Data/Browser/Editor.react.js
@@ -43,6 +43,40 @@ let Editor = ({ top, left, type, targetClass, value, readonly, width, onCommit }
width={width}
onCommit={encodeCommit} />
);
+ } else if (type === 'Polygon') {
+ let encodeCommit = (json) => {
+ try {
+ let coordinates = JSON.parse(json);
+ if (coordinates.length < 3) {
+ throw 'Polygon must have at least 3 coordinates';
+ }
+ if (value && value.coordinates && value.coordinates.length === coordinates.length) {
+ let dirty = coordinates.some((coord, index) => {
+ if (value.coordinates[index][0] !== coord[0] || value.coordinates[index][1] !== coord[1]) {
+ return true;
+ }
+ });
+ if (!dirty) {
+ throw 'No change in coordinates';
+ }
+ }
+ let obj = {
+ '__type': 'Polygon',
+ coordinates
+ }
+ onCommit(obj);
+ } catch (e) {
+ onCommit(value);
+ }
+ }
+ content = (
+
+ );
} else if (type === 'Date') {
if (readonly) {
content = (
diff --git a/src/lib/Constants.js b/src/lib/Constants.js
index 30969fec9a..3152450908 100644
--- a/src/lib/Constants.js
+++ b/src/lib/Constants.js
@@ -71,6 +71,7 @@ export const DataTypes = [
'Object',
'Array',
'GeoPoint',
+ 'Polygon',
'File',
'Pointer',
'Relation',