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 | In the Requea interface, go to the menu System Parameters in the item l’onglet Administrator and modify these two parameters: |
12 | |
13 | * com.requea.osm.tiles.path : inform the path to the .mbtiles file |
14 | * com.requea.dynapage.geospatial.geomap : put the value OSM |
15 | |
16 | = Use Cartography = |
17 | |
18 | To display items on the map, you have to create an entity with a property type //spacial Geometry// and the format //2D Geodetic property// : |
19 | |
20 | [[image:Capturedecran2015-06-02a16.21.15.png]] |
21 | |
22 | |
23 | To view the map from the .mbtiles file, create an entity derived from GeoMapView: |
24 | |
25 | [[image:Capturedecran2015-06-02a16.18.34.png]] |
26 | |
27 | Modify the script of the field Display rules or behavior in the properties sysView and sysZoom so that it point to your preferred location: |
28 | |
29 | [[image:Capturedecran2015-06-01a17.55.14.png]] |
30 | |
31 | [[image:Capturedecran2015-06-01a17.55.38.png]] |
32 | |
33 | To display items on that map, edit the operation BuildMap with a script. |
34 | |
35 | For example: |
36 | |
37 | {{code language="javascript"}} |
38 | var map = {}; |
39 | map.layers = []; |
40 | var layer; |
41 | |
42 | layer = {}; |
43 | layer.title = "Items"; |
44 | layer.layers = []; |
45 | |
46 | var flt = new Filter("custItem"); |
47 | |
48 | var iter = flt.search(); |
49 | |
50 | while(iter.hasNext()) { |
51 | var item = iter.next(); |
52 | var pos = item.custGeoPosition; |
53 | |
54 | //add the item on the map, at the position specified |
55 | layer.points.push({id:station.sysId, pos:pos }); |
56 | } |
57 | map.layers.push(layer); |
58 | |
59 | data = new Json(map); |
60 | } |
61 | {{/code}} |
62 | |
63 | You can change the default icon of the item by adding a icon field in the JSON Object layer.points. |
64 | For example: |
65 | |
66 | {{code language="javascript"}} |
67 | |
68 | layer.points = []; |
69 | |
70 | layer.icons = [ { url:'/img/img0.png',x:-16,y:-16}, |
71 | { url:'img/img1.png',x:-16,y:-16}, |
72 | { url:'img/img2.png',x:-16,y:-16}, |
73 | { url:'/img/img3.png',x:-16,y:-16} |
74 | ]; |
75 | |
76 | icon = 2; |
77 | |
78 | layer.points.push({icon:icon, pos:pos,... }); |
79 | |
80 | {{/code}} |
81 | |
82 | The root of the URL specified is the folder webapps in dysoweb.home///bundleName///src |