POST
|
Looks like I will use my .NET proxy again. That helped. Thanks. I had hoped to get completely away from .NET, but since I already have proxy pages written, no point in making work for myself.
... View more
11-21-2014
11:24 AM
|
0
|
0
|
1013
|
POST
|
Awesome! The app is now doing exactly what I need it to do. Thanks!
... View more
11-21-2014
09:35 AM
|
0
|
0
|
855
|
POST
|
I'm using pure HTML5, no DotNet, Java, or PHP. I do have a web.config file and could technically use the DotNet one, but is there information for just pure HTML5?
... View more
11-21-2014
09:20 AM
|
0
|
5
|
1013
|
POST
|
I need to add a proxy for my app for printing and feature layers. I went to this page on how to include a proxy page:Using the proxy | Guide | ArcGIS API for JavaScript , but I need to know how to write one. How would I do that?
... View more
11-21-2014
09:11 AM
|
0
|
7
|
1479
|
POST
|
I have an application that uses mutlitple layers, a dynamic layer, a tiled map service, and soon a feature layer from a feature service as which are published on our own ArcGIS Server. I need to know how I determine the web map Id for the Print webmap located here: Print webmap | ArcGIS API for JavaScript
... View more
11-21-2014
09:08 AM
|
0
|
2
|
3083
|
POST
|
We're going to try that, but one last thing. Is there a way to get the LocateButton to run the current location on startup?
... View more
11-21-2014
06:46 AM
|
0
|
2
|
855
|
POST
|
Yes, this app will be used on a mobile device. I'll try testing it tomorrow. Will the locate button at least stop all tracking then if I press it? Because I don't want the map to zoom in and out when someone moves around unless they want their location updated.
... View more
11-20-2014
03:10 PM
|
0
|
4
|
855
|
POST
|
I have based my code on other examples and integrated it all into this app. Do you think the orientation function would not work? Still learning AMD and JavaScript(all the time). For the other, see my response to Kelly above. It kind of works, but your app does the same thing that I was experiencing with my app.
... View more
11-20-2014
03:00 PM
|
0
|
0
|
123
|
POST
|
When I open my application at maps.decaturil.gov/decaturgis/ (it's only for Macon County in Illinois), it zooms to my current location automatically and that is what we want it to do for field work. If I immediately click on the locate button, it will also display my current location, but if I move the map around or click on the home button again, the locate button will not update to the new location. There are no errors. I have both tools in the application as I want the app to first zoom to the users current location for field work and then if the user navigates around on the map while on site, I want them to be able to quickly find their location if needed without losing anything on the map by using the locate button.
... View more
11-20-2014
02:58 PM
|
0
|
6
|
855
|
POST
|
I have a LocateButton in my application that was working before I added my measurement tool and now it's working sometimes and sometimes not. Is there something I need to do. The Locate button script is near the end of my JavaScript: <!DOCTYPE html> <html> <head> <title>Decatur GIS Template</title> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta name="viewport" content="initial-scale=1,maximum-scale=1, user-scalable=no"> <link rel="stylesheet" href="http://js.arcgis.com/3.11/dijit/themes/soria/soria.css"> <link rel="stylesheet" href="http://js.arcgis.com/3.11/esri/css/esri.css"> <style> html, body, #mapDiv { padding: 0; margin: 0; height: 100%; width:100%; } #titlePane { width:240px; position:absolute; right:20px; bottom:50px; background-color:White; border-color:Black; z-index:50; } .soria .dijitTitlePaneTitle { background: #fff; font-weight:600; border: none; border-bottom:solid 1px #29201A; border-top:solid 1px #29201A; } .soria .dijitTitlePaneTitleHover { background:#eee; } .soria .dijitTitlePaneTitleActive { background:#808775; } .soria .dijitTitlePaneContentOuter { border-right: none; border-bottom: none; border-left: none; } #HomeButton { position: absolute; top: 95px; left: 20px; z-index: 50; } #LocateButton { position: absolute; top: 140px; left: 20px; z-index: 50; } #search { display:block; position:absolute; z-index:3; top:20px; left:75px; } .esriScalebarLine, .esriScalebarMetricLine { border-color:White; } .esriScalebarLabel, .esriScalebarLineLabel,.esriScalebarSecondNumber, .esriScaleLabelDiv { text-shadow:-1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff, 1px 1px 0 #fff; } @-webkit-keyframes pulse { 0% { opacity:1.0; } 45% { opacity:.20; } { 100% { opacity:1.0; } } @-moz-keyframes pulse { 0% { opacity:1.0; } 45% { opacity:.20; } 100% { opacity:1.0; } } #map_graphics_layer { -webkit-animation-duration: 3s; -webkit-animation-iteration-count: infinite; -webkit-animation-name: pulse; -moz-animation-duration: 3s; -moz-animation-iteration-count: infinite; -moz-animation-name: pulse; } </style> <script src="http://js.arcgis.com/3.11/"></script> <script> var map; var graphic; var currLocation; var watchId; var pt; require(["esri/map", "esri/config", "esri/Color", "esri/dijit/Geocoder", "esri/dijit/HomeButton", "esri/dijit/LocateButton", "esri/dijit/Measurement", "esri/dijit/OverviewMap", "esri/dijit/Scalebar", "esri/geometry/Extent", "esri/geometry/Point", "esri/geometry/screenUtils", "esri/graphic", "esri/layers/ArcGISTiledMapServiceLayer", "esri/layers/ArcGISDynamicMapServiceLayer", "esri/layers/LayerDrawingOptions", "esri/renderers/SimpleRenderer", "esri/SnappingManager", "esri/sniff", "esri/SpatialReference", "esri/symbols/SimpleFillSymbol", "esri/symbols/SimpleLineSymbol", "esri/symbols/SimpleMarkerSymbol", "esri/tasks/GeometryService", "esri/tasks/ProjectParameters", "dojo/dom", "dojo/keys", "dojo/on", "dojo/parser", "dojo/query", "dojo/_base/Color", "dijit/layout/BorderContainer", "dijit/layout/ContentPane", "dijit/TitlePane", "dijit/form/CheckBox", "dojo/domReady!" ], function (Map, esriConfig, Color, Geocoder, HomeButton, LocateButton, Measurement, OverviewMap, Scalebar, Extent, Point, screenUtils, Graphic, ArgGISTiledMapServiceLayer, ArcGISDynamicMapServiceLayer, LayerDrawingOptions, SimpleRenderer, SnappingManager, has, SpatialReference, SimpleFillSymbol, SimpleLineSymbol, SimpleMarkerSymbol, GeometryService, ProjectParameters, dom, keys, on, parser, query, Color ) { parser.parse(); // set custom extent var initialExtent = new Extent({ "xmin": 777229.03, "ymin": 1133467.92, "xmax": 848340.14, "ymax": 1185634.58, "spatialReference": { "wkid": 3435 } }); // create map and set slider style to small map = new Map("mapDiv", { showAttribution: false, sliderStyle: "small", extent: initialExtent }); // add imagery var tiled = new ArgGISTiledMapServiceLayer("http://maps.decaturil.gov/arcgis/rest/services/Aerial_2014_Tiled/MapServer"); map.addLayer(tiled); // add operational layer var operationalLayer = new ArcGISDynamicMapServiceLayer("http://maps.decaturil.gov/arcgis/rest/services/Public/InternetVector/MapServer", { "opacity": 0.5 }); map.addLayer(operationalLayer); // declare geometry service esriConfig.defaults.geometryService = new GeometryService("http://maps.decaturil.gov/arcgis/rest/services/Utilities/Geometry/GeometryServer"); // begin geocoder var geocoder = new Geocoder({ arcgisGeocoder: false, geocoders: [{ url: "http://maps.decaturil.gov/arcgis/rest/services/Public/WebAddressLocator/GeocodeServer", name: "Web Address Locator", placeholder: "Find address", outFields: "*" }], map: map, autoComplete: true, zoomScale: 600 }, dom.byId("search")); geocoder.startup(); geocoder.on("select", showGeocodeLocation); function showGeocodeLocation(evt) { map.graphics.clear(); var point = evt.result.feature.geometry; var symbol = new SimpleMarkerSymbol() .setStyle("square") .setColor([255, 0, 0, 0.5]); var graphic = new Graphic(point, symbol); map.graphics.add(graphic); map.infoWindow.setTitle("Search Result"); map.infoWindow.setContent(evt.result.name); map.infoWindow.show(evt.result.feature.geometry); map.infoWindow.on('hide', function () { map.graphics.clear(); }); } // end geocoder // geolocation functionality starts here map.on("load", initFunc); function orientationChanged() { if (map) { map.reposition(); map.resize(); } } function initFunc(map) { if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(zoomToLocation, locationError); watchId = navigator.geolocation.watchPosition(showLocation, locationError); } else { alert("Browser doesn't support Geolocation. Visit http://caniuse.com to see browser support for the Geolocation API."); } } function locationError(error) { //error occurred so stop watchPosition if (navigator.geolocation) { navigator.geolocation.clearWatch(watchId); } switch (error.code) { case error.PERMISSION_DENIED: alert("Location not provided"); break; case error.POSITION_UNAVAILABLE: alert("Current location not available"); break; case error.TIMEOUT: alert("Timeout"); break; default: alert("unknown error"); break; } } function zoomToLocation(location) { var geopt = new Point(location.coords.longitude, location.coords.latitude); var params = new ProjectParameters(); params.geometries = [geopt]; params.outSR = new SpatialReference(3435); params.transformation = 108190; params.transformForward = true; esriConfig.defaults.geometryService.project(params, function (projectedPoints) { pt = projectedPoints[0]; addGraphic(pt); map.centerAndZoom(pt, 12); }); } // WGS_1984_(ITRF00)_To_NAD_1983 uses the WKID of 108190 - information here: http://downloads2.esri.com/support/TechArticles/Geographic_Transformations_10.1.zip function showLocation(location) { //zoom to the users location and add a graphic var geopt = new Point(location.coords.longitude, location.coords.latitude); var params = new ProjectParameters(); params.geometries = [geopt]; params.outSR = new SpatialReference(3435); params.transformation = 108190; params.transformForward = true; esriConfig.defaults.geometryService.project(params, function (projectedPoints) { pt = projectedPoints[0]; if (!graphic) { addGraphic(pt); } else { // move the graphic if it already exists graphic.setGeometry(pt); } map.centerAt(pt); }); } function addGraphic(pt) { var symbol = new SimpleMarkerSymbol( SimpleMarkerSymbol.STYLE_CIRCLE, 12, new SimpleLineSymbol( SimpleLineSymbol.STYLE_SOLID, new Color([210, 105, 30, 0.5]), 8 ), new Color([210, 105, 30, 0.9]) ); graphic = new Graphic(pt, symbol); map.graphics.add(graphic); } // geolocation functionality ends here // add home button to get full extent var home = new HomeButton({ map: map }, "HomeButton"); home.startup(); // add overview map var overviewMapDijit = new OverviewMap({ map: map, visible: false }); overviewMapDijit.startup(); // scalebar var scalebar = new Scalebar({ map: map, scalebarUnit: "dual" }); // start measurement tool - the current layer we are measuring is the operational layer var layerDrawingOptions = []; var layerDrawingOption = new LayerDrawingOptions(); var sfs = new SimpleFillSymbol( "solid", new SimpleLineSymbol("solid", new Color([195, 176, 23]), 2), null ); layerDrawingOption.renderer = new SimpleRenderer(sfs); // change 1 to the layer index that you want to modify: layerDrawingOptions[1] = layerDrawingOption; //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: operationalLayer }]; snapManager.setLayerInfos(layerInfos); var measurement = new Measurement({ map: map }, dom.byId("measurementDiv")); measurement.startup(); // end measurement tool // add geolocate button to find the location of the current user geoLocate = new LocateButton({ map: map, highlightLocation: true, useTracking: true, enableHighAccuracy: true }, "LocateButton"); geoLocate.clearOnTrackingStop = true; geoLocate.startup(); }); </script> </head> <body onorientationchange="orientationChanged() class="soria"> <div id="mapDiv"> <div id="HomeButton"></div> <div id="LocateButton"></div> <div id="search"></div> <div id="titlePane" data-dojo-type="dijit/TitlePane" data-dojo-props="title:' Measurement', closeable:false,open:false"> <div id="measurementDiv"></div> <span style="font-size:smaller;padding:5px 5px;">Press <b>CTRL</b> to enable snapping.</span> </div> </div> </body> </html>
... View more
11-20-2014
02:04 PM
|
0
|
10
|
1564
|
POST
|
Yes, I got the requires aligned and realized the soria weren't referenced when the arrows weren't in my widget. Can't believe I didn't update my CSS.
... View more
11-20-2014
12:58 PM
|
0
|
0
|
643
|
POST
|
Your updated code worked. I just needed to move my dojo require statements above the dijits to line up with the declarations in the function.
... View more
11-20-2014
12:28 PM
|
0
|
0
|
970
|
POST
|
Never mind. I got this one figured out. I don't need a feature service. My dynamic service is now working.
... View more
11-20-2014
12:26 PM
|
0
|
2
|
643
|
POST
|
I was having trouble figuring out how to make the measurement example with a dynamic map service work, so I tried publishing a feature service and using it like a dynamic map service. Apparently that won't work. I tried this because I had not gotten a response on how to make the dynamic map service work. Here is my code using a dynamic map service: <!DOCTYPE html> <html> <head> <title>Create a Map</title> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta name="viewport" content="initial-scale=1,maximum-scale=1, user-scalable=no"> <link rel="stylesheet" href="http://js.arcgis.com/3.11/dijit/themes/claro/claro.css"> <link rel="stylesheet" href="http://js.arcgis.com/3.11/esri/css/esri.css"> <style> html, body, #mapDiv { padding:0; margin:0; height:100%; width:100%; } #titlePane { width:240px; position:absolute; right:20px; top:10px; z-index:999; } .soria .dijitTitlePaneTitle { background: #fff; font-weight:600; border: none; border-bottom:solid 1px #29201A; border-top:solid 1px #29201A; } .soria .dijitTitlePaneTitleHover { background:#eee; } .soria .dijitTitlePaneTitleActive { background:#808775; } .soria .dijitTitlePaneContentOuter { border-right: none; border-bottom: none; border-left: none; } </style> <script src="http://js.arcgis.com/3.11/"></script> <script> var map; require(["esri/map", "esri/config", "dojo/parser", "esri/renderers/SimpleRenderer", "esri/Color", "esri/dijit/Measurement", "esri/dijit/Scalebar", "esri/geometry/Extent", "esri/layers/ArcGISDynamicMapServiceLayer", "esri/layers/ArcGISTiledMapServiceLayer", "esri/layers/LayerDrawingOptions", "esri/SnappingManager", "esri/sniff", "esri/symbols/SimpleFillSymbol", "esri/symbols/SimpleLineSymbol", "esri/tasks/GeometryService", "dijit/layout/BorderContainer", "dijit/layout/ContentPane", "dijit/form/CheckBox", "dijit/TitlePane", "dojo/dom", "dojo/keys", "dojo/on", "dojo/domReady!"], function (Map, esriConfig, parser, SimpleRenderer, Color, Measurement, Scalebar, Extent, ArcGISDynamicMapServiceLayer, ArcGISTiledMapServiceLayer, LayerDrawingOptions, SnappingManager, has, SimpleFillSymbol, SimpleLineSymbol, GeometryService, dom, keys, on ) { parser.parse(); // set custom extent var initialExtent = new Extent({ "xmin": 777229.03, "ymin": 1133467.92, "xmax": 848340.14, "ymax": 1185634.58, "spatialReference": { "wkid": 3435 } }); // create map and set slider style to small map = new Map("mapDiv", { showAttribution: false, sliderStyle: "small", extent: initialExtent }); // add imagery var tiled = new ArcGISTiledMapServiceLayer("http://maps.decaturil.gov/arcgis/rest/services/Aerial_2014_Tiled/MapServer"); map.addLayer(tiled); // set operational layers var operationalLayer = new ArcGISDynamicMapServiceLayer("http://maps.decaturil.gov/arcgis/rest/services/Public/InternetVector/MapServer", { "opacity": 0.5 }); // add operational layers map.addLayer(operationalLayer); // declare geometry service esriConfig.defaults.geometryService = new GeometryService("http://maps.decaturil.gov/arcgis/rest/services/Utilities/Geometry/GeometryServer"); // start measurement tool - the current layer we are measuring is the operational layer // error follows this line var layerDrawingOptions = []; var layerDrawingOption = new LayerDrawingOptions(); var sfs = new SimpleFillSymbol( "solid", new SimpleLineSymbol("solid", new Color([195, 176, 23]), 2), null ); layerDrawingOption.renderer = new SimpleRenderer(sfs); // change 1 to the layer index that you want to modify: layerDrawingOptions[1] = layerDrawingOption; dynamicData.setLayerDrawingOptions(layerDrawingOptions); //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: operationalLayer }]; snapManager.setLayerInfos(layerInfos); var measurement = new Measurement({ map: map }, dom.byId("measurementDiv")); measurement.startup(); // end measurement tool } ); </script> </head> <body class="soria"> <div id="mapDiv"></div> <div id="titlePane" data-dojo-type="dijit/TitlePane" data-dojo-props="title:'Measurement', closeable:'false',open:'false'"> <div id="measurementDiv"></div> <span style="font-size:smaller;padding:5px 5px;">Press <b>CTRL</b> to enable snapping.</span> </div> </body> </html>
... View more
11-20-2014
12:00 PM
|
0
|
0
|
643
|
POST
|
I have a Feature Service create here: http://maps.decaturil.gov/arcgis/rest/services/IvFeature/FeatureServer And I wanted to add it to my map. But based on the documentation, it looks like I can only add one feature layer at a time. Is this correct?
... View more
11-20-2014
11:38 AM
|
0
|
5
|
2365
|
Title | Kudos | Posted |
---|---|---|
1 | 02-26-2015 12:31 PM | |
1 | 06-24-2015 06:06 AM | |
1 | 07-15-2015 12:34 PM | |
1 | 05-21-2015 02:27 PM | |
1 | 05-19-2015 11:52 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|