1

Showed vehicles on a HTML page with webgis mapping of Guartam

Topic: Showed vehicles on a HTML page with webgis mapping of Guartam

Hi Guys !! (Guartam develloper)

I want to see on a HTML page, all of my vehicles of one of my account on a Webgis map with my layers integrated on our side and you

gave me this script and I have an error message  on the HTML page as follow :

update Dataflags error invalid service


This is the script we have put in the HTML page : would you tell me what is wrong it that srcipt, I think we are near the goal !! but somethings like to be not working.

Thanks
NTS


<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0; padding: 0 }
#map_canvas { height: 100% }
</style>

<script type="text/javascript"
src="http://maps.google.com/maps/api/js?sensor=false&language=fr&libraries=panoramio,weather">
</script>

<script type="text/javascript"
src="http://hosting.wialon.com/wsdk/script/wialon.js">
</script>

<script type="text/javascript">
/**
* Perform login to Wialon Hosting server
* @param login {String} login name
* @param passw {String} password
* @param callback {Function} result callback(code)
*/
function apiLogin(login, passw, callback) {
if (typeof login == "undefined" || login == "") {
alert("Invalid login name.");
return;
}
if (typeof passw == "undefined")
passw = "";

// Perform login
wialon.core.Session.getInstance().login(login, passw, "", function (code) {
// Always check the return result - if it's not 0 there's an error
if (code != 0) {
alert("login ERROR: " + wialon.core.Errors.getErrorText(code));
return;
}
if (typeof callback != "undefined")
callback(code);
});
}
</script>

<script type="text/javascript">
function initialize() {
// Set your user name and password:
var login = "My user ID";
var pwd = "";
// Create a session and log into it:
var mySession = wialon.core.Session.getInstance();
mySession.initSession("My http hosting account");
apiLogin(login, pwd);
// Retrieve all units:
var flags = wialon.item.Item.dataFlag.base // name, ID,...
// | wialon.item.Item.dataFlag.image // unit icon
// | wialon.item.Unit.dataFlag.restricted // UID, HW, phone
| wialon.item.Unit.dataFlag.lastMessage; // last message

// init event system and get units
var spec = {
type: "type", // get all objects by type defined in "data" key
data: "avl_unit", // object type
flags: flags, // information for retrieving
mode: 0 // get data
};
mySession.updateDataFlags(spec, qx.lang.Function.bind(function(code) {
if (code != 0) {
alert("updateDataFlags ERROR: " + wialon.core.Errors.getErrorText(code));
return;
}
}));

// get units
var items = mySession.getItems("avl_unit");
// For each unit, just show the last message:
items.forEach(function (item, idx, container) {
alert(item.lastMessage);
});
}
</script>

</head>
<body onload="initialize()">
<!-- Map canvas -->
<div id="map_canvas" style="width:100%; height:100%"></div>
</body>
</html>

2

Showed vehicles on a HTML page with webgis mapping of Guartam

Re: Showed vehicles on a HTML page with webgis mapping of Guartam

SDK using personalization mapping

Denis Strakh, Gurtam