HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
Any URLs added here will be added as <link>
s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
You can also link to another Pen here (use the .css
URL Extension) and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, use the appropriate URL Extension and we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
Any URL's added here will be added as <script>
s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
Search for and use JavaScript packages from npm here. By selecting a package, an import
statement will be added to the top of the JavaScript editor for this package.
Using packages here is powered by esm.sh, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ESM usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=EDGE,IE=EmulateIE11" />
<meta charset="utf-8">
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-density-dpi=device-dpi" />
<title>INTERNAL ECJ MAP</title>
<link href="https://fonts.googleapis.com/css?family=Archivo+Black" rel="stylesheet">
<link rel="stylesheet" href="https://js.arcgis.com/4.17/esri/css/main.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="mapcss/main.css">
<!-- <link rel="icon" type="image/png" href="http://webgisrv/webmap/imgs/gis_logo.png">-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.0.3/socket.io.js"></script>
<script>
var dojoConfig = {
has: {
"esri-featurelayer-webgl": 1,
"esri-promise-compatibility": 1
}
};
</script>
<script src="https://js.arcgis.com/4.17/"></script>
<!-- <script src="https://js.arcgis.com/4.11/"></script>-->
<script src="mapjs/cookieMonster.js?version=1.3"></script>
<script src="mapjs/propsMap.js"></script>
<script src="mapjs/basicMap.js?version=1.5"></script>
</head>
<body>
<!-- TITLE PANEL -->
<div id="top-band">
<nav>
<div class="top-nav">
<ul >
<li><a href="http://www.ecj.com.jm/">ECJ Home</a></li>
<li><a href="contact.html">Contact Us</a></li>
<li><a href="https://ecj.com.jm/about-the-ecj/about/">About</a></li>
<li><a href="help.html">Help</a></li>
<!-- <li><a href="#">Run Tour</a></li>-->
<li><a href="#" id="search-top-init">Search</a></li>
</ul>
</div>
</nav>
<!-- LOGO -->
<div id="logo-container">
<div class="fl">
<img id="logo-img" src="mapimg/logo.png" width="60px" height="60px" >
</div>
<div id="logo-text" class="fl">
<span>Electoral Commission of Jamaica</span>
<br>
<span id="logo-text-sub">Ensuring elections are free and fair</span>
</div>
</div>
<!-- END LOGO -->
<!-- MAP TITLE -->
<div id="top-title">ECJ WEB MAP v2.0</div>
<!-- RIGHT CONTENT -->
<div id="top-band-right-content" class="fr">
<input id="top-band-search" name="search-box" placeholder="Constituency/Parish search" title="Enter search text here"/>
<br>
<button id="top-band-search-btn" title="Perform search">Search</button>
<button id="top-band-reset-btn" title="Reset map layers">Reset Map</button>
</div>
<!-- END RIGHT CONTENT -->
</div>
<!-- SLIDE OUT FROM LEFT -->
<div id="data-search-results-container" isOpen="false">
<img src="mapimg/ic-delete.png" id="close-results" width="10%" title="Close results window" />
<div id="data-search-results-content">
<div id="data-search-results-info"></div>
<div id="data-search-results-list">
<ul>
</ul>
</div>
</div>
<div id="data-search-results-controls"></div>
</div>
<!-- END SLIDE OUT FROM LEFT -->
<!-- MAP ELEMENT -->
<div id="mapView"></div>
<img id="compass-img" src="mapimg/compass.png" >
<div id="topbar">
<button
class="action-button esri-icon-measure-line"
id="distanceButton"
type="button"
title="Measure distance between two or more points"
></button>
<button
class="action-button esri-icon-measure-area"
id="areaButton"
type="button"
title="Measure area"
></button>
</div>
<!--LOADING BAR CONTAINER --
<div id="loading-bar">
<img src="mapimg/loading_bar.gif" />
<center>Loading...</center>
</div>
<!-- LOADING BAR -->
<!-- END MAP ELEMENT -->
<!-- POPUP BLOCK -->
<!-- END POPUP BLOCK -->
<!-- MAP ELEMENT -->
<!-- MAP CONTROLS -
<div id="map-controls-container">
<span class="map-control zoom-in" title="Zoom In"><i class="fa fa-search-plus" aria-hidden="true"></i></span>
<span class="map-control zoom-out" title="Zoom Out"><i class="fa fa-search-minus" aria-hidden="true"></i></span>
</div>
<!-- END MAP CONTROLS -->
<!-- BOTTOM BAND -->
<div id="bottom-band">
<hr class="divider-line" isOpen="true">
<!-- LEFT -->
<div id="bottom-band-left" class="fl">
<h2>LEGEND</h2>
<!-- LEGEND -->
<div class="legend-container" style="margin-top:4px;">
<div id="const" ><img src="mapimg/parish_boundary2.jpg" class="legend-icons"/></div>
<div id="parish" ><img src="mapimg/cons_boundary.png" class="legend-icons"/></div>
<div id="parish" ><img src="mapimg/anamolies.jpg" class="legend-icons"/></div>
<div id="office" ><img src="mapimg/office.PNG" class="legend-icons"/></div>
<!-- <div id="const" ><img src="mapimg/ed_boundary.png" class="legend-icons"/></div> -->
</div>
<div class="legend-container" style="margin-top:10px;">
<div class="legend-text" style="margin-bottom:5px;"> Parish Boundary</div>
<div class="legend-text"> Constituency Boundary</div>
<div class="legend-text"> Area Anamolies</div>
<div class="legend-text"> Administrative Offices</div>
<!-- <div class="legend-text"> Electoral Division Division</div> -->
</div>
<!-- END LEGEND -->
</div>
<!-- CENTER -->
<div id="bottom-band-center" class="fl">
<!--div id="minimize-bottom-bar"><i class="fa show fa-chevron-down"></i></div-->
<div id="map-position">Scale </div>
<div id="bottom-band-disclaim-mobile"><a href="disclaimer.html" target="_blank">Read the disclaimer</a></div>
<div id="bottom-band-disclaim">
<p>
<strong>Disclaimer</strong>: This data provided should not be used commercially or redistributed. The EOJ makes no representation or warranty of any kind, either expressed or implied, in fact or in law with respect to the accuracy, completeness and appropriateness of the information provided in this map.
Also the EOJ shall not be responsible for any action, cost or liability whatsoever arising from the reliance on or use of the information provided. While the EOJ cannot guarantee 100% accuracy with respect to the information shown in this map,
kindly note that where possible all the appropriate quality controls have been duly undertaken in the compilation of the information provided.
<!--span><a href="#" id="more-disclaim" title="Click to see more">more...</a></span-->
</p>
<p><strong>RE: Area Anamolies</strong>. The electoral boundaries displayed in this map contain constitutional breaches that are pending approval.</p>
</div>
</div>
<!-- RIGHT -->
<div id="bottom-band-right" class="fr">
</div>
</div>
<!-- EOJ devs @work | @_@ | ^_^ | d(o_o)b | music + coffee alone -->
</body>
</html>
body,html{
min-width: 1024px;
height: 100%;
overflow: hidden;
font-family: 'Raleway', sans-serif;
max-height: 100%;
margin: 0px;
padding: 0px;
color:white;
}
*{
transition: all .3s ease;
}
@media print{
#mapView,#map-legend-container{
display: none;
}
}
#mapView{
height:75%;
width:100%;
position:absolute;
top:127px;
}
.esri-ui-manual-container>.esri-component, .esri-ui-top-left{
/*display: none !important;*/
}
.divider-line{
padding: 0px;
margin: 0px;
background-color: #3a8ace;
height: 5px;
cursor: pointer;
}
.esri-ui-top-left, .esri-ui-corner {
right: 0 !important;
bottom: 0 !important;
}
/*
* SCROLLBAR
*/
::-webkit-scrollbar-track
{
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
border-radius: 10px;
background-color: #F5F5F5;
}
::-webkit-scrollbar
{
width: 12px;
background-color: #F5F5F5;
}
::-webkit-scrollbar-thumb
{
border-radius: 10px;
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,.3);
background-color: #555;
}
[draggable] {
-moz-user-select: none;
-khtml-user-select: none;
-webkit-user-select: none;
user-select: none;
/* Required to make elements draggable in old WebKit */
-khtml-user-drag: element;
-webkit-user-drag: element;
}
button{
cursor: pointer;
}
*{
box-sizing: content-box;
}
#esri_widgets_Attribution_0,.esri-ui-manual-container>.esri-component{
display: none !important;
}
/**
** POPUP BLOCK
**/
#popup-block-container{
background-color: white;
position: absolute;
top: 40%;
left: 40%;
width: 660px;
height: 294px;
z-index: 10;
padding: 5px;
display: none;
opacity: 0;
border: 2px solid #ccc;
box-shadow: 0px 0px 8px 2px #777;
}
#popup-block-body{
width: 100%;
height: 100%;
}
#popup-block-title{
width: 100%;
font-weight: bold;
color: black;
text-align: center;
margin-bottom: 5px;
border-bottom: 1px solid black;
}
#popup-block-close{
position: absolute;
right: 5px;
top: 0px;
cursor: pointer;
color: black;
}
#popup-block-close:hover{
transform: scale(1.3,1.3);
}
#popup-block-img{
width: 54%;
height: 266px;
cursor: pointer;
}
#popup-block-expand{
width: 30px;
height: 30px;
position: absolute;
z-index: 10;
left: 327px;
top: 0px;
}
#popup-block-expand:hover{
transform: scale(1.3,1.3);
cursor: pointer;
}
/*#popup-block-img:hover{
transform: scale(2.3,2.3);
}*/
#popup-block-content{
position: absolute;
width: 100%;
}
#popup-block-details{
display: inline-block;
color: black;
width: 43%;
vertical-align: top;
/* border-left: 2px solid black;*/
padding-left: 10px;
}
.popup-block-detail-line{
display: grid;
margin-bottom: 5px;
color: #5f5f5f;
}
.popup-block-detail-title{
font-weight: bold;
color: black;
display: block;
}
/**
** TOP BAND
**/
nav{
width: 100%;
background-color: #398ace;
font-family: 'Open Sans', sans-serif;
}
nav ul{
margin: 0px;
padding: 0px;
list-style: none;
}
div.top-nav{
width: 1024px;
height: 100%;
list-style-type: none;
margin-right: auto;
margin-left: auto;
margin-top: 0px;
margin-bottom: 0px;
padding: 0;
overflow: hidden;
}
div.top-nav li{
vertical-align: middle;
float: left;
}
div.top-nav li a {
display: block;
color: white;
text-align: center;
padding: 8px 16px;
text-decoration: none;
font-size: 12px;
}
div.top-nav li {
border-right: 1px solid #bbb;
}
div.top-nav li:last-child {
border-right: none;
font-size: 14px;
color: white;
}
div.top-nav li a:hover {
background-color: #ecf0f1;
color: black;
}
div.top-nav select{
padding: 8px 16px;
}
#top-band{
background-color: white;
color: black;
font-family: 'Roboto', sans-serif;
position:absolute;
width:100%;
height:127px;
z-index: 5;
}
#top-title{
font-weight: bold;
text-align: center;
font-size:24pt;
float:left;
display: inline-block;
margin-left: 162px;
margin-top: 24px;
}
#top-title center span{
font-family: Serif;
}
/* RIGHT */
#top-band-right-content{
position:relative;
width: 500px;
right: 30px;
top:5px;
}
#top-band-search{
padding:5px;
min-width: 350px;
height: 22px;
margin-bottom:5px;
border: 1px solid #ccc;
-webkit-transition: padding .1s ease-out;
-moz-transition: padding .1s ease-out;
-o-transition: padding .1s ease-out;
transition: padding .1s ease-out;
}
#top-band-search:focus{
}
#top-band-search:hover {
box-shadow: 0 8px 16px 0 rgba(0,0,0,0.24), 0 17px 50px 0 rgba(0,0,0,0.19);
}
#top-band-search-btn,#top-band-reset-btn{
color:white;
background-color: #3a8ace;
border: none;
padding:5px;
width: 155px;
height: 15px;
font-size: small;
font-weight: bold;
}
#top-band-search-btn:hover,#top-band-reset-btn:hover {
box-shadow: 0 8px 16px 0 rgba(0,0,0,0.24), 0 17px 50px 0 rgba(0,0,0,0.19);
}
#top-band-search-btn:active,#top-band-reset-btn:active{
box-shadow: 0 8px 16px 0 rgba(0,0,0,0.24), 0 17px 50px 0 rgba(0,0,0,0.19);
background-color: #3a88ca;
color: rgba(210,210,210,1);
}
#top-band-dropdown{
padding:5px;
width:250px;
border-radius: 7px;
-webkit-transition: box-shadow .1s ease;
-moz-transition: box-shadow .1s ease;
-o-transition: box-shadow .1s ease;
transition: box-shadow .1s ease;
}
#top-band-dropdown:hover{
box-shadow: 0 8px 16px 0 rgba(0,0,0,0.24), 0 17px 50px 0 rgba(0,0,0,0.19);
}
#top-band-right-content label{
cursor:pointer;
}
#top-band-search-type{
margin-bottom: 5px;
}
/**
** BOTTOM BAND
**/
#bottom-band{
background-color: white;
color: black;
position: absolute;
bottom: 0px;
width: 100%;
height: 120px;
}
/* LEFT */
#bottom-band-left{
padding:5px;
position: relative;
height:80%;
width:20%;
}
.legend-container{
float:left;
display:inline-block;
margin-right:0.5em;
}
#bottom-band-left h2{
margin:0px auto;
font-size: 1.2em;
}
#jlp{
background-color:#6fff3a;
}
#pnp{
background-color:#f9a42c;
}
#parish{
}
.legend-icons{
width: 30px;
height: 20px;
margin-bottom: 6px;
}
.legend-text{
font-weight:bold;
margin-top:7px;
}
/* CENTER */
#bottom-band-center{
width:66%;
padding-left: 5px;
border-left: 3px solid #ccc;
}
#bottom-band-scale{
font-family: sans-serif !important;
text-align:center;
border: 2px dotted white;
width: 174px;
left: 40%;
position: relative;
}
#bottom-band-disclaim-mobile{
position: relative;
display:none;
}
#bottom-band-disclaim{
position: relative;
}
#bottom-band-disclaim p{
font-size: 9pt;
margin-top: 5px;
}
#bottom-band-disclaim p a{
color: #FFEB3B;
text-decoration: none;
}
#bottom-band-disclaim p a:hover{
font-weight: bold;
}#map-position{
text-align: center;
}
#disclaim-extra{
display:none;
}
/* RIGHT */
#bottom-band-right{
width:28%;
padding-left: 5px;
border-left: 3px solid #ccc;
}
#bottom-band-right a{
color: black;
cursor:pointer;
text-decoration: none;
}
#bottom-band-right a:hover{
font-weight:bold;
text-decoration: none;
color:darkblue;
}
#bottom-band-right hr{
}
/*
* SEARCH RESULTS CONTAINER
*/
#data-search-results-info{
background-color: white;
padding: 3px;
border: 1px solid black;
min-height: 48px;
text-align: center;
}
#data-search-results-container{
background-color: rgba(255, 255, 255, 0.65);
color: black;
width: 315px;
height:73%;
position: absolute;
padding: 5px;
left: -380px;
top: 127px;
z-index: 10;
box-shadow: 3px 3px 8px -2px rgba(0,0,0,0.75);
}
#data-search-results-container img{
position: absolute;
float: right;
right:10px;
top: 5px;
width: 30px;
cursor: pointer;
}
#data-search-results-list{
height: 630px;
width: 100%;
overflow-y: auto;
margin-top: 10px;
}
#data-search-results-content{
height:630px;
}
#data-search-results-list ul{
max-height: 98%;
overflow-y:auto;
padding-left: 0px;
margin: 0px;
}
#data-search-results-list ul li{
background-color: white;
list-style-type: none;
border:1px solid grey;
margin-bottom:5px;
padding: 5px;
cursor: pointer;
}
#data-search-results-list ul li:hover{
font-weight:bold;
border: 3px solid black;
}
#data-search-results-controls{
}
.active-list-item{
font-weight: bold;
border: 2px solid #398ace !important;
margin-left:15px;
width: 89%;
}
.results-separator{
text-align: center;
background-color: white;
font-weight: 800;
border: 1.5px solid #ccc;
padding: 10px;
margin-bottom: 5px;
}
.search-result{
font-size: 16px;
padding-bottom: 14px;
cursor: pointer;
background-color: #d8d8d8;
margin-bottom: 5px;
}
.search-result-title{
background-color: #6074a4;
padding: 5px;
color: white;
}
.search-result-indicator{
background-color: #c2c2c2;
min-height: 20px;
width: 100%;
}
.search-result-active .search-result-indicator {
background-color: #00d2ff;
}
.search-result-body{
font-size: 14px;
font-weight: bold;
}
/*
* MISC STYLES
*/
/* POP UP WINDOW */
.popup-table-container{
box-shadow: 1px 3px 20px 0px rgba(0,0,0,0.55);
background-color: white;
border: 1px solid grey;
font-family: sans-serif;
overflow-x:hidden;
overflow-y:hidden;
position: absolute;
border-radius:5px;
z-index: 16;
width: 420px;
color:black;
top: 10%;
left:30%;
}
.popup-table-container a{
cursor: pointer;
padding: 5px;
display: block;
text-align: center;
text-transform: uppercase;
font-weight:bold;
text-decoration: none;
color:black;
}
.candidate-wrapper{
display: inline-block;
}
.candidate-data-container{
text-align: center;
min-height: 295px;
overflow-y: auto;
}
.popup-table-title{
color: white;
margin-bottom: 0px;
padding: 0px;
font-weight: bolder;
font-size: 20px;
}
.popup-table-subtitle{
font-weight: bolder;
}
.popup-table-container table{
width: 100%;
}
.popup-candidate-img{
height: 130px;
width: 130px;
display: inline;
margin-top: 10px;
}
.popup-candidate-data{
width: 200px;
margin-top:10px;
margin-bottom: 10px;
text-align: center;
}
.popup-close{
cursor:pointer;
position:absolute;
top:0px;
right:0px;
}
.popup-close:hover,.popup-close:active{
opacity:0.7;
}
.popup-handler{
width:100%;
cursor:move;
background-color: #3a8ace;
height:50px;
}
.popup-handler center{
padding-top:3px;
}
.popup-chart-pie{
width: 700px;
display:none;
margin:0px auto;
}
.popup-chart-bar{
width: 700px;
display:none;
margin:0px auto;
}
.pnp-header{
display: inline-block;
width: 150px;
background-color: orange;
font-weight: bold;
}
.jlp-header{
display: inline-block;
width: 74%;
background-color: #6edc45;
font-weight: bold;
}
.ind-header{
display: inline-block;
width: 74%;
background-color: #ababab;
font-weight: bold;
}
#loading-bar{
color:black;
position: fixed;
width: auto;
height: auto;
margin-left: 50%;
background-color: white;
z-index: 11;
display:none;
border-radius:15px;
padding:5px;
font-weight:bold;
top: 40%;
}
.line-separator{
height:1px;
width: 30%;
background-color:white;
margin-top: 5px;
margin-bottom:5px
}
.clear{
clear:both;
}
.fl{
float:left;
}
.fr{
float:right;
}
.even{
background-color:lightblue;
}
.odd{
background-color:white;
}
.top-popup{
z-index: 30;
}
.focus-error{
border:2px solid red !important;
}
#compass-img{
position:fixed;
z-index:15;
right:30px;
top: 20%;
width: 100px;
}
.box-shadow{
box-shadow: 1px 3px 20px 0px rgba(0,0,0,0.55);
}
/*
* EOJ LOGO CONTAINER
*/
#logo-container{
font-family: 'Roboto', sans-serif;
z-index:1;
width: 339px;
float:left;
}
#logo-img{
top:2px;
position:relative;
left: 10px;
}
#logo-text{
font-size: 16px;
padding-top:10px;
position:relative;
left: 16px;
}
#logo-text-sub{
font-size: 0.8rem;
font-weight: 100;
color: #404040;
font-family: 'Open Sans', sans-serif;
}
#logo-text span:nth-child(1){
font-size: 22px;
font-weight: 500;
}
/*
* OVERLAY TUTORIAL
*/
#overlay{
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 1);
position: absolute;
z-index: 500;
top: 0px;
}
#tour-container{
width: 350px;
background-color: white;
top: 10%;
left: 74%;
position: absolute;
font-weight: bold;
color:black;
padding: 15px;
z-index: 502;
display:none;
-webkit-transition: top 0.3s ease-in, left 0.3s ease-in;
}
#tour-container span{
display: block;
text-align: center;
}
#tour-container span i{
font-size: 1.3em;
}
#tour-container button{
padding: 6px;
font-weight: bold;
color:white;
background-color: #4682b4;
border: none;
border-radius: 5px;
text-align: center;
}
#tour-container button:hover{
box-shadow: 0px 0px 19px 1px rgba(0,0,0,0.55);
}
#tour-prev{
margin-left: 70px;
}
/*
* WELCOME CONTAINER
*/
#welcome-text{
color: #f7e050;
font-size: 6em;
font-family: 'Times New Roman', Arial;
width: 85%;
margin: 0px auto;
text-align: center;
}
#welcome-text-title{
font-size: 45px;
top: 222px;
position: absolute;
left: 38%;
}
#welcome-container{
background: url("../imgs/background-welcome.jpg") no-repeat center;
background-size: 100%;
border-radius: 10px;
top:8em;
left: 10px;
width: 96%;
height: 60%;
position: absolute;
font-weight: bold;
color:white;
padding: 15px;
z-index: 503;
}
#welcome-nav{
width: 450px;
margin-left: 7em;
margin-top: 3em;
}
#welcome-main-site,#welcome-main-tour{
color:black;
font-family: Times New Roman;
font-size: 0.3em;
cursor: pointer;
text-decoration: underline;
display:inline-block;
background-color: #f7e050;
border-radius: 10px;
padding: 7px;
-webkit-transition: background-color .1s ease-out;
}
#welcome-main-tour{
margin-left: 130px;
}
.border-button{
}
/**
* CHAT WINDOW
*/
#body-chat-live-chat{
box-shadow: 3px 6px 21px black;
background-color: white;
border-radius: 5px;
padding: 5px;
position: absolute;
left: 30%;
top:100px;
width: 500px;
height: 600px;
z-index: 50;
color:black;
display:none;
}
#body-chat-live-chat #title-bar{
text-align:center;
font-weight: bold;
font-size: 1.3em;
}
#chat-container{
min-height: 404px;
}
#send-chat-btn{
width: 96%;
padding: 5px;
background-color: #4682b4;
border: none;
color: white;
font-weight: bold;
margin: 0px auto;
display:none;
}
#chat-text{
min-height: 80px;
width: 96%;
padding: 5px;
background-color: #ccc;
border: none;
font-weight: bold;
margin: 5px auto;
display:block;
}
#end-chat-session{
cursor: pointer;
}
/**
* RESULTS SUMMARY
*/
#results-summary-container{
border: 2px solid #e0e0e0;
box-shadow: 3px 4px 10px #585858;
width: 342px;
height: 177px;
border-radius: 10px;
background-color: rgba(255, 255, 255, 0.9);
position: absolute;
top: 63%;
left: 10px;
color:black;
font-weight:bold;
text-align: center;
}
#results-summary-container h2{
display:block;
width: 300px;
margin: 5px auto;
}
#results-summary-items{
display: block;
margin: auto;
width: 210px;
}
.result-item{
opacity: 0;
display:inline-block;
margin-left: 10px;
margin-top: 20px;
width: 80px;
font-size: 30px;
border-radius: 10px;
font-weight: bolder;
text-align: center;
vertical-align: middle;
transition: opacity 1s ease-in;
}
#pnp-count{
background-color: #fca925;
}
#jlp-count{
background-color: #60ff2a;
}
/*
* SMALLER SCREENS
*/
@media only screen and (max-width: 700px){
body,html{
height:100%;
max-width: 100%;
min-width: 100% !important;
overflow: auto !important;
}
#results-summary-container {
display: none !important;
}
#compass-img {
width: 50px !important;
top: 42% !important;
right: 2px;
}
#map{
top: 0px;
height: 55%;
position: relative;
}
/** TOP BAND **/
#top-band{
height:auto;
display:block;
position:relative;
}
div.top-nav{
width: 100%;
}
#logo-text span:nth-child(1) {
font-size: 19px;
font-weight: 500;
}
#logo-container{
display: block;
position: relative;
left: 0px;
width:100% !important;
margin-left: 0px;
top: 0px;
font-size: 12pt;
}
#logo-container div{
display: inline-block;
vertical-align: middle;
}
#top-title{
font-size: 1.2em;
position: relative;
text-align: center;
margin: 0px 0px 0px 0px;
width: 100%;
}
#top-band-right-content{
display:block;
position: relative;
right: 0px;
height: auto;
width: 100%;
top:0px;
}
#top-band-right-content button{
width: 100%;
border-radius: 0px;
margin-bottom: 2px;
}
#top-band-search{
width:100%;
border-radius: 0px;
}
.fr,.fl{
float:none;
}
#compass-img{
width: 80px;
top: 37%;
}
#logo-img{
display:inline-block;
width: 43px;
height: 39px;
}
#logo-text{
display:inline-block;
padding:0px;
padding-top: 0px;
}
/** BOTTOM BAND **/
#bottom-band{
height: 100%;
position:relative;
}
#bottom-band-left{
display:none;
}
#bottom-band-center{
width: 100%;
display:block;
}
#bottom-band-scale{
width: auto;
left: 0px;
}
#bottom-band-disclaim-mobile{
position: relative;
display:block;
color: white;
font-weight: bold;
}
#bottom-band-disclaim-mobile a:visited{
color: white;
}
#bottom-band-disclaim p{
display:none;
}
#bottom-band-right{
width: 100%;
}
#bottom-band-right p{
display:inline-block;
}
#bottom-band-right p::after{
content: " :";
}
#bottom-band-right a{
display:inline-block;
text-decoration:underline;
margin-left: 10px;
}
#minimize-bottom-bar{
display: none;
}
#start-tour{
display: none !important;
}
#bottom-band-right br{
display:none;
}
#body-chat-window{
border: none;
right: 0px!important;
width: 100%!important;
bottom: -364px;
z-index: 10;
}
#body-chat-close{
display:inline-block;
width: 8%;
float: right;
}
.popup-table-container{
font-size: 0.9em;
width: 100% !important;
height: 93% !important;
left:0px;
top: 0% !important;
}
.popup-candidate-data {
float: left;
width: 49%;
}
.candidate-wrapper{
width: 100%;
}
.popup-chart-pie {
width: 100%;
}
.popup-chart-bar {
width: 100%;
}
}
@media only screen and (min-width: 800px) and (max-width: 1023px){
body,html{
overflow: auto;
min-width: 100%;
}
#data-search-results-container {
height: 64%;
}
/** SUMMARY RESULTS **/
.result-item{
font-size: 26px;
margin-left: 18px;
margin-top: 0px;
}
#results-summary-container {
width: 247px;
height: 147px;
font-size: 12px;
top: 58%;
}
#results-summary-container h2{
width: auto;
}
/** TOP BAND **/
#top-band{
height: auto;
padding-bottom: 5px;
}
div.top-nav {
width: 100%;
}
#logo-text span:nth-child(1) {
font-size: 16px;
}
#logo-container{
width: 297px;
}
#logo-img {
top: 10px;
position: relative;
left: 10px;
width: 40px;
height: 40px;
}
#top-title{
margin-left: 54px;
margin-right: 20px;
font-size: 16pt;
margin-top: 10px;
float: left;
}
#top-band-right-content {
display:none;
float: left;
text-align: center;
}
#map{
top: 0px;
height: 83%;
}
/** BOTTOM BAND **/
#bottom-band-left {
width: 23%;
}
#bottom-band-left h2 {
font-size: 1em;
}
.legend-icons {
width: 24px;
height: 15px;
margin-bottom: 6px;
}
.legend-container {
font-size: 0.7em;
}
#bottom-band-disclaim p {
font-size: 8pt;
margin-top: 5px;
}
#body-chat-window{
bottom: -158px;
width: 199px;
}
#body-chat-message p{
font-size: 10pt;
}
#bottom-band-disclaim {
position: relative;
width: 431px;
}
#bottom-band-disclaim p{
height: 70px;
overflow-y: auto;
}
}
@media only screen and (min-width: 1024px) and (max-width: 1299px){
#map{
height:70%
}
#data-search-results-container{
height: 66.6%;
}
/** SUMMARY RESULTS **/
.result-item{
margin-top: 0px;
font-size: 26px;
}
/** TOP BAND **/
div.top-nav li:last-child {
display: none;
}
#logo-text span:nth-child(1) {
font-size: 16px;
font-weight: 500;
}
#logo-container{
margin-top: 15px;
left: 8px;
width: 284px;
padding: 4px;
}
#logo-img{
width: 40px;
height: 40px;
}
#logo-text{
padding-top: 5px;
font-size: 0.8em;
}
#top-band{
height: 86px;
}
#top-title {
width: 36%;
font-size: 1.3em;
margin-left: 10px;
top: 16px;
}
#top-title span{
display: block;
text-align: center;
}
#top-band-right-content {
width: 340px;
right: 0px;
top: 6px;
}
#top-band-search{
min-width: 321px;
padding: 3px;
height: 18px;
}
#top-band-search-type{
font-size: 0.8em;
margin-bottom: 5px;
}
#top-band-search-btn, #top-band-reset-btn {
width: 152px;
}
/** BOTTOM BAND**/
#minimize-bottom-bar{
margin-left: auto;
margin-right: auto;
text-align: center;
cursor: pointer;
}
#results-summary-container {
font-size: 0.8em;
width: 273px;
height: 135px;
}
#results-summary-container h2 {
font-size: 1.4em;
}
#bottom-band-disclaim{
width: 85%;
overflow-y: auto;
height: 80px;
}
#bottom-band-left{
font-size: 0.7em;
overflow: hidden;
height: 85%;
}
#bottom-band-right {
width: 29%;
}
#bottom-band-right p{
margin: 5px;
}
#jlp,#pnp,#parish,#const{
width:27px;
}
.legend-text{
margin-top: 7px;
}
#body-chat-window{
bottom: -139px;
width: 224px;
right: 0px;
}
#body-chat-titlebar h2 {
font-size: 0.8em;
}
#body-chat-textbox input {
width: 214px;
}
.legend-icons {
margin-bottom: 2px;
height: 19px;
}
}
@media screen and (min-width: 1300px){
/* TOP-BAR */
#top-band{
}
#top-title{
font-size: 18pt;
margin-left: 50px;
top: 5px;
}
#top-title span{
display:block;
}
#top-band-search{
height: 17px;
width: 380px;
}
#top-band-search:focus {
}
#directionsBtn:hover{
background-color: red;
color: white;
}
#directionsBtn{
/*
background-color: #008CBA; Green
border: none;
color: white;
*/
transition-duration: 0.4s;
background-color: white;
color: red;
border: 2px solid red;
padding: 10px 25px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
}
#top-band-search-btn, #top-band-reset-btn {
width: 184px;
}
#logo-text{
font-size: 1.2em;
}
#logo-container{
width: 430px;
margin-top: 12px;
}
#top-band-right-content{
width: auto;
right: 0px;
}
/** BOTTOM **/
#body-chat-window{
width:290px;
bottom: -118px;
}
#body-chat-titlebar h2 {
display: inline;
font-size: 11pt;
margin-left: 17px;
position: absolute;
}
#body-chat-textbox input {
width: 95%;
height: 25px;
}
#data-search-results-list ul {
height: auto;
}
#bottom-band-left h2 {
margin: 0px auto;
font-size: 1.1em;
font-weight: 400;
}
#bottom-band-left{
width: 17%;
}
.legend-icons{
width: 18px;
height: 16px;
margin-bottom: 3px;
}
.legend-text{
margin-bottom: 3px;
margin-top: 0px;
font-size: 14.8px;
margin-left: 5px;
}
.legend-container{
margin: 0px;
}
#results-summary-container {
top: 56%;
}
#bottom-band-center {
width: 60%;
}
}
@media screen and (min-width: 1900px){
#map{
height: 77%;
}
div.top-nav {
width: 1366px;
}
#logo-container {
margin-left: 284px;
}
#top-band-right-content {
width: auto;
right: 284px;
}
}
// CONST_NO ( type: esriFieldTypeString , alias: CONST_NO , length: 2 )
// CONST_NAME ( type: esriFieldTypeString , alias: CONST_NAME , length: 40 )
// REGION_NO ( type: esriFieldTypeString , alias: REGION_NO , length: 2 )
// PARISH_NAME ( type: esriFieldTypeString , alias: PARISH_NAME , length: 20 )
// PD_NO_ ( type: esriFieldTypeString , alias: PD_NO_ , length: 4 )
// ELECTOR_CNT ( type: esriFieldTypeInteger , alias: ELECTOR_CNT )
// OLD_PD_NO ( type: esriFieldTypeString , alias: OLD_PD_NO , length: 50 )
// INTER_PD_NO ( type: esriFieldTypeString , alias: INTER_PD_NO , length: 50 )
// PD_NO_INT ( type: esriFieldTypeSmallInteger , alias: INTEGER PD NUMBER )
// Shape ( type: esriFieldTypeGeometry , alias: Shape )
//Shape.STArea() ( type: esriFieldTypeDouble , alias: Shape.STArea() )
//Shape.STLength() ( type: esriFieldTypeDouble , alias: Shape.STLength() )
var view;
var removeViewOutline;
var highlightSelect;
var circleBuffer;
require([
"esri/Map",
"esri/views/MapView",
"esri/widgets/LayerList",
"esri/widgets/DistanceMeasurement2D",
"esri/widgets/AreaMeasurement2D",
"esri/widgets/Search",
"esri/widgets/Home",
"esri/widgets/Expand",
"esri/widgets/BasemapGallery",
"esri/tasks/support/Query",
"esri/tasks/QueryTask",
"esri/layers/support/LabelClass",
"esri/layers/GraphicsLayer",
"esri/layers/MapImageLayer",
"esri/layers/FeatureLayer",
"esri/layers/TileLayer",
"esri/layers/support/Sublayer",
"esri/symbols/SimpleFillSymbol",
"esri/symbols/SimpleLineSymbol",
"esri/symbols/SimpleMarkerSymbol",
"esri/symbols/TextSymbol",
"esri/core/watchUtils",
"esri/PopupTemplate",
"esri/widgets/Sketch/SketchViewModel",
"esri/Graphic",
"esri/Color",
"esri/core/watchUtils",
"esri/geometry/Extent",
"esri/tasks/FindTask",
"esri/tasks/support/FindParameters",
"esri/geometry/geometryEngine",
"esri/geometry/Circle",
"esri/geometry/Polyline",
"esri/geometry/Point",
"esri/symbols/TextSymbol",
"dojo/dom",
"dojo/dom-class",
"dojo/on",
"dojo/mouse",
"dojo/domReady!"
], function(Map,
MapView,
LayerList,
DistanceMeasurement2D,
AreaMeasurement2D,
Search,
Home,
Expand,
BasemapGallery,
Query,
QueryTask,
LabelClass,
GraphicsLayer,
MapImageLayer,
FeatureLayer,
TileLayer,
Sublayer,
SimpleFillSymbol,
SimpleLineSymbol,
SimpleMarkerSymbol,
TextSymbol,
watchUtils,
PopupTemplate,
SketchViewModel,
Graphic,
Color,
WatchUtils,
Extent,
FindTask,
FindParameters,
GeometryEngine,
Circle,
Polyline,
Point,
TextSymbol,
Dom,
DomClass,
On,
Mouse) {
//VARIABLES
let canClickAgain = true;
let activeWidget = null;
let geometryArr = [];
let initialExtent = null;
let officeLayer = null;
let colorPool = ['#324851','#4CB5F5','#1E0000','#BCBABE', '#4D648D','#2988BC','#9a9EAB','#5D535E','#4C3F54','#B38867'];
let edresults =[],consresults =[],parishresults = [], officeresults = [];
var polylineSymbol = {
type: "simple-line", // autocasts as SimpleLineSymbol()
color: [226, 119, 40],
width: 4
};
var pointKnob = {
type: "simple-marker", // autocasts as new SimpleMarkerSymbol()
color: [226, 119, 40],
style: "circle",
size: "20px", // pixels
outline: { // autocasts as new SimpleLineSymbol()
color: [255, 255, 255],
width: 2
}
};
let polygonSymbol = new SimpleFillSymbol({
color: "#265CC5EF",
style: "none",
outline: { // autocasts as esri/symbols/SimpleLineSymbol
color: "#58cbff",
width: 5
}
});
var circleSymb = new SimpleFillSymbol(
SimpleFillSymbol.STYLE_NULL,
new SimpleLineSymbol(
SimpleLineSymbol.STYLE_SHORTDASHDOTDOT,
new Color([105, 105, 105]),
2),
new Color([255, 255, 0, 0.25])
);
//LAYERS
// var consti = new FeatureLayer({
// url: "https://services6.arcgis.com/3R3y1KXaPJ9BFnsU/arcgis/rest/services/WEB_MAP2/FeatureServer/1",
// spatialReference : 102100,
// outFields: ["*"],
// visible: false
// });
var officeLabel = { // autocasts as new LabelClass()
symbol: {
type: "text", // autocasts as new TextSymbol()
color: "blue",
haloColor: [255, 255, 255, 255], // black
haloSize: 3,
font: { // autocast as new Font()
family: "sans-serif",
size: 7
},
horizontalAlignment: "right",
lineWidth: 32
},
labelExpressionInfo: {
expression: "$feature.OFFICE_NAME + ' (' +$feature.LOCATION + ')'"
},
labelPlacement: "below-center"
};
var parishLabels = { // autocasts as new LabelClass()
symbol: {
type: "text", // autocasts as new TextSymbol()
color: "black",
haloColor: [255, 255, 255, 255], // black
haloSize: 3,
font: { // autocast as new Font()
family: "sans-serif",
size: 13,
weight: "bold"
}
},
//labelPlacement: "center-along",
labelExpressionInfo: {
expression: "$feature.PARISH_NAM"
}//s,
//deconflictionStrategy: "none"
};
var constLabels = { // autocasts as new LabelClass()
symbol: {
type: "text", // autocasts as new TextSymbol()
color: [76,0,118,1],
haloColor: "white",//[255, 255, 255, 255], // black
haloSize: 2,
font: { // autocast as new Font()
family: "sans-serif",
size: 7,
weight: "bold"
}
},
//labelPlacement: "center-along",
labelExpressionInfo: {
expression: "$feature.CONST_NAME"
}//s,
//deconflictionStrategy: "none"
};
var popupAdminDetails = {
"title": "<b>{OFFICE_NAME}</b>",
"content": [{
type: "fields",
fieldInfos: [
{
fieldName: "REGION",
label: "<b>REGION<b>"
},{
fieldName: "FULL_ADDRESS",
label: "<b>ADDRESS</b>"
},{
fieldName: "LOCATION",
label: "<b>LOCATION<b>"
}]},{
type: "media", // MediaContentElement
mediaInfos: [
{
//title: "<b>test</b>",
type: "image",
//caption: "office",
value: {
sourceURL:
"officeimgs/{GEO_TAG}.JPG"
}
}]
}]
//"content": "<b>REGION:</b> {REGION}<br><b>ADDRESS:</b> {FULL_ADDRESS}<br><b>LOCATION:</b> {LOCATION}"
}
var popupAdminDetails2 = {
"title": "<b>{OFFICE_NAME}</b>",
"content": "<b>REGION:</b> {REGION}<br><b>ADDRESS:</b> {FULL_ADDRESS}<br><b>LOCATION:</b> {LOCATION}"
}
// var popupAdminDetails = {
// "title": "<b>{OFFICE_NAME}</b>",
// "content": [{
// type: "fields",
// fieldInfos: [
// {
// fieldName: "REGION",
// label: "<b>REGION<b>"
// },{
// fieldName: "FULL_ADDRESS",
// label: "<b>ADDRESS</b>"
// },{
// fieldName: "LOCATION",
// label: "<b>LOCATION<b>"
// }]},{
// type: "media", // MediaContentElement
// mediaInfos: [
// {
// //title: "<b>test</b>",
// type: "image",
// //caption: "office",
// value: {
// sourceURL:
// "img/office pics/{GEO_TAG}.JPG"
// }
// }]
// }]
// //"content": "<b>REGION:</b> {REGION}<br><b>ADDRESS:</b> {FULL_ADDRESS}<br><b>LOCATION:</b> {LOCATION}"
// }
//
// var popupPdDetails = {
// "title": "<b>PD #:<b> {PD_NO_}</b>",
// "content": [{type: "fields",
// fieldInfos: [{
// fieldName: "CONST_NAME",
// label: "<b>CONSTITUENCY<b>"
// },{
// fieldName: "ED_NAME",
// label: "<b>ED NAME</b>"
// },{
// fieldName: "ED_NO",
// label: "<b>ED #<b>"
// },{
// fieldName: "ELECTOR_CNT",
// label: "<b>ELECTOR COUNT<b>"
// }]
// }],
// //"content": "<b>CONSTITUENCY:</b> {CONST_NAME}<br><b>ED NAME:</b> {ED_NAME}<br><b>ED #:</b> {ED_NO}<br><b>" + "ELECTOR COUNT:</b> {ELECTOR_CNT}",
// "actions": [measureAreaAction, measurePerimeterAction, clearAction]
// }
var popupConstiDetails = {
"title": "<b>{CONST_NAME}</b>",
"content": [{type: "fields",
fieldInfos: [
// {
// fieldName: "SITTING_MP",
// label: "<b>SITTING MP<b>"
// },{
// fieldName: "MP_AFFILIATION",
// label: "<b>MP AFFILIATION</b>"
// },
{
fieldName: "REGION_NO",
label: "<b>REGION<b>"
},{
fieldName: "CONST_NO",
label: "<b>CONST. #<b>"
}]
}],
//"content": "<b>SITTING MP:</b> {SITTING_MP}<br><b>MP AFFILIATION:</b> {MP_AFFIL}<br><b>REGION:</b> {REGION_NO}<br><b>" + "CONST. #:</b> {CONST_NO}",
//"actions": [measureAreaAction, measurePerimeterAction, clearAction]
}
consti = new FeatureLayer({
url: "https://services6.arcgis.com/3R3y1KXaPJ9BFnsU/arcgis/rest/services/ECJWEB_MAP/FeatureServer/6",
visible: true,
title: "Constituency Boundaries",
labelsVisible: true,
//minScale: 289000,
//maxScale: 73000,
labelingInfo: [constLabels],
popupTemplate: popupConstiDetails
});
anamolies = new FeatureLayer({
url: "https://services6.arcgis.com/3R3y1KXaPJ9BFnsU/arcgis/rest/services/ECJWEB_MAP/FeatureServer/7",
visible: true,
title: "Constituency Anamolies",
labelsVisible: true,
//minScale: 289000,
//maxScale: 73000
//labelingInfo: [constLabels]
});
offices = new FeatureLayer({
url: "https://services6.arcgis.com/3R3y1KXaPJ9BFnsU/arcgis/rest/services/ECJWEB_MAP/FeatureServer/3",
visible: true,
labelsVisible: true,
title: "Admin Offices",
labelingInfo: [officeLabel],
minScale: 289000,
maxScale: 0,
//popupTemplate: popupAdminDetails2
popupTemplate: null
});
//consti.labelingInfo[0].symbol.font.family = "Arial Unicode MS";
ed = new FeatureLayer({
url: "https://services6.arcgis.com/3R3y1KXaPJ9BFnsU/arcgis/rest/services/ECJWEB_MAP/FeatureServer/7",
//renderer: ed_renderer,
visible: true,
labelsVisible: false,
title: "Electoral Division Boundaries",
minScale: 73000,
maxScale: 0//,
//labelingInfo: [labelClass]
});
ed_colored = new FeatureLayer({
url: "https://services6.arcgis.com/3R3y1KXaPJ9BFnsU/arcgis/rest/services/ECJWEB_MAP/FeatureServer/8",
//renderer: ed_renderer,
visible: true,
labelsVisible: true,
title: "Electoral Division Colour-Fill",
//popupTemplate: popupEdDetails,
minScale: 200000,
maxScale: 0//,
// labelingInfo: [labelClass]
});
parish = new FeatureLayer({
url: "https://services6.arcgis.com/3R3y1KXaPJ9BFnsU/arcgis/rest/services/ECJWEB_MAP/FeatureServer/5",
//renderer: parish_renderer,
visible: true,
labelsVisible: true,
title: "Parish Boundaries",
minScale: 0,
maxScale: 289000,
labelingInfo: [parishLabels]
});
pd = new FeatureLayer({
url: "https://services6.arcgis.com/3R3y1KXaPJ9BFnsU/arcgis/rest/services/ECJWEB_MAP_ANDROID/FeatureServer/10",
//visible: false,
title: "Polling Division Boundaries",
minScale: 72000,
maxScale: 0//,
//labelingInfo: [labelClass]
});
streets = new FeatureLayer({
url: "https://services6.arcgis.com/3R3y1KXaPJ9BFnsU/arcgis/rest/services/STREETS_AND_PDS/FeatureServer/0",
//visible: false,
title: "Streets layer",
minScale: 72000,
maxScale: 0//,
//labelingInfo: [officeLabel2]
});
community = new FeatureLayer({
url: "https://services6.arcgis.com/3R3y1KXaPJ9BFnsU/arcgis/rest/services/ECJWEB_MAP/FeatureServer/2",
//visible: false,
title: "Community layer",
minScale: 100000,
maxScale: 0//,
//labelingInfo: [officeLabel2]
});
consti.on("layerview-destroy", function(event){
// The LayerView for the layer that emitted this event
console.log("Testing consti");
});
// parishlabel = new FeatureLayer({
// url: "https://services6.arcgis.com/3R3y1KXaPJ9BFnsU/arcgis/rest/services/parish_layer/FeatureServer/0",
// //renderer: parish_renderer,
// visible: true,
// labelsVisible: true,
// title: "Parish Boundaries",
// minScale: 0,
// maxScale: 289000
// });
//gis2014d:6080
//192.168.100.89:6080
//https://goj.maps.arcgis.com/home/item.html?id=3be05c467aa34c549420e21c143b8406
//http://192.168.100.89:6080/arcgis/rest/services/ECJWEB_MAP/FeatureServer/1
//https://services6.arcgis.com/3R3y1KXaPJ9BFnsU/arcgis/rest/services/WEB_MAP2/FeatureServer
//http://192.168.100.89:6080/arcgis/rest/services/ECJWEB_MAP/MapServer
// var boundaryLayer = new MapImageLayer({
// url: "https://tiles.arcgis.com/tiles/3R3y1KXaPJ9BFnsU/arcgis/rest/services/WEB_MAP2/MapServer", //LINK TO SERVER MANAGER ARCGIS WEB SERVICE
// spatialReference : 102095,
// outFields: ["*"],
// mode: FeatureLayer.MODE_ONDEMAND,
// sublayers: [
// {
// id: 6, //ED LAYER
// visible: true,
// labelsVisible: true,
// minScale: 73000,
// maxScale: 0
// },
// {
// id: 5, //ED LAYER
// visible: true,
// labelsVisible: false,
// minScale: 73000,
// maxScale: 0
// },
// {
// id: 3, //CONSTITUENCY LAYER
// visible: true,
// labelsVisible: true,
// minScale: 289000,
// maxScale: 73000
// },
// {
// id: 2, //ADMIN OFFICES LAYER
// visible: true,
// labelsVisible: false,
// minScale: 289000,
// maxScale: 0
// },
// {
// id: 2, //PARISH LAYER
// visible: true,
// labelsVisible: true,
// minScale: 0,
// maxScale: 289000
// },
// {
// id: 1, //ADMIN OFFICES LAYER
// visible: true,
// labelsVisible: true,
// minScale: 73000,
// maxScale: 0,
// popupTemplate: null
// }
// ]
// });
var graphicsLayer = new GraphicsLayer();
var map = new Map({
basemap: "topo-vector",
layers: [consti, parish, anamolies, offices, community, streets, pd, ed_colored, graphicsLayer]//boundaryLayer,consti, graphicsLayer]//[parish, parishlabel, consti, ed, ed_colored, offices, graphicsLayer]
});
view = new MapView({
container: "mapView",
map: map,
center: [-77.2627, 18.0927],
zoom: 10//,
// constraints: {
// minScale: 0, // User cannot zoom out beyond a scale of 1:500,000
// maxScale: 140000
// }
});
view.when(() => {
const layerList = new LayerList({
view: view
});
const expand = new Expand({
view: view,
content: layerList
});
// Add widget to the top right corner of the view
view.ui.add(expand, "top-left");
});
view.ui.add("topbar", "bottom-right");
document
.getElementById("distanceButton")
.addEventListener("click", function () {
setActiveWidget(null);
if (!this.classList.contains("active")) {
setActiveWidget("distance");
} else {
setActiveButton(null);
}
});
document
.getElementById("areaButton")
.addEventListener("click", function () {
setActiveWidget(null);
if (!this.classList.contains("active")) {
setActiveWidget("area");
} else {
setActiveButton(null);
}
});
function setActiveWidget(type) {
switch (type) {
case "distance":
activeWidget = new DistanceMeasurement2D({
view: view
});
// skip the initial 'new measurement' button
activeWidget.viewModel.start();
view.ui.add(activeWidget, "top-right");
setActiveButton(document.getElementById("distanceButton"));
break;
case "area":
activeWidget = new AreaMeasurement2D({
view: view
});
// skip the initial 'new measurement' button
activeWidget.viewModel.start();
view.ui.add(activeWidget, "top-right");
setActiveButton(document.getElementById("areaButton"));
break;
case null:
if (activeWidget) {
view.ui.remove(activeWidget);
activeWidget.destroy();
activeWidget = null;
}
break;
}
}
function setActiveButton(selectedButton) {
// focus the view to activate keyboard shortcuts for sketching
view.focus();
let elements = document.getElementsByClassName("active");
for (let i = 0; i < elements.length; i++) {
elements[i].classList.remove("active");
}
if (selectedButton) {
selectedButton.classList.add("active");
}
}
var search = new Search({
view: view,
allPlaceholder: "Search",
sources: []
});
search.viewModel.sources = [{
layer: offices,
searchFields: ["OFFICE_NAME"],
displayField: "OFFICE_NAME",
exactMatch: false,
outFields: ["OFFICE_NAME", "LOCATION"],
name: "Admin Offices",
placeholder: "example: Kingston"
},
{
layer: parish,
searchFields: ["PARISH_NAM"],
displayField: "PARISH_NAM",
exactMatch: false,
outFields: ["OBJECTID", "PARISH_NAM"],
name: "Parishes",
placeholder: "example: Kingston"
},
{
layer: ed_colored,
searchFields: ["ED_NAME"],
displayField: "ED_NAME",
exactMatch: false,
outFields: ["ED_NO", "ED_NAME"],
name: "Electoral Divisions",
placeholder: "example: Kingston"
},
{
layer: community,
searchFields: ["COMM_NAME"],
displayField: "COMM_NAME",
exactMatch: false,
outFields: ["COMM_NAME", "PARISH"],
name: "Community",
placeholder: "Communities"
},
{
layer: consti,
searchFields: ["CONST_NAME"],
displayField: "CONST_NAME",
exactMatch: false,
enableInfoWindow: true,
outFields: ["CONST_NO", "CONST_NAME"],
name: "Constituency",
placeholder: "example: Kingston Central"
}];
view.ui.add(search, "bottom-left"); //Add to the map
const homeBtn = new Home({
view: view
});
// Add the home button to the top left corner of the view
view.ui.add(homeBtn, "top-left");
const basemapGallery = new BasemapGallery({
view: view,
});
// Create an Expand instance and set the content
// property to the DOM node of the basemap gallery widget
// Use an Esri icon font to represent the content inside
// of the Expand widget
const bgExpand = new Expand({
view: view,
content: basemapGallery
});
// close the expand whenever a basemap is selected
basemapGallery.watch("activeBasemap", () => {
const mobileSize =
view.heightBreakpoint === "xsmall" ||
view.widthBreakpoint === "xsmall";
if (mobileSize) {
bgExpand.collapse();
}
});
// Add the expand instance to the ui
view.ui.add(bgExpand, "top-left");
view.when(function(){
if (view.zoom > 12){
alert("test");
}
showNoticeInfo();
}, function(error){
// This function will execute if the promise is rejected due to an error
});
//BEGIN INIT OF MAP FUNCTIONS
Propsy.view = view;
Propsy.map = map;
Propsy.graphicsLayer = graphicsLayer;
Propsy.document = document;
Propsy.body = document.body;
Propsy.loadingImg = "mapimg/loading_bar.gif";
Propsy.init();
punchSite();
// //WATCH THE FEATURE LAYER FOR ACTIONS AFTER consti IS LOADED
let lastClickStamp;
view.whenLayerView(consti).then(function(lyrView) {
setExtents();
WatchUtils.whenTrue(view, "stationary", checkAnimating); //when view is steady
WatchUtils.whenFalseOnce(lyrView, "updating", function(){
view.on("pointer-move", function(evt) {
var screenPoint = {
x: evt.x,
y: evt.y
};
// the hitTest() checks to see if any graphics in the view
// intersect the given screen x, y coordinates
// view.hitTest(screenPoint)
// .then( function(response){
// getGraphics(response);
// });
});
});
view.on("click", function(evt){
var container = document.getElementById("data-search-results-container");
console.log(container.display);
console.log(evt);
removeViewOutline = document.getElementsByClassName("esri-view-surface");
removeViewOutline[0].classList.remove("esri-view-surface--inset-outline");
if(circleBuffer && evt.button === 2){
view.graphics.removeAll();
return false;
}
screenClick = evt;
view.hitTest(evt).then(function(response){
if (response.results.length) {
var graphic = response.results.filter(function (result) {
return result.graphic.layer === consti || result.graphic.layer === offices || result.graphic.layer === graphicsLayer;
})[0].graphic;
if (highlightSelect) {
highlightSelect.remove();
}
if(graphic.geometry.type == "polygon"){
//if(view.scale > 300000){
zoomToArea(graphic);
// }
view.graphics.removeAll();
showConstiDetails(evt);
}
if(graphic.geometry.type == "point"){
//console.log(graphicsLayer);
//let clickStamp = Math.round(event.timestamp);
let clickStamp = Math.round(evt.timestamp);
if(lastClickStamp === 0)
lastClickStamp = clickStamp;
if(view.scale < 10000){
circleBuffer = new Circle({
center: evt.mapPoint,
geodesic: true,
radius: 15,
radiusUnit: "meters",
//x: evt.x,
//y: evt.y,
time: clickStamp
});
}else{
circleBuffer = new Circle({
center: evt.mapPoint,
geodesic: true,
radius: 0.4,
radiusUnit: "miles",
//x: evt.x,
//y: evt.y,
time: clickStamp
});
view.center = [evt.mapPoint.longitude, evt.mapPoint.latitude];
//view.center.y = evt.y;
}
if((clickStamp - lastClickStamp ) < 1000)
return;
console.log(view);
console.log(view.scale);
console.log(circleBuffer);
view.graphics.removeAll();
var graphic = new Graphic(circleBuffer, circleSymb);
view.graphics.add(graphic);
var query = consti.createQuery();
query.geometry = circleBuffer.extent;
//query.geometry = view.toMap(evt);
query.outSpatialReference = view.spatialReference;
// Use a fast bounding box query. It will only go to the server if bounding box is outside of the visible map.
consti.queryFeatures(query).then(findInBuffer(graphic));
lastClickStamp = clickStamp;
}
//});
}
});
// }
});
}).catch(function(error) {
// An error occurred during the layerview creation
console.log(error);
});
view.on("pointer-move", function(event){
view.hitTest(event).then(function(response){
if (response.results.length) {
var graphic = response.results.filter(function (result) {
return result.graphic.layer === consti || result.graphic.layer === offices;
})[0].graphic;
view.whenLayerView(graphic.layer).then(function(layerView){
if (highlightSelect) {
highlightSelect.remove();
}
if(graphic.geometry.type == "polygon"){
highlightSelect = layerView.highlight(graphic);
//console.log(graphic);
}
if(graphic.geometry.type == "point"){
//let clickStamp = Math.round(event.timestamp);
highlightSelect = layerView.highlight(graphic);
}
});
}
});
});
function showNoticeInfo(){
var popupContainer = document.getElementById("popup-block-container");
var imgtag = document.getElementById("popup-block-img");
var title = document.getElementById("popup-block-title");
var details = document.getElementById("popup-block-details");
details.innerHTML = "";
details.innerHTML += "<span class='popup-block-detail-title'>For information not displayed, please feel free to contact the Electoral Office of Jamaica - GIS Department.</span></br>";
details.innerHTML += "<span class='popup-block-detail-line'><span class='popup-block-detail-title'>Address</span>";
details.innerHTML += "<span class='popup-block-detail-line'> 43 Duke Street, Kingston, Jamaica </span></br/>";
details.innerHTML += "<span class='popup-block-detail-line'><span class='popup-block-detail-title'>Contact</span>";
details.innerHTML += "<span class='popup-block-detail-line'> Tel: (876)-922-0425-9 </span>";
details.innerHTML += "<span class='popup-block-detail-line'> Toll-Free: 1-888-991-VOTE (8683) </span>";
details.innerHTML += "<span class='popup-block-detail-line'> Fax: (876) 922-4058 </span></br>";
details.innerHTML += "<span class='popup-block-detail-line'><span class='popup-block-detail-title'>Opening Hours</span>Mon-Thu. 8:30AM - 5:00PM</br>Fri. 8:30AM - 4:00PM</span>";
//details.innerHTML += "</span>Fri. 8:30AM - 4:00PM</span>";
//imgtag.src = "officeimgs/8 HEAD OFFICE DUKE STREET 2.JPG";
imgtag.style.display = "none";
details.style.width = "120%";
title.innerHTML = "NOTICE";
title.style.color = "red";
//setTimeout(function(){
popupContainer.style.width = "850px";
popupContainer.style.height = "294px";
popupContainer.style.display = "block";
popupContainer.style.top = "236px";
popupContainer.style.opacity = "1";
popupContainer.style.zIndex = "16";
}
function showOfficeDetails(feat){
//console.log(feat);
var googlemaps = "https://www.google.com/maps/dir/?api=1&destination=" + feat.geometry.latitude + "%2C" + feat.geometry.longitude;
//var encoded_address = encodeURI(feat.attributes.FULL_ADDRESS);
//console.log(encoded_address);
//var googlemaps = "https://www.google.com/maps/dir/?api=1&destination=" + encoded_address;
//console.log(googlemaps);
var popupContainer = document.getElementById("popup-block-container");
var imgtag = document.getElementById("popup-block-img");
var title = document.getElementById("popup-block-title");
var details = document.getElementById("popup-block-details");
popupContainer.style.width = "660px";
popupContainer.style.height = "294px";
imgtag.style.display = "";
details.style.width = "43%";
details.innerHTML = "";
details.innerHTML += "<span class='popup-block-detail-line'><span class='popup-block-detail-title'>Address</span>" + feat.attributes.FULL_ADDRESS + "</span>";
//details.innerHTML += "<span class='popup-block-detail-line'>" + feat.attributes.ADDRESS_FIELD_1 + "</span>";
//details.innerHTML += "<span class='popup-block-detail-line'>" + feat.attributes.ADDRESS_FIELD_2 + "</span>";
//details.innerHTML += "<span class='popup-block-detail-line'>" + feat.attributes.ADDRESS_FIELD_3 + "</span>";
details.innerHTML += "<span class='popup-block-detail-line'><span class='popup-block-detail-title'>Tel.</span>876-" + feat.attributes.Telephone_No_+ "</span>";
details.innerHTML += "<span class='popup-block-detail-line'><span class='popup-block-detail-title'>Opening Hours</span>Mon-Thu. 8:30AM - 4:30PM</br>Fri. 8:30AM - 3:30PM</span></br></br>";
details.innerHTML += "<center><a target='_blank' href=" + googlemaps + "><button id='directionsBtn'>GET DIRECTIONS ❯</button></a></center>";
imgtag.src = "officeimgs/"+feat.attributes.GEO_TAG.trim()+".JPG";
title.innerHTML = feat.attributes.OFFICE_NAME;
title.style.color = "blue";
popupContainer.style.display = "block";
popupContainer.style.top = "-1920px";
popupContainer.style.opacity = "1";
popupContainer.style.zIndex = "16";
popupContainer.style.left = (Math.abs(circleBuffer.x)-300)+"px";
popupContainer.style.top = (Math.abs(circleBuffer.y) + (popupContainer.offsetHeight/2))+"px";
setTimeout(function(){
var rect = offsett(popupContainer);
var rect2 = offsett(view.container);
Propsy.moveWindow("popup-block-container",circleBuffer);
},600);
}
function showConstiDetails(event){
evtX = 0;
evtY = 0;
var query = consti.createQuery();
console.log(event);
if(event.eventId){
console.log("event");
query.geometry = view.toMap(event);
evtX = event.x;
evtY = event.y;
query.outSpatialReference = view.spatialReference;
query.returnGeometry = true;
}else{
console.log("geometry");
let obj_id = event.id.slice(5);
let cons_id = consresults[obj_id].consNum
console.log(cons_id);
query.where = "CONST_NO LIKE '%"+cons_id+"%'";
//query.geometry = event;
evtX = event.geometry.extent.center.x;
evtY = event.geometry.extent.center.y;
query.outSpatialReference = view.spatialReference;
query.returnGeometry = true;
}
consti.queryFeatures(query).then(function(result) {
let results = result.features;
console.log(results);
results.map( function(feat){
var popupContainer = document.getElementById("popup-block-container");
var imgtag = document.getElementById("popup-block-img");
var title = document.getElementById("popup-block-title");
var details = document.getElementById("popup-block-details");
details.style.width = "43%";
details.innerHTML = "";
imgtag.style.display = "";
details.innerHTML += "<span class='popup-block-detail-line'><span class='popup-block-detail-title'>SITTING MP</span>" + feat.attributes.SITTING_MP + "</span></br>";
details.innerHTML += "<span class='popup-block-detail-line'><span class='popup-block-detail-title'>MP AFFILIATION</span>" + feat.attributes.MP_AFFIL+ "</span></br>";
imgtag.src = "candidate_pictures/"+feat.attributes.CONST_NO+"_"+feat.attributes.MP_AFFIL+".jpg";
//imgtag.style.display = "none";
//details.style.width = "120%";
title.innerHTML = feat.attributes.CONST_NAME;
title.style.color = "blue";
//setTimeout(function(){
popupContainer.style.width = "460px";
//popupContainer.style.height = "140px";
popupContainer.style.display = "block";
popupContainer.style.top = "-1920px";
popupContainer.style.opacity = "1";
popupContainer.style.zIndex = "16";
popupContainer.style.left = (Math.abs(evtX)-300)+"px";
popupContainer.style.top = (Math.abs(evtY) + (popupContainer.offsetHeight/2))+"px";
setTimeout(function(){
var rect = offsett(popupContainer);
var rect2 = offsett(view.container);
//if(zoom.scale > 200000){
Propsy.moveWindow("popup-block-container", event);
//}
},600);
});
});
}
function findInBuffer(graphic) {
var query = offices.createQuery();
//query.objectIds = inBuffer;
query.geometry = circleBuffer.extent;
//query.geometry = view.toMap(evt);
query.outSpatialReference = view.spatialReference;
query.returnGeometry = true;
// Use an objectIds selection query (should not need to go to the server)
offices.queryFeatures(query).then(function(result) {
let results = result.features;
//console.log(results);
if(results.length > 1){
graphicsLayer.removeAll();
if(view.scale > 10000){
view.goTo( graphic,{animate: true, duration: 1000, easing: 'ease-out'});
}
}else{
graphicsLayer.removeAll();
results.map( function(feat){
showOfficeDetails(feat);
});
}
});
}
function offsett(el) {
//if(view.scale > 200000){
var rect = el.getBoundingClientRect(),
scrollLeft = window.pageXOffset || document.documentElement.scrollLeft,
scrollTop = window.pageYOffset || document.documentElement.scrollTop;
return { top: rect.top + scrollTop, left: rect.left + scrollLeft }
//}
}
// view.on("click", function(evt){
//
//
// if(view.zoom < 12){
// return false;
// }
// console.log(evt);
// if(parseInt(evt.button) === 2){
// //right click
// //loadContextMenu(evt);
// return;
// }
//
// var queryStatesTask = new QueryTask({url: "https://services6.arcgis.com/3R3y1KXaPJ9BFnsU/arcgis/rest/services/ECJWEB_MAP/FeatureServer/4" });
// var query = new Query();
// query.geometry = evt.mapPoint; // mapPoint obtained from view-click event.
// query.distance = 50;
// query.units = "meter";
// query.outFields = ["*"];
// query.returnGeometry = true;
// query.outSpatialReference = view.extent.spatialReference;
// query.spatialRelationship = "intersects"; // All features that intersect 100mi buffer
// queryStatesTask.execute(query).then(function(result){
// graphicsLayer.removeAll();
// var polygonGraphic = new Graphic({
// geometry: result.features[0].geometry,
// symbol: polygonSymbol,
// attributes: result.features[0].attributes,
// visible: true
// });
// graphicsLayer.add(polygonGraphic);
// view.goTo(polygonGraphic, 1500);
// console.log(result.features[0].attributes);
// grabStatistics(result.features[0].attributes.CONST_NAME);
// });
//
// });
//
/**
* PAGE FUNCTIONS
*/
On(document, '#slide-content-close:click', closePanelMeth);
On(document, '#popup-block-img:click', expandImage);
On(document, 'div.search-result:click', selectCurrentResult);
//On(Dom.byId("slide-content-close"), "click", closePanelMeth);
//On(Dom.byId("popup-block-img"), "click", expandImage);
//On(Dom.byId("div.search-result"), "click", selectCurrentResult);
On(Dom.byId("top-band-search"), "keyup", textChecker);
On(Dom.byId("search-top-init"), "click", toggleSearch);
On(Dom.byId("popup-block-close"), "click", closePopupBlock);
On(Dom.byId("top-band-reset-btn"), "click", resetMap);
On(Dom.byId("top-band-search-btn"), "click", textChecker);
On(Dom.byId("close-results"), "click", closeResults);
/**
* METHOD DEFINITIONS
**/
//AFTER VIEW IS LOADED TO DOM SET INITIAL EXTENT
function setExtents(){
var currXMax = view.extent.xmax.toFixed(2);
var currYMax = view.extent.ymax.toFixed(2);
var currXMin = view.extent.xmin.toFixed(2);
var currYMin = view.extent.ymin.toFixed(2);
initialExtent = new Extent();
initialExtent.xmin = currXMin;
initialExtent.ymin = currYMin;
initialExtent.xmax = currXMax;
initialExtent.ymax = currYMax;
initialExtent.spatialReference = 102095;
var ext = new Extent({
xmin: currXMin,
ymin: currYMin,
xmax: currXMax,
ymax: currYMax
});
view.constraints = {
//minScale: 800000, // User cannot zoom out beyond a scale of 1:800,000
rotationEnabled: false, // Disables map rotation
extent: ext.extent//,
//minScale: 0, // User cannot zoom out beyond a scale of 1:500,000
//maxScale: 140000
};
}
function grabStatistics(qry){
var find = new FindTask({ url: "https://services6.arcgis.com/3R3y1KXaPJ9BFnsU/arcgis/rest/services/ECJWEB_MAP/FeatureServer" });
// Set parameters to only query
var params = new FindParameters({
layerIds: [4],
searchFields: ["CONST_NAME"],
searchText: qry
});
find.execute(params)
.when(showResults)
.catch(rejectedPromise);
}
function showResults(response) {
var results = response.results;
var popup = new BoxMaker();
popup.makePopupNode(response.results.length,response.results[0].feature.attributes);
}
function rejectedPromise(){
console.error("Promise didn't resolve: ", err.message);
}
//RESET MAP POSITION
function resetMap(){
Propsy.resetMap(view,clearSearch());
}
//CLEAR SEARCH BOX
function clearSearch(evt){
var searchBar = document.getElementById("top-band-search");
searchBar.value = "";
searchBar.focus();
}
//CLEAR RESULTS PANEL
function clearSearchResults(evt){
document.getElementById("slide-content-results").innerHTML = "";
document.getElementById("slide-content-results-status").innerHTML ="0 result(s) found";
document.getElementById("search-bar").focus();
}
//CLOSE PANEL
function closePanelMeth(evt){
var el = evt.target;
var searchBar = document.getElementById("search-bar");
var searchTools = document.getElementById("search-box-tools");
var searchBarStatus = document.getElementById("search-box-status");
var searchResults = document.getElementById("slide-content-results");
if(DomClass.contains(el.parentNode.parentNode, "show")){
DomClass.replace(el.parentNode.parentNode, "hide", "show");
DomClass.replace(el, "fa-chevron-right", "fa-chevron-left");
DomClass.replace(searchBarStatus, "hide", "show");
DomClass.replace(searchResults, "hide", "show");
DomClass.replace(searchTools, "hide", "show");
setTimeout(function(){DomClass.replace(searchBar, "hide", "show"); el.parentNode.parentNode.setAttribute("isVisible", false); }, 50);
}else{
DomClass.replace(el.parentNode.parentNode, "show", "hide");
DomClass.replace(el, "fa-chevron-left", "fa-chevron-right");
DomClass.replace(el, "show", "hide");
DomClass.replace(searchResults, "show", "hide");
DomClass.replace(searchBarStatus, "show", "hide");
DomClass.replace(searchBar, "show", "hide");
DomClass.replace(searchTools, "show", "hide");
el.parentNode.parentNode.setAttribute("isVisible", true);
searchBar.focus();
}
}
//CHECK FOR INVALID INPUT IN SEARCH BOX
function textChecker(evt){
var inputText = (evt.type === "click")? evt.target.previousElementSibling.previousElementSibling.value.trim() :evt.target.value.trim();
if(evt.keyCode === 13 || evt.buttons === 0 && inputText.length > 1){
//START SEARCHING
searchDataCenter(inputText);
}else if(!inputText.match(/^[a-zA-Z .]+$/) ){
alert("Invalid characters entered");
}
}
//RUN SEARCH QUERY
function searchDataCenter(string){
Propsy.toggleLoadingBar(true);
string = Propsy.fixText(string);
var queryTask = new QueryTask({url: "https://services6.arcgis.com/3R3y1KXaPJ9BFnsU/arcgis/rest/services/ECJWEB_MAP/FeatureServer/8"});//ED
var queryTask2 = new QueryTask({url: "https://services6.arcgis.com/3R3y1KXaPJ9BFnsU/arcgis/rest/services/ECJWEB_MAP/FeatureServer/4"});//CONSTI
var queryTask3 = new QueryTask({url: "https://services6.arcgis.com/3R3y1KXaPJ9BFnsU/arcgis/rest/services/ECJWEB_MAP/FeatureServer/5"});//PARISH
// var queryTask4 = new QueryTask({url: "https://services6.arcgis.com/3R3y1KXaPJ9BFnsU/arcgis/rest/services/ECJWEB_MAP/FeatureServer/3"});//OFFICES
var query = new Query();
query.where = "ED_NAME LIKE '%"+string+"%'";
query.outFields = ["*"];
//query.orderByFields = (searchType == 1)?["PARISH_NAM ASC"] : ["PARISH_NAME ASC"];
query.returnGeometry = true;
query.outSpatialReference = view.extent.spatialReference;
var query2 = new Query();
query2.outFields = ["*"];
query2.where = "CONST_NAME LIKE '%"+string+"%'";
query2.returnGeometry = true;
query2.outSpatialReference = view.extent.spatialReference;
var query3 = new Query();
query3.outFields = ["*"];
query3.where = "PARISH_NAM LIKE '%"+string+"%'";
query3.returnGeometry = true;
query3.outSpatialReference = view.extent.spatialReference;
// var query4 = new consti.createQuery();
// query4.outFields = ["*"];
// query4.where = "OFFICE_NAME LIKE '%"+string+"%'";
// query4.returnGeometry = true;
// query4.outSpatialReference = view.extent.spatialReference;
queryTask.execute(query).then(function(result){
edresults = [];
consresults = [];
parishresults = [];
officeresults = [];
//ADD RESULTS TO CONTAINER
for(var i=0; i < result.features.length; i++){
var item = result.features[i];
edresults[item.attributes.OBJECTID] = {
parish: item.attributes.PARISH_NAM,
regNum: item.attributes.REGION_NO,
consName: item.attributes.CONST_NAME,
consNum: item.attributes.CONST_NO,
ed: item.attributes.ED_NAME,
edNum: item.attributes.ED_NO,
id: "ed_"+item.attributes.OBJECTID
};
geometryArr["ed_"+item.attributes.OBJECTID] = item.geometry;
}
queryTask2.execute(query2).then(function(result){
console.log("result.features");
for(var i=0; i < result.features.length; i++){
var item = result.features[i];
consresults[item.attributes.OBJECTID] = {
parish: item.attributes.PARISH_NAME,
regNum: item.attributes.REGION_NO,
consName: item.attributes.CONST_NAME,
consNum: item.attributes.CONST_NO,
//ed: item.attributes.ED_NAME,
id: "cons_"+item.attributes.OBJECTID
};
geometryArr["cons_"+item.attributes.OBJECTID] = item.geometry;
}
// queryTask4.execute(query4).then(function(result){
// //console.log("result.features");
// for(var i=0; i < result.features.length; i++){
//
// var item = result.features[i];
// officeresults[item.attributes.OBJECTID] = {
// name: item.attributes.OFFICE_NAME,
// parish: item.attributes.PARISH,
// tel: item.attributes.Telephone_No_,
// address: item.attributes.FULL_ADDRESS,
// consNum: item.attributes.CONST_NO,
// geotag: item.attributes.GEO_TAG,
// id: "office_"+item.attributes.OBJECTID
// };
//
// geometryArr["office_"+item.attributes.OBJECTID] = item.geometry;
//
// }
// });
queryTask3.execute(query3).then(function(result){
for(var i=0; i < result.features.length; i++){
var item = result.features[i];
parishresults[item.attributes.OBJECTID] = {
parish: item.attributes.PARISH_NAM,
id: "parish_"+item.attributes.OBJECTID
};
geometryArr["parish_"+item.attributes.OBJECTID] = item.geometry;
}
Propsy.toggleLoadingBar(false);
parseResults(string);
punchQuerySite(string);
});
});
}, function(error){
console.log(error); // Will print error in console if unsupported layers are used
});
}
//SET CLICKED RESULT AS ACTIVE
function selectCurrentResult(evt){
if(evt.which === 3 || evt.which === 2)
return;
var el = document.getElementsByClassName("search-result-active");
if(el[0])
DomClass.remove(el[0], "search-result-active");
if(evt.target.parentNode.classList.contains("search-result-active")){
DomClass.remove(el[0], "search-result-active");
graphicsLayer.removeAll();
}else{
DomClass.add(evt.selectorTarget, "search-result-active");
var id = evt.selectorTarget.getAttribute("id");
graphicsLayer.removeAll();
var tempGrph = new Graphic({
id: id,
geometry: geometryArr[id],
attributes: null,
symbol: polygonSymbol,
popuptemplate:null,
visible: true
});
//highlightSelect = layerView.highlight(geometryArr[id]);
graphicsLayer.add(tempGrph);
zoomToArea(tempGrph);
setTimeout(()=>{graphicsLayer.remove(tempGrph)},2000);
if(id[0] == "c"){
showConstiDetails(tempGrph);
}
console.log(geometryArr[id]);
console.log(evt.selectorTarget);
console.log(tempGrph);
}
}
//GET RANDOM COLOR FOR TITLE BAR OF SEARCH RESULT
function grabColor(){
var col = colorPool[Math.floor(Math.random() * colorPool.length)];
return col;
}
//TOGGLE SEARCH
function toggleSearch(){
Propsy.toggleSearch("top-band-right-content");
}
//FORMAT SEARCH RESULT
function parseResults(needle){
needle = needle.toUpperCase();
var resultCount = 0;
var resultsCounter = document.getElementById("data-search-results-info");
var dataContainer = document.getElementById("data-search-results-list");
var container = document.getElementById("data-search-results-container");
dataContainer.innerHTML = "";
container.style.left = '0px';
dataContainer.innerHTML += "<div class='results-separator'>--Parish--</div>";
parishresults.forEach(function(element){
resultCount+=1;
dataContainer.innerHTML += formatParishResult(element,needle);
});
dataContainer.innerHTML += "<div class='results-separator'>--Constituency--</div>";
consresults.forEach(function(element) {
resultCount+=1;
dataContainer.innerHTML += formatConstituencyResult(element,needle);
});
// dataContainer.innerHTML += "<div class='results-separator'>--Electoral Division--</div>";
// edresults.forEach(function(element) {
// resultCount+=1;
// dataContainer.innerHTML += formatEDResult(element, needle);
//
// });
if(resultCount === 0){
dataContainer.innerHTML = "<div class='center-text'>No results found :(</div>";
resultsCounter.innerHTML = "0 results found";
}else{
resultsCounter.innerHTML = "Found "+resultCount +" results matching <br>\"<b>" + needle+"</b>\"";
}
}
//FORMAT PARISH RESULTS
function formatParishResult(item,needle){
var re = new RegExp(needle, "g");
var itemNode = "<div class='search-result' id='"+item.id+"'>"+
"<div class='search-result-indicator'></div>"+
"<div class='search-result-title'><i class='fa fa-search' aria-hidden='true'></i> "+item.parish+"</div>"+
"</div>";
return itemNode.replace(re, "<span class='highlight-letters'>"+needle+"</span>");
}
//FORMAT CONSTITUENCY RESULTS
function formatConstituencyResult(item, needle){
var re = new RegExp(needle, "g");
//onclick='selectCurrentResult()'
var itemNode = "<div class='search-result' id='"+item.id+"'>"
+ "<div class='search-result-indicator'></div>"
+"<div class='search-result-title'><i class='fa fa-search' aria-hidden='true'></i> "+item.parish+"</div>"
+ "<div class='search-result-body'>"
+ item.consName
+ "</div>"
+ "</div>";
return itemNode.replace(re, "<span class='highlight-letters'>"+needle+"</span>");
}
//DISPLAY ED LAYERS FROM LIST
function formatEDResult(item, needle){
var re = new RegExp(needle, "g");
var itemNode = "<div class='search-result' id='"+item.id+"'>"
+ "<div class='search-result-indicator'></div>"
+"<div class='search-result-title'><i class='fa fa-search' aria-hidden='true'></i> "+item.parish+"</div>"
+ "<div class='search-result-body'>"
+ item.consName + "<br>"
+ "ED Name: " + item.ed + "<br>"
+ "ED#: " + item.edNum
+ "</div>"
+ "</div>";
return itemNode.replace(re, "<span class='highlight-letters'>"+needle+"</span>");
}
//CLOSE RESULTS PANEL
function closeResults(e){
e.target.parentElement.style.left = "-330px";
clearSearch();
resetMap();
}
//ZOOM IN TO TARGET AREA
function zoomToArea(grph){
view.goTo( grph,{animate: true, duration: 1500, easing: 'ease-out'});
}
//CHECK IF VIEW IS ANIMATING
function checkAnimating(){
// Get the new extent of the view only when view is stationary.
if (view.extent) {
var currXMax = view.extent.xmax.toFixed(2);
var currYMax = view.extent.ymax.toFixed(2);
var currXMin = view.extent.xmin.toFixed(2);
var currYMin = view.extent.ymin.toFixed(2);
var padding = 100000;
if((initialExtent.xmin-padding) > currXMin || initialExtent.ymin > currYMin || initialExtent.xmax + padding < currXMax || initialExtent.ymax < currYMax){
//Propsy.resetMap(view);
}
}
if(view.center){
if(initialExtent === null){
initialExtent = view.extent;
return;
}
//MOVE POPUP WINDOW IN ACCORDANCE WITH MAPVIEW
if(circleBuffer){
Propsy.moveWindow("popup-block-container", circleBuffer);
}
}
if(view.scale){
Propsy.updateScale("map-position",view.scale);
}
// if(view.scale){
// if(view.scale < 140000){
// view.scale = 144448;
// var popupContainer = document.getElementById("popup-block-container");
// var imgtag = document.getElementById("popup-block-img");
// var title = document.getElementById("popup-block-title");
// var details = document.getElementById("popup-block-details");
//
// details.innerHTML = "";
//
// details.innerHTML += "<span class='popup-block-detail-title'>For information not displayed, please feel free to contact the Electoral Office of Jamaica - GIS Department.</span></br>";
// details.innerHTML += "<span class='popup-block-detail-line'><span class='popup-block-detail-title'>Address</span>";
// details.innerHTML += "<span class='popup-block-detail-line'> 43 Duke Street, Kingston, Jamaica </span></br/>";
// details.innerHTML += "<span class='popup-block-detail-line'><span class='popup-block-detail-title'>Contact</span>";
// details.innerHTML += "<span class='popup-block-detail-line'> Tel: (876)-922-0425-9 </span>";
// details.innerHTML += "<span class='popup-block-detail-line'> Toll-Free: 1-888-991-VOTE (8683) </span>";
// details.innerHTML += "<span class='popup-block-detail-line'> Fax: (876) 922-4058 </span></br>";
// details.innerHTML += "<span class='popup-block-detail-line'><span class='popup-block-detail-title'>Opening Hours</span>Mon-Thu. 8:30AM - 5:00PM</span>";
// details.innerHTML += "</span>Fri. 8:30AM - 4:00PM</span>";
// //imgtag.src = "officeimgs/8 HEAD OFFICE DUKE STREET 2.JPG";
// imgtag.style.display = "none";
// details.style.width = "120%";
// title.innerHTML = "NOTICE";
// title.style.color = "red";
// //setTimeout(function(){
// popupContainer.style.width = "850px";
// popupContainer.style.height = "294px";
// popupContainer.style.display = "block";
// popupContainer.style.top = "236px";
// popupContainer.style.opacity = "1";
// popupContainer.style.zIndex = "16";
//
//
//
// return;
// }
//
// $('#bottom-band-scale').text("Scale 1 : "+addCommas(view.scale.toFixed(0)));
// if(view.scale.toFixed(0) < 576000){
// $('#results-summary-container').fadeOut('medium');
// }else{
// $('#results-summary-container').fadeIn('medium');
// }
//}
}
//EXPAND POPUP IMAGE
function expandImage(target){
Propsy.expandImage(target);
}
var screenClick;
//PARSE MULTI OFFICE POINTS
function parseMultipleOffices(pointsArr){
// console.log(pointsArr);
// pointsArr.map( function(feat){
// console.log(feat[0]);
// });
graphicsLayer.removeAll();
let origin = circleBuffer.center;
let offsetX = 0;
let offsetY = 4000;
let pLine = new Polyline({spatialReference: view.spatialReference});
let grphArr = [], knobs = [];
var textSymbol = {
type: "text", // autocasts as new TextSymbol()
color: "red",
haloColor: "black",
haloSize: "2",
text: "You are here",
xoffset: 30,
yoffset: 10,
angle: -25,
spatialReference: view.spatialReference,
font: { // autocast as new Font()
size: 13,
family: "sans-serif",
weight: "bold"
}
};
for(var i=0; i < pointsArr.length; i++){
//pointsArr.map( function(feat){
console.log(pointsArr[i].attributes);
//console.log(pointsArr[i].attributes.OFFICE_NAME);
//for(var i=0; i < pointsArr.length; i++){
let pointX = (i===0)? origin.x : origin.x + (offsetX+= 800);
let pointY = origin.y + offsetY;
pLine.addPath([
new Point(pointX, pointY),
origin
]);
grphArr.push(new Graphic({
geometry: pLine,
symbol: polylineSymbol,
attributes: {type: 'line'}
}));
knobs.push(new Graphic({
geometry: new Point({x:pointX, y:pointY, spatialReference: view.spatialReference}),
symbol: pointKnob//,
//attributes: {type:"knob"},
//popupTemplate: {"title":pointsArr[i].attributes.OFFICE_NAME},
//defaultPopupTemplateEnabled: true
}));
textSymbol.text = pointsArr[i].attributes.OFFICE_NAME;
graphicsLayer.add(new Graphic({
symbol: textSymbol,
geometry: new Point({x:pointX+150, y:pointY+280, spatialReference: view.spatialReference})
}));
//showOfficeDetails(feat);
//}
//});
}
graphicsLayer.addMany(grphArr);
graphicsLayer.addMany(knobs);
}
//CALLBACK FOR GRAPHICS HOVER
function getGraphics(response) {
//loop through all the layers.graphics and remove any with the highfillsymbol
var gra = response.results[0].graphic;
if(gra.attributes.type === "point"){
graphicsLayer.remove(gra);
console.log(typeof(gra));
}else{
return;
}
}
//LOAD CONTEXT MENU
function loadContextMenu(evt){
}
//CLOSE POPUP BLOCK
function closePopupBlock(evt){
// var imgtag = document.getElementById("popup-block-img");
//var details_tag = document.getElementById("popup-block-details");
//imgtag.style.display = "block";
//details_tag.style.width = "43%";
evt.target.parentNode.parentNode.parentNode.parentNode.style.opacity = "0";
evt.target.parentNode.parentNode.parentNode.parentNode.style.top = "-1920px";
//evt.target.parentNode.parentNode.parentNode.parentNode.style.width = "660px";
setTimeout(function(){
evt.target.parentNode.parentNode.parentNode.parentNode.style.display = "none";
}, 500);
//evt.target.parentNode.parentNode.parentNode.remove();
view.graphics.removeAll();
}
//PUNCH WEBSITE
function punchSite(){
if(detectIE() !== -1){
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState === 4 && this.status === 200) {
if(JSON.stringify(this.responseText).res){
storeSetItem("visited-ecj","true");
}
}
};
xhttp.open("POST", "http://webgisrv:5400/sitehits/hitwebsite", true);
xhttp.setRequestHeader("Content-type", "application/json");
xhttp.send(JSON.stringify({siteType: "ecj"}));
return;
}
if(window.localStorage.getItem("visited-ecj") !== null || window.localStorage.getItem("visited-ecj") !== "undefined" ){
return;
}
fetch('http://webgisrv:5400/sitehits/hitwebsite', {
method: 'POST',
body: JSON.stringify({siteType: "ecj"}),
headers: {
"Content-type": "application/json"
}
}).then(function(){
return response.json();
}).then(function (data){
if(JSON.stringify(this.responseText).res){
storeSsetItem("visited-ecj","true");
}
}).catch(function(error){
console.log(error);
});
}
//PUNCH QUERY
function punchQuerySite(term){
if(detectIE() !== -1){
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState === 4 && this.status === 200) {
console.log(this.responseText);
}
};
xhttp.open("POST", 'http://webgisrv:5400/sitehits/hitquery', true);
xhttp.setRequestHeader("Content-type", "application/json");
xhttp.send(JSON.stringify({siteType: "ecj", searchTerm: term, toke: generateToke()}));
return;
}
fetch('http://webgisrv:5400/sitehits/hitquery', {
method: 'POST',
body: JSON.stringify({siteType: "ecj", searchTerm: term, toke: generateToke()}),
headers: {
"Content-type": "application/json"
}
}).then(function(response){
return response.json();
}).then(function (data){
if(data.res){
console.log(data.msg);
}
}).catch(function(error){
console.log(error);
});
}
});
Also see: Tab Triggers