1

Help with creating geozone

Тема: Help with creating geozone

Hi, I have a quick question regarding creating geozone thru SDK, in request there should be ResourceID which I am not sure what represents
I tried to use userid but got error 7, any ideas..? thanks
My code is below

    string urlCreateGeofence =
                           wialonurlfix + "ajax.html?svc=resource/update_zone&sid=" + eID +                           
                           "&params={" +
                               "\"itemId\":userid," +//resource ID
                               "\"id\":1," +//geofence ID
                               "\"callMode\":\"create\"," +//action: create, update, delete
                               "\"n\":\"veni\"," +//geofence name
                               "\"t\":3," +//type: 1 - line, 2 - polygon, 3 - circle
                               "\"w\":10," +//line thickness or circle radius
                               "\"p\":[" +//array of geofence points
                               "{" +
                                   "\"x\":52.601202," +//long //double string gpsLat = "52.601202"; string gpsLon = "13.430444";       
                                   "\"y\":13.430444," +//lat //double
                                   "\"r\":1000" +//radius //int                                 
                               "}" +
                               "]," +
                               "\"d\":[" +
                               "{" +
                                   "\"addr\":0," +
                                   "\"rideBegin\":0," +
                                   "\"rideEnd\":0," +
                                   "\"color\":808000FF" +//color (ARGB)
                               "}" +
                               "]" +
                           "}";

2

Help with creating geozone

Re: Help with creating geozone

Hi

Geozone is a subitem of resource, so you should specify ID of resource where you want to create geozone.
To get all available resources use core/search_items with following params

svc=core/search_items&params={
  "spec":{
    "itemsType":"avl_resource",    
    "propName":"sys_name",    
    "propValueMask":"*",    
    "sortType":"sys_name"
  },
  "force":1,            
  "flags":0x1,            
  "from":0,            
  "to":0
}&sid=....
3

Help with creating geozone

Re: Help with creating geozone

thanks, I got my resource id which seems  +1 of my userid, now I get error 4. Could you please help with what possible could be wrong with the url request

http://hst-api.wialon.com/wialon/ajax.html?svc=resource/update_zone&sid=18026567cc54b2c8565fe9ff57f77729&params={"itemId":893277,"id":1,"callMode":"create","n":"veni","t":3,"w":1,"p":[{"x":52.601202,"y":13.430444,"r":1}],"d":[{"addr":0,"rideBegin":0,"rideEnd":0,"color":808000FF}]}

4

Help with creating geozone

Re: Help with creating geozone

All params listed in documentation must be sent in request. Compare your params with resource/update_zone required, add missing and try again

5

Help with creating geozone

Re: Help with creating geozone

thanks for the suggestion, my mistake, I was looking at  wialonpro API.. ok, code changed to match the api parameters but still getting error 4

http://hst-api.wialon.com/wialon/ajax.html?svc=resource/update_zone&sid=262f0372d9b6788a8828bb4021be0fca&params={"itemId":893277,"id":10,"callMode":"create","n":"veni","d":"test","t":3,"w":1,"f":1,"c":808000FF,"p":[{"x":52.601202,"y":13.430444,"r":1000}]}

tried with different values for radius; provided t ,w,f both in format 0x1 and just 1, but seems still some of my paramters is wrong/missing, any help apprecciated smile

6

Help with creating geozone

Re: Help with creating geozone

Your "c" parameter looks strange: if it hex - use hex format 0x808000FF, if decimal - convert it first 2155872511

7

Help with creating geozone

Re: Help with creating geozone

thanks ! you are the boss smile

8

Help with creating geozone

Re: Help with creating geozone

i love developer discussions ;-)

And shmi: thanks for help!

Wolf.

Politeness dictates it to write his name on a post