1

Geozones import via SDK problem

(edited by ernestas 24/04/2019 11:44:11)

Topic: Geozones import via SDK problem

One of our client tries to create geozones using SDK. Anyway there is some kind a problem because after import geozone looks different then it should look (tested on google earth and manual geozone import). What does client doing wrong?

We are making steps like info bellow:

- Using KML file (attached bellow);
- We read coordinates from tag <coordinates>;
- then we are using service https://sdk.wialon.com/wiki/en/sidebar/ … pdate_zone to create new geozone with coordinates from KML file.
- We present request with these parameters id = 0, callMode = create, n,d, t = 2, f =112, w = 300, c = 2566940364, p – coordinates (where r = 300);


Attached examples and KML.

Post's attachments

Attachment icon 3302_PK63-65_darbu_zona.kml 4.71 kb, 204 downloads since 2019-04-24 

2

Geozones import via SDK problem

Re: Geozones import via SDK problem

Hello!
May be you miss some points in request.
Try to use and compare with the following parameters: it get the same image as on you screenshot from kml file

params={"n":"Polygon","d":"Laatzen 30880, Lange Weihe","t":2,"w":300,"f":112,"c":2566914303,"tc":16733440,"ts":12,"min":0,"max":18,"p":[{"x":23.8812222455,"y":54.6928239225,"r":300},{"x":23.8817351862,"y":54.6926217199,"r":300},{"x":23.8816915525,"y":54.6925845792,"r":300},{"x":23.8816445957,"y":54.692544657,"r":300},{"x":23.8816414998,"y":54.6925420846,"r":300},{"x":23.8816294305,"y":54.6925320611,"r":300},{"x":23.8816181876,"y":54.6925227444,"r":300},{"x":23.881605601,"y":54.6925123565,"r":300},{"x":23.8815981848,"y":54.6925062649,"r":300},{"x":23.8803270751,"y":54.691732534,"r":300},{"x":23.8803088702,"y":54.6917242999,"r":300},{"x":23.880290413,"y":54.6917160129,"r":300},{"x":23.8802719359,"y":54.6917077758,"r":300},{"x":23.8802534409,"y":54.6916995872,"r":300},{"x":23.88023493,"y":54.6916914459,"r":300},{"x":23.8802164052,"y":54.6916833507,"r":300},{"x":23.8801978685,"y":54.6916753001,"r":300},{"x":23.8801793218,"y":54.6916672928,"r":300},{"x":23.880160767,"y":54.6916593277,"r":300},{"x":23.8801422061,"y":54.6916514033,"r":300},{"x":23.8801236408,"y":54.6916435184,"r":300},{"x":23.8801050729,"y":54.6916356716,"r":300},{"x":23.8800865044,"y":54.6916278616,"r":300},{"x":23.880067937,"y":54.6916200871,"r":300},{"x":23.8800493724,"y":54.6916123468,"r":300},{"x":23.8800308124,"y":54.6916046393,"r":300},{"x":23.8800122587,"y":54.6915969635,"r":300},{"x":23.8799937131,"y":54.6915893178,"r":300},{"x":23.8799751771,"y":54.6915817011,"r":300},{"x":23.8799566525,"y":54.6915741121,"r":300},{"x":23.8799381409,"y":54.6915665493,"r":300},{"x":23.879919644,"y":54.6915590116,"r":300},{"x":23.8799012839,"y":54.6915515466,"r":300},{"x":23.8798828061,"y":54.6915440488,"r":300},{"x":23.8798643477,"y":54.6915365721,"r":300},{"x":23.8798459103,"y":54.6915291153,"r":300},{"x":23.8798274955,"y":54.691521677,"r":300},{"x":23.8798091047,"y":54.691514256,"r":300},{"x":23.8797907397,"y":54.691506851,"r":300},{"x":23.8797724019,"y":54.6914994607,"r":300},{"x":23.8797540927,"y":54.6914920838,"r":300},{"x":23.8788972901,"y":54.6911468812,"r":300},{"x":23.878790111,"y":54.6911034403,"r":300},{"x":23.8784344285,"y":54.6913979189,"r":300},{"x":23.8785423187,"y":54.6914416482,"r":300},{"x":23.8793998264,"y":54.6917871361,"r":300},{"x":23.8794180752,"y":54.6917944886,"r":300},{"x":23.8794362921,"y":54.6918018302,"r":300},{"x":23.8794544759,"y":54.6918091622,"r":300},{"x":23.8794726249,"y":54.6918164856,"r":300},{"x":23.8794907377,"y":54.6918238019,"r":300},{"x":23.8795088129,"y":54.6918311121,"r":300},{"x":23.8795268489,"y":54.6918384175,"r":300},{"x":23.8795448443,"y":54.6918457194,"r":300},{"x":23.8795629331,"y":54.6918530742,"r":300},{"x":23.8795808577,"y":54.6918603787,"r":300},{"x":23.8795987373,"y":54.6918676833,"r":300},{"x":23.8796165703,"y":54.691874989,"r":300},{"x":23.8796343552,"y":54.6918822972,"r":300},{"x":23.8796520907,"y":54.6918896088,"r":300},{"x":23.8796697752,"y":54.6918969251,"r":300},{"x":23.8796874073,"y":54.6919042472,"r":300},{"x":23.8797049854,"y":54.6919115763,"r":300},{"x":23.8797225081,"y":54.6919189133,"r":300},{"x":23.8797399739,"y":54.6919262595,"r":300},{"x":23.8797573812,"y":54.691933616,"r":300},{"x":23.8797747287,"y":54.6919409837,"r":300},{"x":23.8797920148,"y":54.6919483638,"r":300},{"x":23.8798092379,"y":54.6919557574,"r":300},{"x":23.8798263966,"y":54.6919631654,"r":300},{"x":23.8798434894,"y":54.6919705889,"r":300},{"x":23.8798605146,"y":54.6919780289,"r":300},{"x":23.8798774707,"y":54.6919854864,"r":300},{"x":23.8798943562,"y":54.6919929624,"r":300},{"x":23.8799111696,"y":54.6920004578,"r":300},{"x":23.8799279092,"y":54.6920079737,"r":300},{"x":23.8799447979,"y":54.6920156125,"r":300},{"x":23.8810911404,"y":54.6927133964,"r":300},{"x":23.8810981559,"y":54.692719159,"r":300},{"x":23.8811100027,"y":54.6927289363,"r":300},{"x":23.8811207233,"y":54.6927378203,"r":300},{"x":23.8811325224,"y":54.6927476194,"r":300},{"x":23.8811337187,"y":54.6927486135,"r":300},{"x":23.8811786121,"y":54.6927867816,"r":300}],"id":165,"itemId":930849,"callMode":"update"}

