Text Formula - Project Location Display (set to Project Location address field)
Short Text - Project Location Extract (set to Project Location text formula field if not identical)
Text Formula - Map Marker Label Display (what fields to display for map marker label)
Text Formula - XY Extract (combined X & Y coordinates trimmed from the Location Extract)
Text Formula - X Extract (X coordinate trimmed from combined XY Extract)
Text Formula - Y Extract (Y coordinate trimmed from combined XY Extract)
Text Formula - Pure X Extract (trims the X Extract to provide a clean coordinate for the Map URL Generator formula)
Text Formula - Pure Y Extract (trims the Y Extract to provide a clean coordinate for the Map URL Generator formula)
Text Formula - Map Marker Modal Display (what text & fields to show on map marker popup)
Text Formula - Map URL Generator (the arcgis web map location with specific attributes)
Link - Map URL (set to the generated Map URL)
Preparing the Location Coordinates (Longitude & Latitude)
XY Extract
We are taking the 23 characters at the end of the Address field that encompass both the X & Y coordinates and setting that data to the field
trim(right({Project Location Extract},23))
X Extract
Here we follow a similar principle as before and take the 12 characters at the end of the XY Extract field to separate out the X coordinate into its own field
trim(right({XY Extract},12))
Y Extract
This time we take the 14 characters at the beginning of the XY Extract field to separate out the Y coordinate into its own field
trim(left({XY Extract},14))
Pure X Extract
For this field we clean up the X coordinate into a usable value for the arcgis web map limiting it down from 12 characters to only 9
trim(right({X Extract},9))
Pure Y Extract
We do the same clean up for the Y coordinate into a usable value for the arcgis web map limiting it down from 14 characters to only 8
trim(right({Y Extract},8))
Generating the Map URL to create a Map Marker on an ArcGIS Web Map
https://austin.maps.arcgis.com/apps/webappviewer/index.html?id=d7894fc5bfad4fd1a58d45a7d24ba5b2&mobileBreakPoint=100&level=13&marker={Pure X Extract};{Pure Y Extract};;{Map Marker Modal Display};;{Map Marker Label Display}
Portal URL: austin.maps.arcgis.com
id= : the unique ID of the app
mobileBreakPoint= : we set this to 100 pixels so the default mobile layout does not apply until screen size is smaller than 100 pixels in either height or width. This ensures our map does not have a scrollbar when we set our maps from 300 to 600 pixels in width and display correctly on desktop.
marker=<x>;<y>;<wkid>;<encoded title>;<encoded icon url>;<encoded label> : we set <x> to our Pure X Extract field, <y> to our Pure Y Extract field, leave the <wkid> identifier blank since we are using the Global Coordinate System (GCS), we set the <encoded title> to our Map Marker Title Display field, we leave the <encoded icon url> blank as the default blue circle icon, and lastly set the <encoded label> to our Map Maker Label Display field
Other Parameters to Note
webmap= : the unique ID of the web map (we use id so we dont use this)
center= : this would allow us to center on a standard set of coordinates (since we have different coordinates for each map marker we do not use this but is an available option)
find= : this would allow us to automatically zoom to the closest match with a callout marker added to the map. We do not use this since we use marker & level parameters but this is another option available that is a bit simpler and more flexible allowing for use of single line addresses, partial addresses, place names, & parcel features in addition to coordinates
Preparing Knack Scene & View for Map (HTML iframe)
First we need a page setup with a Rich Text view, this is where our iframe HTML code will live. We do a pretty basic setup for our iframe but this HTML within the view can be customized for each specific map.
src= : we leave blank since we are using a defined map id from our JavaScript code and do not need to set the source explicitly
id= : we set this id to the name we are giving the map as represented in our JavaScript handler
style= : here we set border thickness and color around the map
name= : the name we are giving to this map, we set this identical to the id
scrolling= : we set this to no to improve map usability for smaller maps
marginheight= & marginwidth= : we set these both to 0px since we dont need the extra frame space outside the map
allowfullscreen= : we leave this blank since we are setting a defined size for the map
frameborder= : similar to margin, we have no need for border in this example but is an available option
width= : this we set to 100% to span the entire width of the page to take advantage of the desktop widescreen
height= : this we set to specifically to 500px the prevent the map from being to big
Other good ratios for map displays within a page are 100x100px thumbnail maps, 300x400px small scale maps, 500x500px standard maps, or 600x900px large widescreen maps.
Rendering the Map URL in the iframe with JavaScript
This JS code can be copied and updated for your particular map. You will need a code block for each Knack view we are displaying the map in. In the handler, we need to update the scene and view IDs. We also give the map a name that we indicate in the iframe code.
/*Feature Map Page*/$(document).on("knack-scene-render.scene_294",function (event, page) {// update iframe src with Mitigation Map URL in the Detail Viewvar iframe_url =$($("span:contains('apps/webappviewer')")[0]).text()$("#mitigationMapiFrame").attr("src", iframe_url);// hide the Mitigation Map URL field & view$("#view_967").hide();});
Additional Link
After completing the above setup, one more thing can help users. We can provide a Link below the rendered map so that users can navigate to the map in a new tab to view in ArcGIS Online. You would update the link with the appropriate map url.
<atarget="_blank"href="https://arcg.is/1ODubj0">Open Map in ArcGIS Online</a>