diff --git a/examples/GAMA/cityIO_Gama/.project b/examples/GAMA/cityIO_Gama/.project
index 6db98ab..2fe4b90 100644
--- a/examples/GAMA/cityIO_Gama/.project
+++ b/examples/GAMA/cityIO_Gama/.project
@@ -15,4 +15,11 @@
org.eclipse.xtext.ui.shared.xtextNature
msi.gama.application.gamaNature
+
+
+ external/grasbrook
+ 1
+ CACHE_LOC/cityio.media.mit.edu+_++_+api+_+table+_+grasbrook
+
+
diff --git a/examples/GAMA/cityIO_Gama/headless/cityIO_Gama.xml b/examples/GAMA/cityIO_Gama/headless/cityIO_Gama.xml
index 36ac158..eaf923e 100644
--- a/examples/GAMA/cityIO_Gama/headless/cityIO_Gama.xml
+++ b/examples/GAMA/cityIO_Gama/headless/cityIO_Gama.xml
@@ -1,6 +1,6 @@
-
+
diff --git a/examples/GAMA/cityIO_Gama/includes/cityIO_Gama_Agent.json b/examples/GAMA/cityIO_Gama/includes/cityIO_Gama_Agent.json
new file mode 100644
index 0000000..762b402
--- /dev/null
+++ b/examples/GAMA/cityIO_Gama/includes/cityIO_Gama_Agent.json
@@ -0,0 +1 @@
+{"grid":[[1,0,270],[0,7,270],[0,8,90],[4,7,0],[2,6,270],[1,2,0],[4,4,180],[6,3,270],[6,2,90],[0,2,90],[3,5,180],[6,4,90],[1,7,90],[5,7,0],[3,5,0],[5,6,180],[1,7,0],[5,0,180],[6,2,270],[1,7,90],[4,5,180],[2,8,90],[3,6,90],[5,7,180],[1,4,180],[1,3,0],[5,9,0],[5,7,180],[4,0,180],[0,5,90],[0,8,180],[2,9,180],[1,7,90],[3,4,270],[4,0,90],[1,5,0],[0,1,270],[4,6,0],[3,3,90],[2,1,270],[0,6,180],[0,2,90],[4,3,270],[6,4,180],[0,7,270],[2,2,0],[6,1,0],[6,0,270],[1,1,180],[4,6,270],[2,4,90],[1,1,0],[6,9,270],[4,9,90],[4,5,180],[6,0,270],[4,6,270],[1,2,270],[0,7,270],[3,4,180],[6,3,0],[1,3,180],[2,5,180],[0,6,270],[3,9,180],[0,3,90],[5,5,0],[3,9,0],[1,8,90],[6,6,90],[6,6,270],[5,3,90],[5,9,270],[6,5,270],[1,3,90],[4,2,270],[6,2,0],[6,1,180],[5,4,90],[5,9,180],[1,1,270],[4,9,90],[0,0,270],[4,9,90],[1,5,270],[1,0,0],[4,7,0],[4,2,0],[2,0,90],[3,2,270],[1,0,270],[4,4,270],[5,1,180],[0,3,180],[4,2,270],[5,3,270],[4,1,180],[2,9,180],[1,4,90],[1,3,0],[1,3,90],[6,4,270],[3,4,0],[4,1,0],[6,4,270],[0,2,0],[4,7,90],[3,4,0],[1,0,180],[4,3,270],[2,5,180],[6,5,0],[6,0,90],[3,5,90],[5,7,0],[4,3,90],[0,2,180],[2,2,180],[3,2,90],[0,9,180],[4,8,270],[1,4,90],[5,2,0],[5,9,90],[4,6,270],[5,5,90],[2,5,90],[3,0,270],[2,7,0],[3,6,180],[5,0,180],[1,5,0],[5,1,180],[6,5,0],[4,0,270],[6,4,270],[6,6,270],[5,7,90],[4,0,0],[3,9,270],[2,0,0],[1,8,90],[4,0,180],[3,1,90],[6,6,90],[6,2,90],[0,1,270],[2,5,270],[2,3,90],[2,7,0],[3,9,270],[4,3,180],[1,0,180],[3,9,0],[0,2,270],[4,9,90],[0,4,90],[2,1,270],[3,0,0],[3,1,180],[2,8,90],[2,1,180],[3,5,0],[4,4,0],[4,2,0],[5,7,0],[6,3,90],[1,9,0],[2,4,90],[6,8,90],[1,8,90],[5,5,90],[6,3,180],[5,3,270],[4,9,180],[1,1,0],[3,6,90],[1,8,270],[4,2,270],[4,2,180],[0,7,180],[0,8,0],[0,5,270],[1,9,270],[4,8,180],[5,8,90],[2,3,90],[3,4,270],[1,6,0],[3,2,90],[3,5,90],[2,4,0],[5,2,90],[1,6,0],[1,2,270],[6,7,90],[5,6,270],[3,7,270],[2,3,0],[4,1,0],[6,7,180],[6,5,0],[5,6,270],[2,7,0],[1,4,90],[3,5,90],[3,4,270],[2,0,180],[5,4,180],[3,5,0],[3,1,270],[6,3,270],[5,1,90],[2,5,0],[6,8,90],[1,0,90],[6,5,270],[2,8,180],[4,8,90],[3,7,270],[4,2,0],[5,8,270],[2,0,180],[2,5,270],[6,6,0],[1,6,270],[4,6,270],[3,9,270],[6,0,270],[4,9,90],[0,2,90],[4,5,0],[4,6,270],[6,9,270],[4,6,270],[5,6,180],[6,0,90],[4,2,0],[1,9,90],[1,2,0],[3,3,270],[3,6,0],[6,5,270],[5,2,90],[5,2,180],[3,2,180],[1,8,180],[3,3,0],[4,1,180],[2,0,180],[4,9,270],[2,2,180],[5,3,270],[4,5,270],[1,9,270],[3,3,90],[5,0,270],[3,7,180],[5,3,180],[5,9,90],[6,6,0],[4,0,0],[0,7,90],[3,5,180],[1,1,90],[5,5,0],[2,1,90],[2,0,180],[2,1,180],[0,9,90],[2,1,90],[5,4,0],[2,1,90],[6,5,270],[1,4,180],[5,2,0],[3,4,90],[4,6,90],[3,7,180],[4,7,270],[5,7,0],[0,8,90],[4,6,270],[1,4,180],[4,8,180],[3,5,90],[5,8,180],[0,2,180],[3,3,180],[2,4,270],[4,8,270],[1,3,90],[3,3,270],[3,8,270],[6,0,90],[2,4,270],[4,3,0],[3,2,90],[1,9,90],[1,1,0],[4,1,0],[3,4,180],[1,0,0],[4,1,180],[2,3,0],[0,2,270],[4,2,180],[0,2,180],[6,6,90],[4,8,270],[6,0,180],[6,0,180],[3,2,270],[4,7,0],[4,6,90],[3,5,90],[5,6,180],[3,0,90],[2,5,90],[5,0,270],[4,8,90],[3,2,270],[0,0,0],[2,6,180],[1,3,0],[0,0,0],[3,2,90],[6,7,90],[0,7,180],[0,1,180],[5,7,0],[0,2,0],[1,3,0],[0,7,0],[0,5,180],[3,1,270],[6,9,0],[4,2,0],[3,8,180],[0,7,180],[3,3,270],[5,7,180],[0,5,270],[6,4,180],[4,1,180],[5,8,90],[2,3,270],[4,0,270],[0,8,270],[5,4,90],[0,1,90],[6,4,90],[3,5,0],[2,4,0],[5,1,180],[4,8,180],[4,3,90],[4,5,0],[5,6,0],[1,7,270],[4,5,180],[1,7,270],[0,4,0],[0,4,270],[3,3,270],[1,9,90],[4,8,180],[3,4,90],[4,6,180],[4,9,0],[1,9,0],[4,4,180],[1,0,180],[6,7,90],[4,6,0],[2,2,0],[5,6,270],[4,4,180],[4,8,90],[6,1,0],[5,8,180],[4,2,270],[0,1,270],[0,4,0],[6,3,0],[4,2,270],[2,1,90],[5,8,0],[0,9,0],[4,6,270],[4,8,270],[6,9,180],[1,8,180],[4,7,0],[0,3,270],[3,3,0],[0,6,180],[6,3,90],[3,2,0],[4,5,90]],"meta":{"apiv":2,"id":"hnkyCam","timestamp":-290419029},"objects":{"points":{"type":"FeatureCollection","features":[{"type":"Feature","geometry":{"coordinates":[100.51134639265322,2.7791355017715657E-4,0.0],"type":"Point"},"properties":{"property_1":2},"id":0},{"type":"Feature","geometry":{"coordinates":[100.51157514652954,4.8014752316950977E-4,0.0],"type":"Point"},"properties":{"property_1":2},"id":1},{"type":"Feature","geometry":{"coordinates":[100.5113887559565,9.688871223804664E-5,0.0],"type":"Point"},"properties":{"property_1":2},"id":2},{"type":"Feature","geometry":{"coordinates":[100.5115218987927,6.001914043000524E-4,0.0],"type":"Point"},"properties":{"property_1":2},"id":3},{"type":"Feature","geometry":{"coordinates":[100.51173674255995,8.033106972697403E-4,0.0],"type":"Point"},"properties":{"property_1":2},"id":4},{"type":"Feature","geometry":{"coordinates":[100.51187282369874,3.518491001998085E-4,0.0],"type":"Point"},"properties":{"property_1":2},"id":5},{"type":"Feature","geometry":{"coordinates":[100.5119730780425,1.891047244458317E-4,0.0],"type":"Point"},"properties":{"property_1":2},"id":6},{"type":"Feature","geometry":{"coordinates":[100.51141292318675,8.794659746523952E-4,0.0],"type":"Point"},"properties":{"property_1":2},"id":7},{"type":"Feature","geometry":{"coordinates":[100.51162315143507,4.7290712707538483E-4,0.0],"type":"Point"},"properties":{"property_1":2},"id":8},{"type":"Feature","geometry":{"coordinates":[100.51186226058564,6.902409733729597E-4,0.0],"type":"Point"},"properties":{"property_1":2},"id":9}]}},"header":{"owner":{"name":"Arnaud Grignard","institute":"Gama Platform","title":"Research Assistant"},"mapping":{"type":{"0":"RL","1":"RM","2":"RS","3":"OL","4":"OM","5":"OS","6":"ROAD"}},"name":"virtual_table","block":["type","height","rotation"],"spatial":{"physical_longitude":105.84,"nrows":20,"rotation":0,"latitude":21.02,"physical_latitude":21.02,"ncols":20,"cellsize":10,"longitude":105.84}},"id":"","error":"","timestamp":-290419008}
\ No newline at end of file
diff --git a/examples/GAMA/cityIO_Gama/models/cityIO.gaml b/examples/GAMA/cityIO_Gama/models/cityIO.gaml
index 8790913..8a60e70 100644
--- a/examples/GAMA/cityIO_Gama/models/cityIO.gaml
+++ b/examples/GAMA/cityIO_Gama/models/cityIO.gaml
@@ -1,4 +1,4 @@
-/**
+ /**
* Name: cityIO API for GAMA
* Author: Arnaud Grignard
* Description: Gives the basic read and write feature for cityIO
@@ -19,9 +19,15 @@ global {
map buildingColors <-[-2::#red, -1::#orange,0::rgb(189,183,107), 1::rgb(189,183,107), 2::rgb(189,183,107),3::rgb(230,230,230), 4::rgb(230,230,230), 5::rgb(230,230,230),6::rgb(40,40,40),7::#cyan,8::#green,9::#gray];
map header;
map spatial;
- int refresh <- 100 min: 1 max:1000 parameter: "Refresh Grid rate (cycle):" category: "Grid";
- bool pushToCityIO <- false parameter: "Push to cityIO every refresh cycles" category: "Grid";
- bool pushToLocalFile <- false parameter: "Push to a local every refresh cycles" category: "Grid";
+ bool updateGrid <- false parameter: "Update Grid:" category: "Grid";
+ int gridRrefresh <- 100 min: 1 max:1000 parameter: "Refresh Grid rate (cycle):" category: "Grid";
+ bool pushGridToCityIO <- false parameter: "Push Grid to cityIO every refresh cycles" category: "Grid";
+ bool pushGridToLocalFile <- false parameter: "Push Grid to a local every refresh cycles" category: "Grid";
+
+ int agentRrefresh <- 100 min: 1 max:1000 parameter: "Refresh Agent rate (cycle):" category: "Agent";
+ bool pushAgentToCityIO <- false parameter: "Push Agent to cityIO every refresh cycles" category: "Agent";
+ bool pushAgentToLocalFile <- false parameter: "Push Agent to a local every refresh cycles" category: "Agent";
+
int nbCols;
int nbRows;
int cellSize;
@@ -64,30 +70,59 @@ global {
map(outputMatrixData["header"]["spatial"])["physical_longitude"]<-105.84;
map(outputMatrixData["header"]["spatial"])["physical_latitude"]<-21.02;
- if(pushToCityIO){
+ if(pushGridToCityIO){
try{
save(json_file("https://cityio.media.mit.edu/api/table/update/cityIO_Gama", outputMatrixData));
}catch{
write #current_error + " Impossible to write to cityIO - Connection to Internet lost or cityIO is offline";
}
}
- if(pushToLocalFile){
+ if(pushGridToLocalFile){
save(json_file("./../includes/cityIO_Gama.json", outputMatrixData));
}
-
+ }
+
+ action pushAgent(map _matrixData){
+ outputMatrixData <- _matrixData;
+ map(outputMatrixData["header"]["owner"])["institute"]<-"Gama Platform";
+ map(outputMatrixData["header"]["owner"])["institute"]<-"Gama Platform";
+ map(outputMatrixData["header"]["owner"])["name"]<-"Arnaud Grignard";
+ map(outputMatrixData["header"]["spatial"])["longitude"]<-105.84;
+ map(outputMatrixData["header"]["spatial"])["latitude"]<-21.02;
+ map(outputMatrixData["header"]["spatial"])["physical_longitude"]<-105.84;
+ map(outputMatrixData["header"]["spatial"])["physical_latitude"]<-21.02;
+ list projected_points <- people collect ([each.location]);
+ list