Also your example of KML file radius is 0. It doesn't need to specify point radius if geozone is polygon.

Diana Cheley
Wialon Hosting Expert
Gurtam
3

Geozones import via SDK problem

(edited by ernestas 08/05/2019 13:25:23)

Re: Geozones import via SDK problem

Hello,

With our request there is something wrong. There is difference between coordinates. Is there any rule regarding KML? We just take the list of coordinates from KML and transfer it. Maybe there is some kind order of location points to transfer via request?   


Our parameters:

params={"itemId":16923442,"id":0,"callMode":"create","n":"Testas","d":"TESTdescription","t":2,"f":112,"w":300,"c":2566940364,"p":[{"x":23.8812222454,"y":54.6926217199,"r":300},{"x":23.8817351861,"y":54.6925845791,"r":300},{"x":23.8816915525,"y":54.6925446569,"r":300},{"x":23.8816445956,"y":54.6925420845,"r":300},{"x":23.8816414998,"y":54.6925320611,"r":300},{"x":23.8816294305,"y":54.6925227444,"r":300},{"x":23.8816181876,"y":54.6925123565,"r":300},{"x":23.8816056009,"y":54.6925062649,"r":300},{"x":23.8815981848,"y":54.6917325339,"r":300},{"x":23.8803270751,"y":54.6917242999,"r":300},{"x":23.8803088701,"y":54.6917160128,"r":300},{"x":23.8802904130,"y":54.6917077757,"r":300},{"x":23.8802719358,"y":54.6916995872,"r":300},{"x":23.8802534408,"y":54.6916914459,"r":300},{"x":23.8802349299,"y":54.6916833506,"r":300},{"x":23.8802164052,"y":54.6916753000,"r":300},{"x":23.8801978684,"y":54.6916672928,"r":300},{"x":23.8801793218,"y":54.6916593276,"r":300},{"x":23.8801607670,"y":54.6916514033,"r":300},{"x":23.8801422060,"y":54.6916435183,"r":300},{"x":23.8801236407,"y":54.6916356715,"r":300},{"x":23.8801050729,"y":54.6916278615,"r":300},{"x":23.8800865044,"y":54.6916200870,"r":300},{"x":23.8800679369,"y":54.6916123467,"r":300},{"x":23.8800493724,"y":54.6916046393,"r":300},{"x":23.8800308124,"y":54.6915969634,"r":300},{"x":23.8800122587,"y":54.6915893178,"r":300},{"x":23.8799937130,"y":54.6915817011,"r":300},{"x":23.8799751771,"y":54.6915741120,"r":300},{"x":23.8799566525,"y":54.6915665493,"r":300},{"x":23.8799381409,"y":54.6915590115,"r":300},{"x":23.8799196439,"y":54.6915515465,"r":300},{"x":23.8799012839,"y":54.6915440487,"r":300},{"x":23.8798828060,"y":54.6915365720,"r":300},{"x":23.8798643476,"y":54.6915291152,"r":300},{"x":23.8798459102,"y":54.6915216769,"r":300},{"x":23.8798274954,"y":54.6915142559,"r":300},{"x":23.8798091047,"y":54.6915068509,"r":300},{"x":23.8797907396,"y":54.6914994606,"r":300},{"x":23.8797724018,"y":54.6914920837,"r":300},{"x":23.8797540927,"y":54.6911468812,"r":300},{"x":23.8788972901,"y":54.6911034402,"r":300},{"x":23.8787901109,"y":54.6913979188,"r":300},{"x":23.8784344284,"y":54.6914416482,"r":300},{"x":23.8785423186,"y":54.6917871361,"r":300},{"x":23.8793998264,"y":54.6917944886,"r":300},{"x":23.8794180751,"y":54.6918018302,"r":300},{"x":23.8794362921,"y":54.6918091621,"r":300},{"x":23.8794544758,"y":54.6918164856,"r":300},{"x":23.8794726249,"y":54.6918238018,"r":300},{"x":23.8794907377,"y":54.6918311120,"r":300},{"x":23.8795088129,"y":54.6918384175,"r":300},{"x":23.8795268488,"y":54.6918457194,"r":300},{"x":23.8795448442,"y":54.6918530741,"r":300},{"x":23.8795629330,"y":54.6918603787,"r":300},{"x":23.8795808577,"y":54.6918676832,"r":300},{"x":23.8795987372,"y":54.6918749890,"r":300},{"x":23.8796165702,"y":54.6918822971,"r":300},{"x":23.8796343552,"y":54.6918896088,"r":300},{"x":23.8796520907,"y":54.6918969251,"r":300},{"x":23.8796697752,"y":54.6919042472,"r":300},{"x":23.8796874072,"y":54.6919115762,"r":300},{"x":23.8797049853,"y":54.6919189133,"r":300},{"x":23.8797225080,"y":54.6919262595,"r":300},{"x":23.8797399738,"y":54.6919336159,"r":300},{"x":23.8797573812,"y":54.6919409837,"r":300},{"x":23.8797747287,"y":54.6919483638,"r":300},{"x":23.8797920147,"y":54.6919557573,"r":300},{"x":23.8798092379,"y":54.6919631653,"r":300},{"x":23.8798263966,"y":54.6919705888,"r":300},{"x":23.8798434893,"y":54.6919780288,"r":300},{"x":23.8798605145,"y":54.6919854863,"r":300},{"x":23.8798774707,"y":54.6919929623,"r":300},{"x":23.8798943562,"y":54.6920004578,"r":300},{"x":23.8799111695,"y":54.6920079737,"r":300},{"x":23.8799279091,"y":54.6920156124,"r":300},{"x":23.8799447978,"y":54.6927133963,"r":300},{"x":23.8810911404,"y":54.6927191589,"r":300},{"x":23.8810981559,"y":54.6927289363,"r":300},{"x":23.8811100027,"y":54.6927378202,"r":300},{"x":23.8811207232,"y":54.6927476194,"r":300},{"x":23.8811325223,"y":54.6927486135,"r":300},{"x":23.8811337187,"y":54.6927867815,"r":300},{"x":23.8811786120,"y":54.6928239225,"r":300}]}

