Wiki source code of Cartography
Hide last authors
8.1 | 1 | = Cartography = | |
2.1 | 2 | ||
8.1 | 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. | ||
46.1 | 6 | * then add the row "com.almworks.sqlite4java" at the end of the file. | |
8.1 | 7 | ||
8 | Edit the file requeadb.xml located in dysoweb.home/config by adding the row : | ||
9 | <DbSpatial>true</DbSpatial> | ||
10 | |||
43.1 | 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 | |||
45.1 | 13 | {{code language="script"}} | |
43.1 | 14 | ||
15 | start reference:file:/../dynapage/ext/com.requea.dynapage.ext.geospatial.openstreetmap/src/main/ | ||
16 | |||
17 | {{/code}} | ||
18 | |||
19 | |||
8.1 | 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 = | ||
15.1 | 26 | ||
9.1 | 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// : | |
8.1 | 28 | ||
31.1 | 29 | [[image:Capturedecran2015-06-02a16.21.15.png]] | |
15.1 | 30 | ||
31.1 | 31 | ||
8.1 | 32 | To view the map from the .mbtiles file, create an entity derived from GeoMapView: | |
33 | |||
42.1 | 34 | [[image:Capturedecran2015-07-10a16.18.34.png]] | |
35 | |||
47.1 | 36 | Modify the script of the field Display rules or behavior in the properties sysCenter and sysZoom so that it point to your preferred location: | |
8.1 | 37 | ||
31.1 | 38 | [[image:Capturedecran2015-06-01a17.55.14.png]] | |
8.1 | 39 | ||
31.1 | 40 | [[image:Capturedecran2015-06-01a17.55.38.png]] | |
41 | |||
9.1 | 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 | |||
11.1 | 55 | var flt = new Filter("custItem"); | |
9.1 | 56 | ||
57 | var iter = flt.search(); | ||
58 | |||
59 | while(iter.hasNext()) { | ||
60 | var item = iter.next(); | ||
11.1 | 61 | var pos = item.custGeoPosition; | |
9.1 | 62 | ||
10.1 | 63 | //add the item on the map, at the position specified | |
34.1 | 64 | layer.points.push({id:station.sysId, pos:pos }); | |
9.1 | 65 | } | |
66 | map.layers.push(layer); | ||
67 | |||
68 | data = new Json(map); | ||
69 | } | ||
70 | {{/code}} | ||
11.1 | 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 | |||
33.1 | 79 | layer.icons = [ { url:'/img/img0.png',x:-16,y:-16}, | |
80 | { url:'img/img1.png',x:-16,y:-16}, | ||
11.1 | 81 | { url:'img/img2.png',x:-16,y:-16}, | |
33.1 | 82 | { url:'/img/img3.png',x:-16,y:-16} | |
11.1 | 83 | ]; | |
33.1 | 84 | ||
85 | icon = 2; | ||
86 | |||
32.1 | 87 | layer.points.push({icon:icon, pos:pos,... }); | |
11.1 | 88 | ||
89 | {{/code}} | ||
31.1 | 90 | ||
91 | The root of the URL specified is the folder webapps in dysoweb.home///bundleName///src |