|
POST
|
Hi Robert, I would also like to change the text of the button onclick using css. This is what I have: CSS: #togglebasemap { position: absolute; visibility: visible; } #togglebasemap: :after { content:'Vector'; visibility: visible; } HTML: <button id="togglebasemap" data-dojo-type="dijit/form/Button" type="button">Aerial</button> It does not work. Is something wrong? Is this the best way if I get it to work or is this not the best way? Brandon
... View more
12-15-2017
02:59 PM
|
0
|
4
|
1363
|
|
POST
|
Hi Nathan, Thanks for the sample. This is great material to work with. I am going mull over this for a bit and get back to this thread with the my final code. I don't have a div id=map. I am using a regular tabbed story map series downloaded from ArcGIS Online. Are you maybe using a hybrid story of some sort? Was yours downloaded off github or Agol? -Brandon
... View more
12-15-2017
02:53 PM
|
0
|
2
|
1241
|
|
POST
|
var vectorTileLayer = new VectorTileLayer({ styleUrl: "https://www.arcgis.com/sharing/rest/content/items/0e0aa048cb9a42de91ae287fc5632fac/resources/styles/root.json", type: "VectorTileLayer" }); var vectorBasemap = new Basemap({ layers: [vectorTileLayer], title: "Vector", thumbnailUrl: "https://caltrans.maps.arcgis.com/sharing/rest/content/items/0e0aa048cb9a42de91ae287fc5632fac/info/thumbnail/ago_downloaded.jpg?token=Do3lEzHoScB93459ECsBMPuBbLDp0fJwag_zLpoByDyG_2YYO3kPw9PnT1b-3b24k-RitFx8ge4QNwuCCF6Rv0k9RL0ptRqR2fVw-7wHkY2zSPYti3QFtohzW_V3PNeIKHc9rpUID0Jj8v1JDnbi_0O_voZLqO71vV7dV9WEsgWZO_5levlM1esCrZZdh4ebF_MakjfSB2FAeyB9YJeB7A.." }); var imageryLayer = new BasemapLayer({ url: "http://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer" }); var imageryBasemap = new Basemap({ layers: [imageryLayer], title: "Satellite", thumbnailUrl: "http://www.arcgis.com/sharing/rest/content/items/413fd05bbd7342f5991d5ec96f4f8b18/info/thumbnail/imagery_labels.jpg" }); var basemapGallery = new BasemapGallery({ map: app.map, basemaps: [imageryBasemap], showArcGISBasemaps: false }, "basemapGallery"); basemapGallery.on("selection-change", function () { if (basemapGallery.basemaps[0] === vectorBasemap) { basemapGallery.remove(vectorBasemap.id); basemapGallery.add(imageryBasemap); } else if (basemapGallery.basemaps[0] === imageryBasemap) { basemapGallery.remove(imageryBasemap.id); basemapGallery.add(vectorBasemap); }; }); basemapGallery.startup(); This is what I have for the script (AMD not include). Does this look right? Is the css and html tricky? Brandon
... View more
12-15-2017
12:54 AM
|
0
|
4
|
1241
|
|
POST
|
The toggle only seems to fire within each map instance. The button is basically removing off the [0] layer set in each web map and then creating a new tiled layer which is added to the map.
... View more
12-14-2017
11:37 PM
|
0
|
0
|
1241
|
|
POST
|
This is what I have: var togglebasemap = dom.byId("togglebasemap"); on(togglebasemap, "click", function () { var baseLyr = app.map.getLayer(app.map.layerIds[0]); if(baseLyr.url === "https://www.arcgis.com/sharing/rest/content/items/0e0aa048cb9a42de91ae287fc5632fac/resources/styles/root.json"){ app.map.removeLayer(baseLyr); var tiled = new ArcGISTiledMapServiceLayer("http://public.gis.lacounty.gov/public/rest/services/LACounty_Cache/LACounty_Base/MapServer"); app.map.addLayer(tiled, 0); } else if(baseLyr.url === "http://public.gis.lacounty.gov/public/rest/services/LACounty_Cache/LACounty_Base/MapServer"){ app.map.removeLayer(baseLyr); var vectorTileLayer = new VectorTileLayer("http://www.arcgis.com/sharing/rest/content/items/0e0aa048cb9a42de91ae287fc5632fac/resources/styles/root.json"); app.map.addLayer(vectorTileLayer, 0); } }); This works for now. I will repost the new script if I make changes. Brandon
... View more
12-14-2017
10:38 PM
|
0
|
7
|
1363
|
|
POST
|
Hi Nathan, I am using a dojo button to call from with the id "toggle basemap" in the html for my script: var togglebasemap = dom.byId("togglebasemap"); on(togglebasemap, "click", function () { var baseLyr = app.map.getLayer(app.map.layerIds[0]); if(baseLyr.url === "https://www.arcgis.com/sharing/rest/content/items/0e0aa048cb9a42de91ae287fc5632fac/resources/styles/root.json"){ app.map.removeLayer(baseLyr); var tiled = new ArcGISTiledMapServiceLayer("http://public.gis.lacounty.gov/public/rest/services/LACounty_Cache/LACounty_Base/MapServer"); app.map.addLayer(tiled, 0); } else if(baseLyr.url === "http://public.gis.lacounty.gov/public/rest/services/LACounty_Cache/LACounty_Base/MapServer"){ app.map.removeLayer(baseLyr); var vectorTileLayer = new VectorTileLayer("http://www.arcgis.com/sharing/rest/content/items/0e0aa048cb9a42de91ae287fc5632fac/resources/styles/root.json"); app.map.addLayer(vectorTileLayer, 0); } }); The bottom part seems off maybe. Brandon
... View more
12-14-2017
10:11 PM
|
0
|
0
|
1241
|
|
POST
|
I figured out what the problem was. I doubled up on my css. I had css in my html body I forgot to delete after I added css to the style part of my html.
... View more
12-14-2017
08:08 PM
|
0
|
0
|
1121
|
|
POST
|
Hey Nathan, I have been trying to figure out how to get the basemap to stay put when it switches tabs. My toggle resets to the original basemap that loads at start whenever the tabs are switched. Thanks a lot for the help so far. I went with an approach similar to yours above that had a button instead of a basemap widget. Brandon
... View more
12-14-2017
08:04 PM
|
0
|
8
|
1851
|
|
POST
|
Thanks for the example. I am not sure what part of mine was incorrect. Something with the css was off though. I was able to get it to work using the css provided above. -Brandon
... View more
12-14-2017
07:45 PM
|
0
|
0
|
1121
|
|
POST
|
Hi Robert, The button shows up in the map, but the click event does not fire. I tested this yesterday: var myButton5 = dom.byId("togglebasemap"); on(myButton5, "click", function () { alert("Hello! I am an alert box!!"); } }); and got an alert message. The basemap script does not work nor does it fire on the other hand.
... View more
12-14-2017
10:14 AM
|
0
|
9
|
1363
|
|
POST
|
Hello, I would like to make my show x,y script I got from ArcGIS API for JavaScript Sandbox media responsive. I want it centered at all times. I also want the x,y raised to 50px when the screen size is less than 768px. I have not been able to do this. This is what I have: CSS: @media screen and (max-width: 768px) { #xy { position: absolute; l eft:5px !important; bottom: 70px; } } HTML: <div id="xy"> <i>Lat/Long: </i><span id="coordInfo"></span> <i>(DD)</i> </div> Script: function showCoordinates(evt) { //the map is in web mercator but display coordinates in geographic (lat, long) var mp = webMercatorUtils.webMercatorToGeographic(evt.mapPoint); //display mouse coordinates dom.byId("coordInfo").innerHTML = mp.x.toFixed(3) + ", " + mp.y.toFixed(3); }; // The application is ready topic.subscribe("tpl-ready", function(){ app.map.on("mouse-move", showCoordinates); app.map.on("mouse-drag", showCoordinates); Any suggestions appreciated. Thanks, Brandon
... View more
12-14-2017
09:14 AM
|
0
|
4
|
1317
|
|
POST
|
Hi Robert, Unfortunately no. I have used part of your script example. I believe I almost have it. This is what I have: AMD: require(["dojo/topic", "dijit/Dialog", "dojo/dom-style", "dojo/dom", "dijit/form/Button", "dojo/on", "dijit/registry", "esri/map", "esri/layers/VectorTileLayer", "dojo/domReady!"] Function: function (topic, Dialog, domStyle, dom, Button, on, registry, Map, VectorTileLayer) { Script: var myButton5 = dom.byId("togglebasemap"); on(myButton5, "click", function () { var baseLyr = map.getLayer(map.layerIds[0]); if(baseLyr.url === "https://www.arcgis.com/sharing/rest/content/items/0e0aa048cb9a42de91ae287fc5632fac/resources/styles/root.json"){ map.removeLayer(baseLyr); var vectorTileLayer = new VectorTileLayer("http://www.arcgis.com/sharing/rest/content/items/e19e9330bf08490ca8353d76b5e2e658/resources/styles/root.json"); map.addLayer(vectorTileLayer, 0); } else if(baseLyr.url === "http://www.arcgis.com/sharing/rest/content/items/e19e9330bf08490ca8353d76b5e2e658/resources/styles/root.json" || "http://public.gis.lacounty.gov/public/rest/services/LACounty_Cache/LACounty_Base/MapServer"){ map.removeLayer(baseLyr); var vectorTileLayer2 = new VectorTileLayer("http://www.arcgis.com/sharing/rest/content/items/0e0aa048cb9a42de91ae287fc5632fac/resources/styles/root.json"); map.addLayer(vectorTileLayer2, 0); } }, }); }); HTML: <button id="togglebasemap" data-dojo-type="dijit/form/Button" type="button" style="font-size:11px;">Basemap Toggle</button>
... View more
12-14-2017
08:42 AM
|
0
|
11
|
1363
|
|
POST
|
Thanks Robert. Can anything be done to improve the slow connectivity in terms of the web appbuilder developer script? Or is just that the computer I am using slow?
... View more
12-09-2017
01:24 PM
|
0
|
1
|
856
|
|
POST
|
Is there a way to declaratively create this button rather than programmatically?
... View more
12-08-2017
10:26 AM
|
0
|
13
|
3746
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 10-06-2017 08:25 AM | |
| 1 | 01-05-2018 10:12 AM | |
| 1 | 01-09-2018 10:27 AM | |
| 1 | 01-05-2018 07:36 AM | |
| 1 | 10-03-2017 10:23 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:25 AM
|