Select to view content in your preferred language

my location widget scale problem

2909
16
02-03-2016 07:08 AM
MathiasEriksson
Deactivated User

I have a my location widget that has the code.

{

  "locateButton": {

    "geolocationOptions": {

      "timeout": 15000

    },

    "highlightLocation": true,

    "useTracking": true,

    "scale": 1200

  }

}

the scale command give a perfect scale.

but if I zoom in or out it resets after 15 sekund. ( I can change reset time to what ever I want)

I'm trying to get it to stay at the zoom lvl  the user sets after first positioning. 

If i remove scale is goes to maz zoom every 15 seconds

I have try to use :

{

  "locateButton": {

    "geolocationOptions": {

      "timeout": 15000,

      "setScale": false

    },

    "highlightLocation": true,

    "useTracking": true

  }

}

but the it zooms in to max and stay the. I can't zoom out.

any one have a any good input on this?

0 Kudos
16 Replies
RobertScheitlin__GISP
MVP Emeritus

Mathias,

   Looks like you are missing the nls folder or just the strings.js file in that folder from your my location widget. That is the most serious issue. Next I am not good at minified code editing but the change I would suggest is:

this.geoLocate.setScale = !1;

EDIT: I made a correction to my earlier code and tested this on a minified WAB App I downloaded from AGOL and it worked for me.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Mathias Eriksson

See my above edit and info about missing file.

0 Kudos
MathiasEriksson
Deactivated User

So the correct code should be somthing like this :

onLocate: function(e) {

            this.geoLocate.setScale = !1;

            d.removeClass(this.placehoder, "locating");

            this.geoLocate.useTracking && d.addClass(this.placehoder, "tracking");

            e.error ? console.error(e.error) : (d.addClass(this.domNode, "onCenter"), this.neverLocate = !1)}

},

IS tha correct ?

I'm reinstalling my webserver but will try this in a few hours.

RobertScheitlin__GISP
MVP Emeritus

Correct

MathiasEriksson
Deactivated User

should I still have scale command in config_my Location.json

I still only get to the loading screen. and the widget donät show up.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Yes you should have the scale set in the config_my Location.json.

When I look at your site: http://app.sandbyborg.se/widgets/MyLocation/Widget.js  I do not see the change to the onLocate function included.

0 Kudos
MathiasEriksson
Deactivated User

not uploaded to that site yet.

0 Kudos