Advertisement
Guest User

Untitled

a guest
Nov 24th, 2014
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.41 KB | None | 0 0
  1. {
  2. "messages": [
  3.  
  4. ],
  5. "routes": {
  6. "fieldAliases": {
  7. "ObjectID": "ObjectID",
  8. "Name": "Name",
  9. "FirstStopID": "FirstStopID",
  10. "LastStopID": "LastStopID",
  11. "StopCount": "StopCount",
  12. "Total_Meters": "Total_Meters",
  13. "Shape_Length": "Shape_Length"
  14. },
  15. "geometryType": "esriGeometryPolyline",
  16. "spatialReference": {
  17. "wkid": 3414,
  18. "latestWkid": 3414
  19. },
  20. "features": [
  21. {
  22. "attributes": {
  23. "ObjectID": 1,
  24. "Name": "18304.68,36152.73 - 21591.48,33095.24",
  25. "FirstStopID": 1,
  26. "LastStopID": 2,
  27. "StopCount": 2,
  28. "Total_Meters": 6757.9427813693819,
  29. "Shape_Length": 6757.9404808662866
  30. },
  31. "geometry": {
  32. "paths": [
  33. [
  34. [
  35. 18301.44000000041,
  36. 36146.919999999925
  37. ],
  38. [
  39. 21206.919999999925,
  40. 33505.550000000745
  41. ],
  42. [
  43. 21341.230000000447,
  44. 33566.929999999702
  45. ],
  46.  
  47. public void getDirection(Event eventModel){
  48. String eventX = eventModel.getEventX();
  49. Log.i("X", eventX);
  50.  
  51. String eventY = eventModel.getEventY();
  52. Log.i("Y", eventY);
  53.  
  54. SimpleLineSymbol lineSymbol = new SimpleLineSymbol(
  55. Color.GREEN, 3, SimpleLineSymbol.STYLE.DASH);
  56. List pointArr = null;
  57. String page;
  58. JSONArray jsonArray;
  59.  
  60. try {
  61. HttpClient client = new DefaultHttpClient();
  62. HttpGet request = new HttpGet("http://www.onemap.sg/API/services.svc/route/solve?token=qo/s2TnSUmfLz+32CvLC4RMVkzEFYjxqyti1KhByvEacEdMWBpCuSSQ+IFRT84QjGPBCuz/cBom8PfSm3GjEsGc8PkdEEOEr&routeStops=18304.68,36152.73;" + eventX + "," + eventY + "&routemode=DRIVE&avoidERP=0&routeOption=shortes");
  63. HttpResponse response = client.execute(request);
  64. HttpEntity entity = response.getEntity();
  65. String responseString = EntityUtils.toString(entity, "UTF-8");
  66. page = "{'EventDirection':" + responseString + "}";
  67. try {
  68. JSONObject jsonObject = new JSONObject(page);
  69. jsonArray = jsonObject.getJSONArray("EventDirection");
  70. int length = jsonArray.length();
  71. for (int i = 0; i < length; i++) {
  72. JSONObject attribute = jsonArray.getJSONObject(i);
  73. if(attribute.equals("features")){
  74. if(attribute.equals("geometry")){
  75. String path = attribute.getString("paths");
  76. pointArr.add(path);
  77. /*path = path.replace("[["", "");
  78. path = path.replace(""]]", "");
  79. String[] arr = path.split(";");
  80. for (int j = 0; j < arr.length; j++) {
  81. String[] point = arr[j].split(",");
  82. pointArr.add(point);
  83. }*/
  84. }}
  85. }
  86. Graphic lineGraphic = new Graphic((Geometry) pointArr, lineSymbol);
  87. ENeighbourhoodActivity.graphicsLayer.addGraphic(lineGraphic);
  88. } catch (JSONException e) {
  89. e.printStackTrace();
  90. }
  91. } catch (IOException e) {
  92. e.printStackTrace();
  93. }
  94. }
  95.  
  96. 11-24 20:32:19.425: D/dalvikvm(16607): GC_CONCURRENT freed 719K, 13% free 12030K/13703K, paused 7ms+13ms
  97. 11-24 20:32:19.628: W/System.err(16607): org.json.JSONException: Value {"directions":[{"features":[{"compressedGeometry":"+1+hrt+139j+0+0","attributes":{"length":0,"text":"Start at 18304.68,36152.73","time":0,"maneuverType":"esriDMTDepart","ETA":-2209161600000}},{"compressedGeometry":"+1+hrt+139j+172-lr+40-1i+1l-e+23-3+d+4+1d+r","attributes":{"length":1.7571306436022183,"text":"Go southeast on PAN ISLAND EXPRESSWAY","time":1.8785585885556129,"maneuverType":"esriDMTStraight","ETA":-2209161600000}},{"compressedGeometry":"+1+jch+12ik+i+1o+d+1v","attributes":{"length":0.12315161844398603,"text":"Bear left on TOH TUCK AVENUE","time":0.18480000000000038,"maneuverType":"esriDMTBearLeft","ETA":-2209161600000}},{"compressedGeometry":"+1+jdg+12mb+14-1+42+1b+p+m+11+2a+c+e+l+e+r+9+1q+2+o+5+1m+e+1v+o+3u+c+1u+0+1q-6+3a-i+11+2+1e+k+1k+12+1o+o+p+a+1p+a+m+8+m+b+2d+s+1g+t","attributes":{"length":1.3971933538812136,"text":"Turn right on TOH TUCK ROAD","time":2.7943955099999993,"maneuverType":"esriDMTTurnRight","ETA":-2209161600000}},{"compressedGeometry":"+1+kl9+132b+1l-1i+19-o+g-3+2e-8+3h-5+44-2+1i+4+1r+u+v+11+2v+43","attributes":{"length":0.78371010402386,"text":"Turn right on JALAN JURONG KECHIL","time":1.175752590000001,"maneuverType":"esriDMTTurnRight","ETA":-2209161600000}},{"compressedGeometry":"+1+la5+135l+1g-23+29-2o+1f-2d+d-1b+0-23-b-17-k-1n+0-h+8-l+o-r","attributes":{"length":0.5739351553531507,"text":"Turn right on JALAN ANAK BUKIT","time":0.9289808300000004,"maneuverType":"esriDMTTurnRight","ETA":-2209161600000}},{"compressedGeometry":"+1+lfr+12m0+dd-4m+qr-94+19n-ej+1j-n+82-56+gl-b4+5l-1a+3n-b+q-5+i-4+2k-13+4t-l+9p-14+co-3a+1r-j+1k-4+5o-1t+u-3+c+6+i+f+d+h","attributes":{"length":5.512234370362195,"text":"Bear left on DUNEARN ROAD","time":8.347599999999996,"maneuverType":"esriDMTBearLeft","ETA":-2209161600000}},{"compressedGeometry":"+1+qge+10ut+10+30+2p+5h","attributes":{"length":0.2995301962581563,"text":"Bear left on WHITLEY ROAD","time":0.4492,"maneuverType":"esriDMTBearLeft","ETA":-2209161600000}},{"compressedGeometry":"+1+qk7+117e+h-4+1p-1a+29-2o+j-b+q-2+b+4+h+c+c+h+10+2a+b+d+e+8+3n+3","attributes":{"length":0.5376352927205378,"text":"Turn right on MALCOLM ROAD","time":1.2903999999999978,"maneuverType":"esriDMTTurnRight","ETA":-2209161600000}},{"compressedGeometry":"+1+r0v+116u+f-k+l-a+t-1+s+7+1i+j+u+h+m+g+o+p+11+1f+11+u","attributes":{"length":0.35816860827144775,"text":"Turn right at UNNAMED ROAD to stay on MALCOLM ROAD","time":0.8596014644118043,"maneuverType":"esriDMTTurnRight","ETA":-2209161600000}},{"compressedGeometry":"+1+r9s+11b0+0+0","attributes":{"length":0,"text":"Finish at 27985.4,34115, on the right","time":0,"maneuverType":"esriDMTStop","ETA":-2209161600000}}],"summary":{"totalDriveTime":17.909288982967414,"totalTime":17.909288986120373,"envelope":{"ymin":33719.41002910024,"ymax":36152.73002910059,"xmin":18301.436076220416,"spatialReference":{"latestWkid":3414,"wkid":3414},"xmax":27985.400018159162},"totalLength":11.342689342916765},"routeName":"18304.68,36152.73 - 27985.4,34115","routeId":1}],"routes":{"features":[{"geometry":{"paths":[[[18301.44000000041,36146.919999999925],[18885.830000000075,35820.75999999978],[19550.639999999665,35448.38000000082],[19679.16000000015,35397.5700000003],[19731.700000000186,35383.86999999918],[19799.240000000224,35381.169999999925],[19812.37999999989,35385.49000000022],[19828.570000000298,35394.31000000052],[19856.860000000335,35412.300000000745],[19875.230000000447,35468.13000000082],[19885.419999999925,35519.13000000082],[19887.83999999985,35531.25999999978],[19924.03000000026,35530.199999999255],[20053.900000000373,35572.88000000082],[20071.599999999627,35586.460000000894],[20078.78000000026,35595.31000000052],[20088.94000000041,35614.65000000037],[20111.830000000075,35668.51999999955],[20124.389999999665,35682.72000000067],[20145.12999999989,35697.40000000037],[20171.889999999665,35706.49000000022],[20229.700000000186,35708.38000000082],[20254.44000000041,35712.52999999933],[20308.200000000186,35726.9299999997],[20361.94000000041,35748.6799999997],[20371.480000000447,35751.439
  98. 11-24 20:32:19.651: W/System.err(16607): at org.json.JSON.typeMismatch(JSON.java:100)
  99. 11-24 20:32:19.651: W/System.err(16607): at org.json.JSONObject.getJSONArray(JSONObject.java:548)
  100. 11-24 20:32:19.651: W/System.err(16607): at Controller.EventController.getDirection(EventController.java:222)
  101. 11-24 20:32:19.651: W/System.err(16607): at AsyncTask.GetEventDirectionAsyncTask.doInBackground(GetEventDirectionAsyncTask.java:21)
  102. 11-24 20:32:19.651: W/System.err(16607): at AsyncTask.GetEventDirectionAsyncTask.doInBackground(GetEventDirectionAsyncTask.java:1)
  103. 11-24 20:32:19.651: W/System.err(16607): at android.os.AsyncTask$2.call(AsyncTask.java:264)
  104. 11-24 20:32:19.651: W/System.err(16607): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
  105. 11-24 20:32:19.651: W/System.err(16607): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
  106. 11-24 20:32:19.651: W/System.err(16607): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:208)
  107. 11-24 20:32:19.651: W/System.err(16607): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
  108. 11-24 20:32:19.651: W/System.err(16607): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
  109. 11-24 20:32:19.651: W/System.err(16607): at java.lang.Thread.run(Thread.java:856)
  110. 11-24 20:32:40.862: W/SurfaceView(16607): CHECK surface infomation creating=false formatChanged=false sizeChanged=false visible=false visibleChanged=true surfaceChanged=true realSizeChanged=false redrawNeeded=false left=false top=false
  111.  
  112. {
  113. "directions" : [{
  114. "features" : [{
  115. "compressedGeometry" : "+1+hrt+139j+0+0",
  116. "attributes" : {
  117. "length" : 0,
  118. "text" : "Start at 18304.68,36152.73",
  119. "time" : 0,
  120. "maneuverType" : "esriDMTDepart",
  121. "ETA" : -2209161600000
  122. }
  123. }, {
  124. "compressedGeometry" : "+1+hrt+139j+172-lr+40-1i+1l-e+23-3+d+4+1d+r",
  125. "attributes" : {
  126. "length" : 1.7571306436022183,
  127. "text" : "Go southeast on PAN ISLAND EXPRESSWAY",
  128. "time" : 1.8785585885556129,
  129. "maneuverType" : "esriDMTStraight",
  130. "ETA" : -2209161600000
  131. }
  132. }, {
  133. "compressedGeometry" : "+1+jch+12ik+i+1o+d+1v",
  134. "attributes" : {
  135. "length" : 0.12315161844398603,
  136. "text" : "Bear left on TOH TUCK AVENUE",
  137. "time" : 0.18480000000000038,
  138. "maneuverType" : "esriDMTBearLeft",
  139. "ETA" : -2209161600000
  140. }
  141. }, {
  142. "compressedGeometry" : "+1+jdg+12mb+14-1+42+1b+p+m+11+2a+c+e+l+e+r+9+1q+2+o+5+1m+e+1v+o+3u+c+1u+0+1q-6+3a-i+11+2+1e+k+1k+12+1o+o+p+a+1p+a+m+8+m+b+2d+s+1g+t",
  143. "attributes" : {
  144. "length" : 1.3971933538812136,
  145. "text" : "Turn right on TOH TUCK ROAD",
  146. "time" : 2.7943955099999993,
  147. "maneuverType" : "esriDMTTurnRight",
  148. "ETA" : -2209161600000
  149. }
  150. }, {
  151. "compressedGeometry" : "+1+kl9+132b+1l-1i+19-o+g-3+2e-8+3h-5+44-2+1i+4+1r+u+v+11+2v+43",
  152. "attributes" : {
  153. "length" : 0.78371010402386,
  154. "text" : "Turn right on JALAN JURONG KECHIL",
  155. "time" : 1.175752590000001,
  156. "maneuverType" : "esriDMTTurnRight",
  157. "ETA" : -2209161600000
  158. }
  159. }, {
  160. "compressedGeometry" : "+1+la5+135l+1g-23+29-2o+1f-2d+d-1b+0-23-b-17-k-1n+0-h+8-l+o-r",
  161. "attributes" : {
  162. "length" : 0.5739351553531507,
  163. "text" : "Turn right on JALAN ANAK BUKIT",
  164. "time" : 0.9289808300000004,
  165. "maneuverType" : "esriDMTTurnRight",
  166. "ETA" : -2209161600000
  167. }
  168. }, {
  169. "compressedGeometry" : "+1+lfr+12m0+dd-4m+qr-94+19n-ej+1j-n+82-56+gl-b4+5l-1a+3n-b+q-5+i-4+2k-13+4t-l+9p-14+co-3a+1r-j+1k-4+5o-1t+u-3+c+6+i+f+d+h",
  170. "attributes" : {
  171. "length" : 5.512234370362195,
  172. "text" : "Bear left on DUNEARN ROAD",
  173. "time" : 8.347599999999996,
  174. "maneuverType" : "esriDMTBearLeft",
  175. "ETA" : -2209161600000
  176. }
  177. }, {
  178. "compressedGeometry" : "+1+qge+10ut+10+30+2p+5h",
  179. "attributes" : {
  180. "length" : 0.2995301962581563,
  181. "text" : "Bear left on WHITLEY ROAD",
  182. "time" : 0.4492,
  183. "maneuverType" : "esriDMTBearLeft",
  184. "ETA" : -2209161600000
  185. }
  186. }, {
  187. "compressedGeometry" : "+1+qk7+117e+h-4+1p-1a+29-2o+j-b+q-2+b+4+h+c+c+h+10+2a+b+d+e+8+3n+3",
  188. "attributes" : {
  189. "length" : 0.5376352927205378,
  190. "text" : "Turn right on MALCOLM ROAD",
  191. "time" : 1.2903999999999978,
  192. "maneuverType" : "esriDMTTurnRight",
  193. "ETA" : -2209161600000
  194. }
  195. }, {
  196. "compressedGeometry" : "+1+r0v+116u+f-k+l-a+t-1+s+7+1i+j+u+h+m+g+o+p+11+1f+11+u",
  197. "attributes" : {
  198. "length" : 0.35816860827144775,
  199. "text" : "Turn right at UNNAMED ROAD to stay on MALCOLM ROAD",
  200. "time" : 0.8596014644118043,
  201. "maneuverType" : "esriDMTTurnRight",
  202. "ETA" : -2209161600000
  203. }
  204. }, {
  205. "compressedGeometry" : "+1+r9s+11b0+0+0",
  206. "attributes" : {
  207. "length" : 0,
  208. "text" : "Finish at 27985.4,34115, on the right",
  209. "time" : 0,
  210. "maneuverType" : "esriDMTStop",
  211. "ETA" : -2209161600000
  212. }
  213. }
  214. ],
  215. "summary" : {
  216. "totalDriveTime" : 17.909288982967414,
  217. "totalTime" : 17.909288986120373,
  218. "envelope" : {
  219. "ymin" : 33719.41002910024,
  220. "ymax" : 36152.73002910059,
  221. "xmin" : 18301.436076220416,
  222. "spatialReference" : {
  223. "latestWkid" : 3414,
  224. "wkid" : 3414
  225. },
  226. "xmax" : 27985.400018159162
  227. },
  228. "totalLength" : 11.342689342916765
  229. },
  230. "routeName" : "18304.68,36152.73 - 27985.4,34115",
  231. "routeId" : 1
  232. }
  233. ],
  234. "routes" : {
  235. "features" : [{
  236. "geometry" : {
  237. "paths" : [[[18301.44000000041, 36146.919999999925], [18885.830000000075, 35820.75999999978], [19550.639999999665, 35448.38000000082], [19679.16000000015, 35397.5700000003], [19731.700000000186, 35383.86999999918], [19799.240000000224, 35381.169999999925], [19812.37999999989, 35385.49000000022], [19828.570000000298, 35394.31000000052], [19856.860000000335, 35412.300000000745], [19875.230000000447, 35468.13000000082], [19885.419999999925, 35519.13000000082], [19887.83999999985, 35531.25999999978], [19924.03000000026, 35530.199999999255], [20053.900000000373, 35572.88000000082], [20071.599999999627, 35586.460000000894], [20078.78000000026, 35595.31000000052], [20088.94000000041, 35614.65000000037], [20111.830000000075, 35668.51999999955], [20124.389999999665, 35682.72000000067], [20145.12999999989, 35697.40000000037], [20171.889999999665, 35706.49000000022], [20229.700000000186, 35708.38000000082], [20254.44000000041, 35712.52999999933], [20308.200000000186, 35726.9299999997], [20361.94000000041, 35748.6799999997], [20371.480000000447, 35751.439
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement