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. | ||
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 = | ||
15.1 | 17 | ||
9.1 | 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// : | |
8.1 | 19 | ||
31.1 | 20 | [[image:Capturedecran2015-06-02a16.21.15.png]] | |
15.1 | 21 | ||
31.1 | 22 | ||
8.1 | 23 | To view the map from the .mbtiles file, create an entity derived from GeoMapView: | |
24 | |||
15.1 | 25 | ||
8.1 | 26 | Modify the script of the field Display rules or behavior in the properties sysView and sysZoom so that it point to your preferred location: | |
27 | |||
31.1 | 28 | [[image:Capturedecran2015-06-01a17.55.14.png]] | |
8.1 | 29 | ||
31.1 | 30 | [[image:Capturedecran2015-06-01a17.55.38.png]] | |
31 | |||
9.1 | 32 | To display items on that map, edit the operation BuildMap with a script. | |
33 | |||
34 | For example: | ||
35 | |||
36 | {{code language="javascript"}} | ||
37 | var map = {}; | ||
38 | map.layers = []; | ||
39 | var layer; | ||
40 | |||
41 | layer = {}; | ||
42 | layer.title = "Items"; | ||
43 | layer.layers = []; | ||
44 | |||
11.1 | 45 | var flt = new Filter("custItem"); | |
9.1 | 46 | ||
47 | var iter = flt.search(); | ||
48 | |||
49 | while(iter.hasNext()) { | ||
50 | var item = iter.next(); | ||
11.1 | 51 | var pos = item.custGeoPosition; | |
9.1 | 52 | ||
10.1 | 53 | //add the item on the map, at the position specified | |
34.1 | 54 | layer.points.push({id:station.sysId, pos:pos }); | |
9.1 | 55 | } | |
56 | map.layers.push(layer); | ||
57 | |||
58 | data = new Json(map); | ||
59 | } | ||
60 | {{/code}} | ||
11.1 | 61 | ||
62 | You can change the default icon of the item by adding a icon field in the JSON Object layer.points. | ||
63 | For example: | ||
64 | |||
65 | {{code language="javascript"}} | ||
66 | |||
67 | layer.points = []; | ||
68 | |||
33.1 | 69 | layer.icons = [ { url:'/img/img0.png',x:-16,y:-16}, | |
70 | { url:'img/img1.png',x:-16,y:-16}, | ||
11.1 | 71 | { url:'img/img2.png',x:-16,y:-16}, | |
33.1 | 72 | { url:'/img/img3.png',x:-16,y:-16} | |
11.1 | 73 | ]; | |
33.1 | 74 | ||
75 | icon = 2; | ||
76 | |||
32.1 | 77 | layer.points.push({icon:icon, pos:pos,... }); | |
11.1 | 78 | ||
79 | {{/code}} | ||
31.1 | 80 | ||
81 | The root of the URL specified is the folder webapps in dysoweb.home///bundleName///src |