POST
|
Evelyn, Are you wanting a tool where you can zoom to a specific scale on the map? It would be nice is this was a widget. We built a tool where you can enter in the scale (in feet) and it will zoom to that scale on the map. The current zoom scale in feet will update as well on the map when you perform a zoom in or out. It looks something like this: When zooming again: Then when zooming out: Now the entire Zoom to Scale tool: You can then type in the scale: The map will zoom to that scale: Here is the code block used: Javascript // Map - Define Scale mapView.scale = 96000; console.log("The initial map scale is 1:" + mapView.scale); var scaleInFeet = mapView.scale/12 // Watch for the Scale on the Extent Change mapView.watch('extent', function(){ var convertMapScale = mapView.scale/12; var roundScale = Math.round(convertMapScale); returnZoomScaleResult = document.getElementById("zoomToScaleResults"); returnZoomScaleResult.innerHTML = roundScale + " feet"; }); // Connect Zoom to Scale Button to Function on(dom.byId("zoomToScaleBtn"), "click", zoomToScale); // Zoom to Map Scale Function function zoomToScale() { // If no value is added in if (document.getElementById("zoomToScaleValue").value=="") { // Alert when Scale Value is left Blank enterScaleDialog = new Dialog({ title: "Zoom to Scale", content: "You must enter a zoom to scale value then hit enter or use the magnifying glass. Example: 1000, 2000, or 5000. All units are in feet.", style: "width: 300px; height: 150px;" }); enterScaleDialog.show(); } else { var zoom = document.getElementById("zoomToScaleValue").value*12; mapView.scale = zoom; var mapScaleInFeet = zoom/12; } console.log("ZOOM TO SCALE: The zoom level is 1:" + zoom + "."); console.log("ZOOM TO SCALE: The zoom scale in feet is 1 inch = " + mapScaleInFeet + " feet.") } HTML Zoom to Scale Input Box and Button Map Toolbar DIV (HTML) <div id="mapViewToolHeaderDIV"> <!-- Zoom to Scale Tool Title --> <div id="zoomToScaleToolTitle"><center>Zoom to Scale</center></div> <!-- Zoom to Scale Tool DIV --> <div id="zoomToScaleDIV"> <!-- Zoom to Scale Tool - Text Input --> <input type="search" id="zoomToScaleValue" placeholder=" Zoom to Scale: 1 inch = Feet" onkeypress="if (event.keyCode == 13) document.getElementById('zoomToScaleBtn').click()"/> <!-- Zoom to Scale Tool - Button (to Execute)--> <div id="zoomToScaleBtn"> <div id="zoomToScaleBtnText"><center>Go</center></div> </div> </div> Zoom to Scale Results on Map (HTML) <div id="zoomToScaleFrame"> <!-- Zoom to Scale Map Scale Title --> <div id="zoomToScaleTitle">1 inch =</div> <!-- Zoom to Scale Value --> <div id="zoomToScaleResults"></div> </div> CSS #zoomToScaleFrame{ z-index: 2; position: absolute; width: 150px; left: 10px; bottom: 32px; height: 17px; border: 1px solid none; font-size: 10pt; background-color: white; } #zoomToScaleTitle{ z-index: 2; margin-left: 1px; margin-top: 1px; height: 11px; width: 43px; font-family: arial; font-size: 8pt; color: black; } #zoomToScaleResults{ margin-left: 44px; margin-top: -11px; width: 70px; height: 11px; font-family: arial; font-size: 8pt; color: black; } /* Zoom to Scale - Tool Title */ #zoomToScaleToolTitle{ z-index: 2; position: absolute; top: 0px; line-height: 1; left: 8px; height: 10px; font-size: 10pt; font-weight: bold; color: white; width: 235px; /* Make Text Unselectable */ -moz-user-select: none; -khtml-user-select: none; -webkit-user-select: none; -o-user-select: none; } #zoomToScaleDIV{ position: absolute; padding: 0; margin: 0; right: 0px; bottom: 1px; left: 8px; height: 35px; width: 235px; } /* Zoom to Scale Tool - Text Input */ #zoomToScaleValue{ position: absolute; padding: 0; margin: 0; right: 0px; top: 1px; left: 2px; height: 30px; width: 180px; } /* Zoom to Scale Tool - Button (to Execute) */ #zoomToScaleBtn{ position: absolute; padding: 0; margin: 0; right: 0px; top: 1px; left: 190px; height: 30px; width: 30px; border-radius: 4px; background-color: #EEEEEE; /* Make Text Unselectable */ -moz-user-select: none; -khtml-user-select: none; -webkit-user-select: none; -o-user-select: none; } /* Zoom to Scale Tool - Button Text */ #zoomToScaleBtnText{ position: absolute; padding: 0; margin: 0; right: 2px; top: 5px; left: 2px; bottom: 2px; font-size: 11pt; font-weight: bold; } This tool has worked really well for us. May give you some ideas. Ian Peebles, GISP GIS Analyst II Application Support Team – Information Technology 1273 N Broadway, Edmond, OK 73034 (405) 359-4561
... View more
04-01-2022
05:53 AM
|
1
|
0
|
1054
|
POST
|
Hello everyone. I am currently exploring the JavaScript 4x environment and interested in starting the conversion of apps from 3x. In the feature form, is it possible or has anyone been able to create a choice list without having to rely on domain values? If so, how would this be done? For example a Status field: The current choice list exists only because of an assigned domain to the field. I am wanting to avoid this if I can. Can this be done? Thank you!
... View more
07-19-2021
02:12 PM
|
0
|
1
|
711
|
POST
|
Here is what I came up with to set the map scale when using the choice list: Choice List from Application: JavaScript Code: HTML Code: When choosing the option, then the mouse is up, the zoom to scale will execute. The map changes zoom. I added console statements to track the changing map scale. Here are examples of those that returned in the console.log: For 1000 Scale: For 2500 Scale: Will something like that work? I don't think the map scale will change on the print layout. We use a zoom tool where you type in the scale and then a zoom occurs on the map. When we go to print the layout, the map scale is preserved.
... View more
12-23-2020
07:15 AM
|
0
|
1
|
2070
|
POST
|
Hello, we have created a zoom to scale tool within our organization, but we allow for an input box where you can type in the scale, then zoom to it on the map. perhaps you can use similar logic or get an idea from this code snippet I will provide? A Preview of the Zoom the Scale Tool within an Application: The CODE in JS and HTML: // *********************************************************************** // * Zoom to Scale - START * // *********************************************************************** // Execute Zoom to Scale when Button is Clicked on(dom.byId("zoomToScaleBtn"), "click", zoomToScale); // Zoom to Scale Function function zoomToScale () { if (dom.byId("zoomToScaleValue").value == "") { alert("You must enter in a scale value"); } else { // Return Scale Value - Calculation (/12) based on Feet not Meters var scaleValue = (dom.byId("zoomToScaleValue").value)*12; map.setScale(scaleValue); var scaleValueFeet = (scaleValue/12); console.log("The map scale is 1:" + scaleValue); console.log("Map Scale in Feet 1 inch = " + scaleValueFeet + " feet"); } } // Return Map Scale Results to Application - Calculation (/12) based on Feet NOT Meters map.on("zoom-end", function() { var returnZoomResult = document.getElementById("zoomToScaleResults"); var scale = map.getScale()/12; var roundScale = Math.round(scale); returnZoomResult.innerHTML = roundScale + " feet"; }); // *********************************************************************** // * Zoom to Scale - END * // *********************************************************************** <!-- ************************************ --> <!-- * ZOOM TO SCALE * --> <!-- ************************************ --> <div id="zoomToScaleTextBoxFrame"> <input type="search" id="zoomToScaleValue" placeholder="Zoom to Scale (Feet)" onkeypress="if (event.keyCode == 13) document.getElementById('zoomToScaleBtn').click()" /> <button id="zoomToScaleBtn" title="Zoom to Scale"></button> </div> Print layout scale: I am wondering if you can choose the scale within the map first, then run the print task? Or are you wanting to choose the scale when you are initiating the print task?
... View more
12-22-2020
09:49 AM
|
0
|
3
|
2086
|
POST
|
Good morning. Has anyone else noticed the buggy nature of the layer list widget and the legend when working with JavaScript API version 4x? The issue has to do with the symbology changing in the legend when checking on the web service layer in the layer list. When the map loads, the layer list looks good and the legend looks good. If you click on any layers within the layer list, the symbology changes to the incorrect symbology in other map services. I am using the basic out-of-the box JS API settings. My base map layer does have a group layer. I have logged in a bug with ESRI. Here are some screenshot examples: 01. Layer List on Application Load Legend Onload: Now if I toggle back to the layer list, then turn off both web services in the layer list, the symbology will change for the base map service when I toggle back to the legend. ESRI has duplicated this behavior using their data. The behavior is inconsistent. Notice the incorrect symbology for the Base Map service shown below: There are line and polygon features for the base map that show point features from the GPS layer. The LayerList/Legend in JS API 3x has better functionality. Hopefully, other people have encountered this issue. This should be resolved, because having a functioning layer list with legend is crucial for our applications. If the symbology changes, then end users will notice and the application is not functional. Finally, here is the code I use for the layer list widget and legend in the 4x environment: Thank you for the review.
... View more
12-08-2020
05:35 AM
|
0
|
0
|
970
|
POST
|
Hello everyone. Not sure if this has been reported, but I believe I found a bug associated with the Directions widget for the Web App Builder Developer Edition. This was not an issue in Version 2.15, but is an issue in Version 2.16 and 2.17. The Issue: - If the layer list is added, the Direction widget will not allow for typing in an address for the second routing choice. The second option will only allow for typing in one digit and nothing else. If the layer list is removed, the Directions widget will work. Has anyone else reported this issue. A staff member from ESRI was also able to verify the issue. Any known work arounds or a simple way to fix this issue? Thank you!
... View more
08-04-2020
02:44 PM
|
0
|
1
|
838
|
POST
|
Funny I came across this thread because I was looking to change the order of the popups. To my disappointment, I learned it cannot be done. I agree that it would be extremely nice to be able to re-order the popups within a javaScript application. ESRI...can you please consider this functionality? We need more controls on what we can and can not do with popups. Also, allow for easily changing the pixel tolerance on when a user clicks to identify a popup in the mobile environment. Now you have to tap...tap..tap..until you get lucky enough to activate the popup when clicking on a point.
... View more
03-11-2020
09:46 AM
|
8
|
0
|
3997
|
POST
|
Hello everyone! Looking to create a sequential ID number in the advanced data editor form when a new feature is added. For example, if the unique ID (ASSETID) is NULL when added, I want to look at the latest unique ID number assigned (example: 50000), then add a + 1. The unique ID number would be 50001. Here is an example of the data editor form I have put together: In my particular case, a new feature has been added, but I want the Facility ID to be populated with the latest sequential number (based on Facility ID). Is this possible with the 4x API? Any guidance will be greatly appreciated. Thank you! Ian
... View more
02-13-2020
05:28 AM
|
0
|
0
|
573
|
POST
|
Hello Everyone! Looking at the possibility of creating a simple application where a polygon is drawn and then a buffer is produced from the polygon. I already know there is a sample to do this and can make this work. Here is the challenge, I need the polygon to be exact...something like 6 feet x 8 feet or 8 feet x 12 feet and etc. Does the JS API support specifying exact lengths and widths of building a polygon almost like a COGO type tool? From what I have seen, I am not sure this is supported. I need the height and width to be exact. Drawing the polygon is easy, but when needing to specify the exact height and width..this become a challenge. I am wanting to do an application rather than installing ArcGIS Desktop. Has anyone made this work?
... View more
08-23-2019
07:45 AM
|
0
|
0
|
528
|
POST
|
Robert, thank you for the response. Oh... I see. I was checking out the popup wrapper to check, but now that makes sense. I may stick with what I have for the time being. I have used CSS to modify field positions and etc.
... View more
05-09-2019
07:06 AM
|
1
|
0
|
698
|
POST
|
Hello everyone. I have created numerous applications using the InfoTemplate, however, I have been experimenting with some popups. I noticed the API allows for resizing the popup, say 500px by 500px. However, when attempting to use the: popup.resize(500,500); The popup does not resize to this size. The width looks good, but the height does not honor the 500px height. Is there an explanation on why this may not work? I am referring to this sample: https://developers.arcgis.com/javascript/3/sandbox/sandbox.html?sample=popup_relatedrecords Also, here is a screenshot of my results: I may want different sizes of popups for various features. Anyone else have this issue? Does this really work effectively?
... View more
05-09-2019
06:54 AM
|
0
|
2
|
768
|
POST
|
I actually figured out a solution. I used the following .css within the index.htm file: .esri-view-width-xlarge .esri-popup__main-container, .esri-view-width-large .esri-popup__main-container, .esri-view-width-medium .esri-popup__main-container { max-height: 400px !important; max-width: 300px !important; } I had to do this since I was referencing the following .css: <link rel="stylesheet" href="https://js.arcgis.com/4.11/esri/css/main.css"> I was trying to reference the code block above within my own layout.css...but could not overwrite the code specified in the link above. The result is this:
... View more
04-18-2019
12:46 PM
|
5
|
0
|
3699
|
POST
|
Hello everyone. I have successfully configured popups for my application. However, I am wanting to change the height of the popup. By default, the height is around 200px, but I want 300-350px. I used the select elements in the developer tools, but still cannot change the height of the popup. This block of code does not work: .esri-view-width-xlarge .esri-popup__main-container, .esri-view-width-large .esri-popup__main-container, .esri-view-width-medium .esri-popup__main-container { max-height: 300px !important; } The popup remains at this height: Is there a wrapper I am forgetting about? I cannot seem to find the correct element. Any guidance will be appreciated.
... View more
04-18-2019
10:52 AM
|
0
|
2
|
4550
|
POST
|
Hello Robert. I was looking at that widget yesterday and it is really nice, but takes up a little too much real-estate. I really like what I came up with for the app. I do want to get this to work, just so I know it can be done. With that said, I may end up looking at it again and add it as a tool with the measurement widget...perhaps up here (see red box)?
... View more
04-11-2019
11:58 AM
|
0
|
1
|
890
|
Title | Kudos | Posted |
---|---|---|
1 | 04-01-2022 05:53 AM | |
1 | 09-18-2018 06:17 AM | |
1 | 06-19-2018 10:31 AM | |
1 | 05-15-2018 10:42 AM | |
1 | 10-14-2015 03:59 PM |
Online Status |
Offline
|
Date Last Visited |
04-04-2022
06:43 AM
|