Your parameters:

params={"n":"Polygon","d":"Laatzen 30880, Lange Weihe","t":2,"w":300,"f":112,"c":2566914303,"tc":16733440,"ts":12,"min":0,"max":18,"p":[{"x":23.8812222455,"y":54.6928239225,"r":300},{"x":23.8817351862,"y":54.6926217199,"r":300},{"x":23.8816915525,"y":54.6925845792,"r":300},{"x":23.8816445957,"y":54.692544657,"r":300},{"x":23.8816414998,"y":54.6925420846,"r":300},{"x":23.8816294305,"y":54.6925320611,"r":300},{"x":23.8816181876,"y":54.6925227444,"r":300},{"x":23.881605601,"y":54.6925123565,"r":300},{"x":23.8815981848,"y":54.6925062649,"r":300},{"x":23.8803270751,"y":54.691732534,"r":300},{"x":23.8803088702,"y":54.6917242999,"r":300},{"x":23.880290413,"y":54.6917160129,"r":300},{"x":23.8802719359,"y":54.6917077758,"r":300},{"x":23.8802534409,"y":54.6916995872,"r":300},{"x":23.88023493,"y":54.6916914459,"r":300},{"x":23.8802164052,"y":54.6916833507,"r":300},{"x":23.8801978685,"y":54.6916753001,"r":300},{"x":23.8801793218,"y":54.6916672928,"r":300},{"x":23.880160767,"y":54.6916593277,"r":300},{"x":23.8801422061,"y":54.6916514033,"r":300},{"x":23.8801236408,"y":54.6916435184,"r":300},{"x":23.8801050729,"y":54.6916356716,"r":300},{"x":23.8800865044,"y":54.6916278616,"r":300},{"x":23.880067937,"y":54.6916200871,"r":300},{"x":23.8800493724,"y":54.6916123468,"r":300},{"x":23.8800308124,"y":54.6916046393,"r":300},{"x":23.8800122587,"y":54.6915969635,"r":300},{"x":23.8799937131,"y":54.6915893178,"r":300},{"x":23.8799751771,"y":54.6915817011,"r":300},{"x":23.8799566525,"y":54.6915741121,"r":300},{"x":23.8799381409,"y":54.6915665493,"r":300},{"x":23.879919644,"y":54.6915590116,"r":300},{"x":23.8799012839,"y":54.6915515466,"r":300},{"x":23.8798828061,"y":54.6915440488,"r":300},{"x":23.8798643477,"y":54.6915365721,"r":300},{"x":23.8798459103,"y":54.6915291153,"r":300},{"x":23.8798274955,"y":54.691521677,"r":300},{"x":23.8798091047,"y":54.691514256,"r":300},{"x":23.8797907397,"y":54.691506851,"r":300},{"x":23.8797724019,"y":54.6914994607,"r":300},{"x":23.8797540927,"y":54.6914920838,"r":300},{"x":23.8788972901,"y":54.6911468812,"r":300},{"x":23.878790111,"y":54.6911034403,"r":300},{"x":23.8784344285,"y":54.6913979189,"r":300},{"x":23.8785423187,"y":54.6914416482,"r":300},{"x":23.8793998264,"y":54.6917871361,"r":300},{"x":23.8794180752,"y":54.6917944886,"r":300},{"x":23.8794362921,"y":54.6918018302,"r":300},{"x":23.8794544759,"y":54.6918091622,"r":300},{"x":23.8794726249,"y":54.6918164856,"r":300},{"x":23.8794907377,"y":54.6918238019,"r":300},{"x":23.8795088129,"y":54.6918311121,"r":300},{"x":23.8795268489,"y":54.6918384175,"r":300},{"x":23.8795448443,"y":54.6918457194,"r":300},{"x":23.8795629331,"y":54.6918530742,"r":300},{"x":23.8795808577,"y":54.6918603787,"r":300},{"x":23.8795987373,"y":54.6918676833,"r":300},{"x":23.8796165703,"y":54.691874989,"r":300},{"x":23.8796343552,"y":54.6918822972,"r":300},{"x":23.8796520907,"y":54.6918896088,"r":300},{"x":23.8796697752,"y":54.6918969251,"r":300},{"x":23.8796874073,"y":54.6919042472,"r":300},{"x":23.8797049854,"y":54.6919115763,"r":300},{"x":23.8797225081,"y":54.6919189133,"r":300},{"x":23.8797399739,"y":54.6919262595,"r":300},{"x":23.8797573812,"y":54.691933616,"r":300},{"x":23.8797747287,"y":54.6919409837,"r":300},{"x":23.8797920148,"y":54.6919483638,"r":300},{"x":23.8798092379,"y":54.6919557574,"r":300},{"x":23.8798263966,"y":54.6919631654,"r":300},{"x":23.8798434894,"y":54.6919705889,"r":300},{"x":23.8798605146,"y":54.6919780289,"r":300},{"x":23.8798774707,"y":54.6919854864,"r":300},{"x":23.8798943562,"y":54.6919929624,"r":300},{"x":23.8799111696,"y":54.6920004578,"r":300},{"x":23.8799279092,"y":54.6920079737,"r":300},{"x":23.8799447979,"y":54.6920156125,"r":300},{"x":23.8810911404,"y":54.6927133964,"r":300},{"x":23.8810981559,"y":54.692719159,"r":300},{"x":23.8811100027,"y":54.6927289363,"r":300},{"x":23.8811207233,"y":54.6927378203,"r":300},{"x":23.8811325224,"y":54.6927476194,"r":300},{"x":23.8811337187,"y":54.6927486135,"r":300},{"x":23.8811786121,"y":54.6927867816,"r":300}],"id":165,"itemId":930849,"callMode":"update"}


