Wiki source code of Cartography
Show last authors
1 | = Cartography = |
2 | |
3 | To add the cartography functionality, edit the file dysoweb.properties located in the folder tomcat/webapps/dysoweb/WEB-INF/classes: |
4 | |
5 | * add ",\" at the end of the last row. |
6 | * then add the row "com.almworks.sqlite4java" atthe end of the file. |
7 | |
8 | Edit the file requeadb.xml located in dysoweb.home/config by adding the row : |
9 | <DbSpatial>true</DbSpatial> |
10 | |
11 | Go to http://localhost:8080/dysoweb/dysoweb/panel/secure/shell.jsp and add the reference to the open street map bundle from dynapage by executing |
12 | |
13 | {{/code}} |
14 | |
15 | start reference:file:/../dynapage/ext/com.requea.dynapage.ext.geospatial.openstreetmap/src/main/ |
16 | |
17 | {{/code}} |
18 | |
19 | |
20 | In the Requea interface, go to the menu System Parameters in the item l’onglet Administrator and modify these two parameters: |
21 | |
22 | * com.requea.osm.tiles.path : inform the path to the .mbtiles file |
23 | * com.requea.dynapage.geospatial.geomap : put the value OSM |
24 | |
25 | = Use Cartography = |
26 | |
27 | To display items on the map, you have to create an entity with a property type //spacial Geometry// and the format //2D Geodetic property// : |
28 | |
29 | [[image:Capturedecran2015-06-02a16.21.15.png]] |
30 | |
31 | |
32 | To view the map from the .mbtiles file, create an entity derived from GeoMapView: |
33 | |
34 | [[image:Capturedecran2015-07-10a16.18.34.png]] |
35 | |
36 | Modify the script of the field Display rules or behavior in the properties sysView and sysZoom so that it point to your preferred location: |
37 | |
38 | [[image:Capturedecran2015-06-01a17.55.14.png]] |
39 | |
40 | [[image:Capturedecran2015-06-01a17.55.38.png]] |
41 | |
42 | To display items on that map, edit the operation BuildMap with a script. |
43 | |
44 | For example: |
45 | |
46 | {{code language="javascript"}} |
47 | var map = {}; |
48 | map.layers = []; |
49 | var layer; |
50 | |
51 | layer = {}; |
52 | layer.title = "Items"; |
53 | layer.layers = []; |
54 | |
55 | var flt = new Filter("custItem"); |
56 | |
57 | var iter = flt.search(); |
58 | |
59 | while(iter.hasNext()) { |
60 | var item = iter.next(); |
61 | var pos = item.custGeoPosition; |
62 | |
63 | //add the item on the map, at the position specified |
64 | layer.points.push({id:station.sysId, pos:pos }); |
65 | } |
66 | map.layers.push(layer); |
67 | |
68 | data = new Json(map); |
69 | } |
70 | {{/code}} |
71 | |
72 | You can change the default icon of the item by adding a icon field in the JSON Object layer.points. |
73 | For example: |
74 | |
75 | {{code language="javascript"}} |
76 | |
77 | layer.points = []; |
78 | |
79 | layer.icons = [ { url:'/img/img0.png',x:-16,y:-16}, |
80 | { url:'img/img1.png',x:-16,y:-16}, |
81 | { url:'img/img2.png',x:-16,y:-16}, |
82 | { url:'/img/img3.png',x:-16,y:-16} |
83 | ]; |
84 | |
85 | icon = 2; |
86 | |
87 | layer.points.push({icon:icon, pos:pos,... }); |
88 | |
89 | {{/code}} |
90 | |
91 | The root of the URL specified is the folder webapps in dysoweb.home///bundleName///src |