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 ?
Solved! Go to Solution.
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:
Mathias,
Sure just add the "scale" property to your config object:
{
"locateButton": {
"geolocationOptions": {
"timeout": 150
},
"highlightLocation": true,
"useTracking": true,
"scale": 1200
}
}
what do scale refer to in this case ?
I don't se any diffrence in scale when I hit the button my location.
Mathias,
It is the map scale that is used when zooming to found location.
LocateButton | API Reference | ArcGIS API for JavaScript | scale
hmmm then change the scale number should give effect in my widget but it does not.
Have copy > Paste your code and still ge a very zoomed in version om my position.
(as close as the basemap let i be approx: 1 meter in in evry direction from my point)
Mathias,
Let me do some testing.
Mathias,
I tested on one of my live preview site and it woks fine. Try this site an activate the my location button
Here is the json used:
{ "locateButton": { "geolocationOptions": { "timeout": 15000 }, "highlightLocation": true, "scale": 12000, "useTracking": true } }
Are you sure you are changing the right file?
[mydeployed app]\configs\MyLocation\config_My Location.json
http://www.filedropper.com/mylocation
here you have my widget taken from \wwwroot\WAB13DE\6\widgets
I have change the code in config.jason
Matias,
The config.json looks fine als long as you do not have a [mydeployed app]\configs\MyLocation\config_My Location.json which will take precedence over that file.
Can't get it to work with scale
This is a complete copy of the map with widget.
http://www.filedropper.com/6_15
Do i miss some config file ?