As we have analyzed x coordinates the same but y coordinates different. How could it happen as i do not see difference in KML file?

Also attaching picture with different results. Our result in yellow color. The difference are huge.

4

Geozones import via SDK problem

Re: Geozones import via SDK problem

Hello!

as I see it's not correct pairs X and Y  in your parameters
For example, first point - 23.88122224546052,54.69282392251598 in klm, in request - {"x":23.8812222455,"y":54.6928239225,"r":300}
But in your request this point is {"x":23.8812222454,"y":54.6926217199,"r":300}. As you see the other value for Y
the same for second point - 23.88173518617861,54.69262171990643 in klm, in request  {"x":23.8817351862,"y":54.6926217199,"r":300}
your point - {"x":23.8817351861,"y":54.6925845791,"r":300}

it seems like you parse coordinates from KML not correctly. The format is X1,Y1,radius X2,Y2,radius X3.....
Coordinates are separated by coma, each points are separated by space after radius

Diana Cheley
Wialon Hosting Expert
Gurtam
5

Geozones import via SDK problem

Re: Geozones import via SDK problem

Do we need to add &sid=bac8571a1131f3cfcf4733c0e8acc307 to creat Geofences: create

After login id

"user": {
        "nm": "brainvire",
        "cls": 1,
        "id": 58415,


http: //gps.tawasolmap.com/wialon/ajax.html?svc=resource/update_zone&params={
  "n": "Polygon",
  "d": "Laatzen 30880, Lange Weihe",
  "t": 2,
  "w": 300,
  "f": 112,
  "c": 2566914303,
  "tc": 16733440,
  "ts": 12,
  "min": 0,
  "max": 18,
  "p": [
    {
      "x": 23.8812222455,
      "y": 54.6928239225,
      "r": 300
    },
    {
      "x": 23.8817351862,
      "y": 54.6926217199,
      "r": 300
    },
    {
      "x": 23.8816915525,
      "y": 54.6925845792,
      "r": 300
    }
  ],
  "id": 0,
  "itemId": 58415,
  "callMode": "create"
}&sid=bac8571a1131f3cfcf4733c0e8acc307

response

{
    "error": 7
}

6

Geozones import via SDK problem

Re: Geozones import via SDK problem

Hello!

Parameter sid (session ID) is added to every request (after login)
Error7 means access denied.  To create geofence you need to specify  as  "itemId" - resource ID (not user ID). After login you can look parameter "bact" is a resource ID of user under which login.

Diana Cheley
Wialon Hosting Expert
Gurtam