Location Widget

15071
114
02-20-2015 07:50 AM
Labels (1)

Location Widget

Hey everybody,

I am trying to get my feet wet with creating custom widgets for the WebApp builder, so please be kind

A while back I had created a location widget for the Javascript API and figured it might be good to do a WebApp builder version.

It is still in development, but I figured it might be a good idea to share it and see what you think.

You can see a live version HERE.

Version 1.3 (3-13-15):

- This version should work with custom basemaps.

- Added Zoom level in settings. Depending on your basemap you might need to change zoom level to 0.01. Read here for details.

Version 1.2:

-Changed the Layout to Tabs (Robert Scheitlin, GISP‌  Thanks)

-Added UTM function

Tim

Labels (1)
Attachments
Comments

That did the job, thanks again.

Good afternoon...

I needed a help to put a third option on LOCATION widget on WebAppBuilder. In reality I needed to convert to another a rating decimal minutes. I have the formula to me. Does it help me? I leave my email for more direct help, please. filipeamsantos@gmail.com

Thank you

Filipe

Hey Raimonds,

this seems to be a bug, try this js code:

var map;
var geocoder;

require([
"esri/geometry/Extent", "esri/map", "esri/layers/ArcGISTiledMapServiceLayer", "esri/dijit/Geocoder", "esri/SpatialReference", "dijit/form/TextBox", "dojo/parser",
"esri/tasks/locator", "dojo/on", "dojo/dom", "dijit/registry","esri/geometry/webMercatorUtils", "esri/tasks/GeometryService","esri/geometry/Point", "dijit/form/Button" ,"dojo/domReady!"
], function(
Extent, Map, ArcGISTiledMapServiceLayer, Geocoder, SpatialReference, TextBox, parser, Locator, on, dom, registry, webMercatorUtils ,GeometryService, Point
) {
parser.parse();

var initialExtent = new Extent({
"xmin": 505737.38,
"ymin": 311874.88,
"ymax": 311874.88,
"xmax": 505737.38,
"spatialReference": {
"wkid": 3059
}
});

map = new Map("map", {
logo: false,
sliderOrientation: "horizontal",
extent: initialExtent,
zoom: 7
});
gsvc = new GeometryService("https://utility.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer");
var tiled = new ArcGISTiledMapServiceLayer("http://kartes.lgia.gov.lv/arcgis/rest/services/mobilais/topo_mobilais/MapServer");
map.addLayer(tiled);

var locatorUrl = "http://serverapps101.esri.com/arcgis/rest/services/MGRS/GeocodeServer";
var Gridlocator = new Locator(locatorUrl);
var locator = new Locator("http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer");

var GridTextBox = new TextBox({
placeHolder: "35VMD0911152290",
value:"35VMD0911152290"
},"GridTextBoxDiv");

on(registry.byId("grid"), "click", setgrid);

function setgrid (){
var GridPoint = registry.byId("GridTextBoxDiv").get("value");
var gridnmb = {MGRS:GridPoint};
Gridlocator.addressToLocations(gridnmb);
map.graphics.clear();
}
Gridlocator.on("address-to-locations-complete", locateMeGridAddress);

function locateMeGridAddress(evt){
var FoundPointAr = evt.addresses;
var FoundPoint = FoundPointAr[0];
var LocPoint = FoundPoint.location;

var outSR = new SpatialReference(3059);
gsvc.project([ LocPoint ], outSR, function(projectedPoints) {
var renesPoint = new Point(projectedPoints[0].x, projectedPoints[0].y, new SpatialReference({ wkid: 3059 }))
map.centerAndZoom(renesPoint);
map.graphics.clear();
});

}


});

Hope this helps!

Tim

I am usig the My location widget in webapp application

When I press the viewfinder of the widget button becomes a black square often and the map is not moved in my position

In essence, the widget does not work

This happens both on iOS and on Android

Does anyone else have a similar Case Study?

THANK YOU

Gabriele

Gabriele,


   In chrome and now safari in iOS 10 the widget does not function without the site being a https website. Version 2.2 of WAB hide the my location widget if the site is not on the https protocol.

Robert,

thamk you for your accurate and quick tip.

I require the transfer under https, but does not depend on me being an installetion in my University.

Is there any chance, you know, to use a compatible version, or some setting that can allow their use in http?

Unfortunately, I have a short time because I wanted to deploy the app to students next week, at the beginning of my course.

THANK YOU for your kind cooperation

Gabriele

Gabrielle,


   No the https requirement is not something you can get around.

great, thanks 🙂

Tim,

Your widget looks what I've been looking for!  Have you tested this widget in WAB version 2.0?  Thanks for your help. Sincerely, Shauna-Rae

Shauna-Rae,

it seems ESRI created their own widget which is very similar to mine, you can find it here: ArcGIS Web Application 

Here is the link to the code: solutions-webappbuilder-widgets/CoordinateConversion at dev · Esri/solutions-webappbuilder-widgets ·... 

I wonder if they looked at mine and thought it was a good idea

Hope this helps,

Tim

Tim,

This is cool widget.  It works for me in my WAB 2.4 app.  

But, I notice that once I use the widget and the results pop-up loads, if I then close the widget and click on other layers with pop-ups, the size of my pop-up window is reduced to the size of the location widget popup.  This causes the other pop-ups to require scrolling to see all the attributes.  If I reload/refresh the map, the pop-ups return to their default (larger) size.

I am not sure if you have even had this issue reported or have any suggestions.

Devon

Never mind, I found Roberts eLocate widget.  Thanks!

Absolutely Genius!!  I aspire to code like you someday! Thank you so much!

This is a useful widget. Is (or will be) a version for the new javascript api (4.*) ?

Version history
Revision #:
1 of 1
Last update:
‎02-20-2015 07:50 AM
Updated by:
 
Contributors