Mylocation widget max zoom?

3675
16
Jump to solution
12-15-2015 07:10 AM
MathiasEriksson
New Contributor II

I have modifyed mylocation widget to look like this .

{

  "locateButton": {

    "geolocationOptions": {

      "timeout": 150

    },

    "highlightLocation": true,

    "useTracking": true

  }

}

but when i run it get my logation perfect but zoom to a very small area around my position.

it zoom to max in the webapp. arund 1 m fron the gps point is shown.

Can i Sett this to a defult value so it stay at a specefied distans ?

Tags (2)
0 Kudos
16 Replies
RobertScheitlin__GISP
MVP Emeritus

Mathias,

   In the WAB configuration UI open the widgets tab and then click on the little pencil on the My Location widget then when you click OK the save button in WAB should be enabled and then a config_My Location.json file will be created in the apps configs\MyLocation folder. Add the scale to that json file and test again.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Mathias,

  OK, I found the issue. in the main config.json you have:

    {
      "uri": "widgets/MyLocation/Widget",
      "position": {
        "left": 7,
        "top": 110,
        "relativeTo": "map"
      },
      "version": "1.4",
      "id": "widgets_MyLocation_Widget_12",
      "name": "MyLocation",
      "label": "Min plats",
      "config": {
        "locateButton": {
          "geolocationOptions": {
            "timeout": 300
          },
          "highlightLocation": true,
          "useTracking": true
        }
      }
    },

and it needs to be:

   {
      "uri": "widgets/MyLocation/Widget",
      "position": {
        "left": 7,
        "top": 110,
        "relativeTo": "map"
      },
      "version": "1.4",
      "id": "widgets_MyLocation_Widget_21",
      "name": "MyLocation",
      "label": "My Location"
    },

The config property is only expecting a path to the json not an actual json object. If the config property is not included then the widget will use the default config.json in the widgets folder.

See your app working properly here:

Work preview of your app

0 Kudos
MathiasEriksson
New Contributor II

Hi again.

Your is working perfect. but my don't work. it only zoom to 1 m at my location. I want it at 10m . 

0 Kudos
MathiasEriksson
New Contributor II

is it possible you can send me the compålet code for your version of my map so i can look at it?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Mathias,

  Here is the full app code:

0 Kudos
MathiasEriksson
New Contributor II

Perfect. your works like a charm. but i don't see why my don't.

copy you config.json, mylocation folder, and configs folder du my setup and it don't work. hmm i have som work on this.

And i need to learn the scale command mor så i can set mylocation on a smaller scale.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Mathias,

   Glad to help. Please be sure to mark this as answered.

0 Kudos