|
POST
|
Tim, The code works great. But I noticed I am not able to draw line or polygon for measurement tool due to popups. Any workaround? Keisuke
... View more
09-10-2014
12:37 PM
|
0
|
2
|
1673
|
|
POST
|
Yes, it works. Would you please tell me which part you changed? I added "dijit/TitlePane" and the line from 257 to 262. Thank you.
... View more
09-10-2014
11:35 AM
|
0
|
6
|
1673
|
|
POST
|
Yes, I did. Here is a code. Thank you. Keisuke <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <!--The viewport meta tag is used to improve the presentation and behavior of the samples on iOS devices--> <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"> <title>MCD Mobile GIS</title> <link rel="stylesheet" href="http://js.arcgis.com/3.8/js/dojo/dijit/themes/claro/claro.css"> <link rel="stylesheet" href="http://js.arcgis.com/3.8/js/esri/css/esri.css"> <style> html, body { height: 100%; width: 100%; margin: 0; padding: 0; } #map{ padding:0; border:solid 1px #343642; margin:5px 5px 5px 5px; } #LocateButton { position: absolute; top: 95px; left: 20px; z-index: 50; } #top{ width:20%; border-top: solid 1px #343642; border-left: solid 1px #343642; border-bottom: solid 1px #343642; border-right: solid 1px #343642; margin:5px 5px 5px 5px; color: #343642; font:90% Arial,"Arial",Arial,Arial; /*letter-spacing: 0.05em;*/ } </style> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i =i ||function(){ (i .q=i .q||[]).push(arguments)},i .l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-21888440-1', 'wiu.edu'); ga('send', 'pageview'); </script> <script src="http://js.arcgis.com/3.8/"></script> <script> var map, locator; require([ "esri/map", "esri/tasks/locator", "esri/graphic", "esri/dijit/InfoWindowLite", "esri/InfoTemplate", "esri/layers/FeatureLayer", "dojo/dom-construct", "esri/InfoTemplate", "esri/symbols/SimpleMarkerSymbol", "esri/symbols/Font", "esri/symbols/TextSymbol", "dojo/_base/array", "dojo/_base/Color", "dojo/number", "dojo/parser", "dojo/dom", "dojo/on", "dijit/registry", "esri/layers/ArcGISDynamicMapServiceLayer", "esri/layers/ArcGISTiledMapServiceLayer", "esri/dijit/LocateButton", "esri/dijit/Scalebar", "esri/dijit/Measurement", "dijit/form/Button", "dijit/form/Textarea", "dijit/layout/BorderContainer", "dijit/layout/ContentPane", "dojo/domReady!" ], function( Map, Locator, Graphic, InfoWindowLite, InfoTemplate, FeatureLayer, domConstruct, InfoTemplate, SimpleMarkerSymbol, Font, TextSymbol, arrayUtils, Color, number, parser, dom, on, registry, ArcGISDynamicMapServiceLayer, ArcGISTiledMapServiceLayer, LocateButton, Scalebar, Measurement ) { parser.parse(); var initExtent = new esri.geometry.Extent({"xmin":-10093755,"ymin":4932648,"xmax":-10093139,"ymax":4933004,"spatialReference":{"wkid":3857}}); var map = new esri.Map("map",{extent:initExtent}); var basemap2 = new ArcGISTiledMapServiceLayer("http://gis.wiu.edu/arcgis/rest/services/basemap/aerial_cache/MapServer", {"opacity" : 0.6}); map.addLayer(basemap2); var basemap = new esri.layers.ArcGISDynamicMapServiceLayer("http://gis.wiu.edu/arcgis/rest/services/mcdonough_mobile/MapServer"); map.addLayer(basemap); geoLocate = new LocateButton({ map: map, scale: 2400, tracking: true, useTracking: true }, "LocateButton"); geoLocate.startup(); var scalebar = new Scalebar({ map: map, // "dual" displays both miles and kilmometers // "english" is the default, which displays miles // use "metric" for kilometers scalebarUnit: "dual" }); /*var infoWindow = new InfoWindowLite(null, domConstruct.create("div", null, null, map.root)); infoWindow.startup(); map.setInfoWindow(infoWindow);*/ var template = new InfoTemplate(); template.setTitle("<b>${PARCELID}</b>"); template.setContent("${owner1_name} <br> ${site_address} <br> <a href =${wedge_url} target='_blank'>PRC Link</a>"); //add a layer to the map var featureLayer = new FeatureLayer("http://gis.wiu.edu/arcgis/rest/services/mcdonough_highway/MapServer/21", { mode: FeatureLayer.MODE_ONDEMAND, maxAllowableOffset: 1000, infoTemplate:template, outFields: ["PARCELID" , "site_address", "owner1_name", "wedge_url"] }); map.addLayer(featureLayer); map.infoWindow.resize(200, 75); //dojo.keys.copyKey maps to CTRL on windows and Cmd on Mac., but has wrong code for Chrome on Mac var snapManager = map.enableSnapping({ snapKey: has("mac") ? keys.META : keys.CTRL }); var layerInfos = [{ layer: parcelsLayer }]; snapManager.setLayerInfos(layerInfos); var measurement = new Measurement({ map: map }, dom.byId("measurementDiv")); measurement.startup(); on(dom.byId("address"), "keyup", function(event){ if (event.keyCode == 13 && this.value.length > 0) { locate(); } }) locator = new Locator("http://gis.wiu.edu/arcgis/rest/services/mcdonough_structure/GeocodeServer"); locator.on("address-to-locations-complete", showResults); // listen for button click then geocode map.infoWindow.resize(200,125); on(dom.byId("address"), 'onkeyup', function(event) { if (event.keyCode == 13 && this.value.length > 0) { locate(); } }); function locate() { map.graphics.clear(); var address = { "Street": dom.byId("address").value }; locator.outSpatialReference = map.spatialReference; var options = { address: address, outFields: ["HouseNum"] } locator.addressToLocations(options); } function showResults(evt) { var candidate; var symbol = new SimpleMarkerSymbol(); var infoTemplate = new InfoTemplate( "Location", "Address: ${address}<br />Score: ${score}<br />Source locator: ${locatorName}" ); symbol.setStyle(SimpleMarkerSymbol.STYLE_SQUARE); symbol.setSize(10); symbol.setColor(new Color("#ffff00")); var geom; arrayUtils.every(evt.addresses, function(candidate) { console.log(candidate.score); if (candidate.score > 80) { console.log(candidate.location); var attributes = { address: candidate.address, score: candidate.score, locatorName: candidate.attributes.StreetName }; geom = candidate.location; var graphic = new Graphic(geom, symbol, attributes, infoTemplate); //add a graphic to the map at the geocoded location map.graphics.add(graphic); //add a text symbol to the map listing the location of the matched address. var displayText = candidate.address; var font = new Font( "12pt", Font.STYLE_NORMAL, Font.VARIANT_NORMAL, Font.WEIGHT_BOLD, "Helvetica" ); var textSymbol = new TextSymbol( displayText, font, new Color("#ffff00") ); textSymbol.setOffset(0,15); map.graphics.add(new Graphic(geom, textSymbol)); return false; //break out of loop after one candidate with score greater than 80 is found. } else{ alert("No results found, please enter another address"); } }); if ( geom !== undefined ) { map.centerAndZoom(geom, 19); } } }); </script> </head> <body class="claro"> <div id="mainWindow" data-dojo-type="dijit/layout/BorderContainer" data-dojo-props="design:'sidebar', gutters:false" style="width:100%; height:100%;"> <div id="top" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'top'"> <font size = "3">MCD Mobile</font> <br> <font size = "2">WIU GIS Center <a href="help.html"><b>Help</b></a></font> <br> <input type="text" id="address" size="25" autofocus="autofocus"/> <br> </div> <div id="map" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'center'"> <div id="LocateButton"></div> <div id="measurementDiv"></div> </div> </div> </body> </html>
... View more
09-10-2014
10:09 AM
|
0
|
9
|
1673
|
|
POST
|
I am trying to add measurement tool to my existing code. What I did was: 1. add "esri/dijit/Measurement" and variable 2. add the following code after loading feature layer //dojo.keys.copyKey maps to CTRL on windows and Cmd on Mac., but has wrong code for Chrome on Mac var snapManager = map.enableSnapping({ snapKey: has("mac") ? keys.META : keys.CTRL }); var layerInfos = [{ layer: parcelsLayer }]; snapManager.setLayerInfos(layerInfos); var measurement = new Measurement({ map: map }, dom.byId("measurementDiv")); measurement.startup(); 3. add <div id="measurementDiv"></div> in the end However, the measurement tool does not display. Please let know what is missing. Thank you. Keisuke
... View more
09-10-2014
07:39 AM
|
0
|
11
|
2682
|
|
POST
|
Would it be possible to resize the widget area? I am hoping one of the files stores information about the size.
... View more
09-04-2014
12:38 PM
|
0
|
0
|
489
|
|
POST
|
I was notified some widgets such as drawing and measurement would hide the full screen when opening with cell phone portrait screen (i.e. Samsung note II). It looks better on cell phone landscape screen. I am wondering if this is a known issue and any workaround (i.e. reducing widget size when open). Thank you.
... View more
08-20-2014
11:30 AM
|
1
|
2
|
3055
|
|
POST
|
Yes, it works now. I had to reboot my tablet once. Thank you very much for checking. Do you know why syntax is slightly different? In API, there is no " " required.
... View more
08-20-2014
06:50 AM
|
0
|
3
|
1015
|
|
POST
|
I want to set a scale for MyLocation widget, so it would not zoom too much. For JavaScript API, all I need to do was inserting scale:2400. Syntax in the widget looks a little different from API Reference. Please let me know which part is missing. Thank you.
{
"locateButton": {
"geolocationOptions": {
"timeout": 15000
},
"highlightLocation": true,
"scale": 2400
}
}
... View more
08-19-2014
12:35 PM
|
0
|
5
|
4084
|
|
POST
|
Thank you. But it did not work as I expected. How hard is it to turn on or off a layer by touching layer name?
... View more
08-15-2014
12:52 PM
|
0
|
1
|
682
|
|
POST
|
Here is a layer list widget provided by WebApp Builder Beta. It is not always easy to turn on and off on mobile devices. Is there a way to enlarge a checkbox? Or can I have a layer turned on or off by touching layer name? I appreciate your advice.
... View more
08-15-2014
09:43 AM
|
1
|
3
|
3624
|
|
POST
|
I will post this question to Web AppBuilder for ArcGIS group. Thank you.
... View more
08-15-2014
09:40 AM
|
0
|
0
|
435
|
|
POST
|
Here is a layer list widget provided by WebApp Builder Beta. It is not always easy to turn on and off on mobile devices. Is there a way to enlarge a checkbox? Or can I have a layer turned on or off by touching layer name? I appreciate your advice.
... View more
08-15-2014
09:31 AM
|
0
|
2
|
2595
|
|
POST
|
Thanks! I am not familiar with legacy but understand the concept. Hope esri will update the code for AMD.
... View more
08-14-2014
07:40 AM
|
0
|
1
|
1440
|
|
POST
|
I wonder if there is a way to customize basemap gallery to set own tiled map services instead of ArcGIS.com maps. Thank you for your advice.
... View more
08-14-2014
06:31 AM
|
0
|
5
|
2332
|
| Title | Kudos | Posted |
|---|---|---|
| 2 | 01-22-2015 07:37 AM | |
| 1 | 08-15-2014 09:43 AM | |
| 1 | 11-25-2014 11:00 AM | |
| 1 | 08-20-2014 11:30 AM | |
| 8 | 02-01-2012 06:32 AM |
| Online Status |
Offline
|
| Date Last Visited |
10-07-2022
10:01 AM
|