POST
|
Is there a way to change the map display color for a esri WMSLayer? The only interactive method that is similar to what I am trying to do is setOpacity() var wmsLayer = new WMSLayer(wms, {
resourceInfo : resourceInfo,
format : "format",
transparent : true,
visibleLayers : ['8']
});
wmsLayer.setOpacity(0.9);
... View more
02-24-2016
12:13 PM
|
0
|
0
|
1222
|
POST
|
Thanks Ken... I followed up with another question this morning. This one really has me stumped... especially when it seemed to work fine using the old style dojo.connect.
... View more
02-23-2016
04:57 AM
|
0
|
1
|
933
|
POST
|
I have a map where I have a KMLLayer that defines a geographic boundary and a CSVLayer that defines points within that boundary. I do not want any infoWindow information popping up for the KMLLayer and want to take some actions on the click event on the CSVLayer. In building this page, I have found that I can no longer apply a click event to the CSVLayer once I have added the KMLLayer to the map. Seems like it would not be too difficult... but I have played with multiple instances of this and keep coming back to the same place. Any help appreciated. var map, kml, csv;
require(["esri/map", "esri/layers/KMLLayer", "esri/layers/CSVLayer", "esri/renderers/SimpleRenderer", "esri/InfoTemplate", "esri/urlUtils", "esri/symbols/PictureMarkerSymbol", "esri/geometry/Point", "esri/SpatialReference", "esri/geometry/webMercatorUtils", "esri/geometry/screenUtils", "esri/geometry/ScreenPoint", "dojo/dom", "dojo/_base/array", "dojo/domReady!"], function(Map, KMLLayer, CSVLayer, SimpleRenderer, InfoTemplate, urlUtils, PictureMarkerSymbol, Point, SpatialReference, webMercatorUtils, screenUtils, ScreenPoint, dom, array) {
map = new Map("map", {
basemap : "hybrid",
center : [-83.71, 36.05],
zoom : 8
});
map.on("load", function() {
map.infoWindow.set('anchor', 'bottom-right');
map.infoWindow.resize(625, 425);
});
map.infoWindow.on("hide", centerMap);
urlUtils.addProxyRule({
proxyUrl : "/proxy/proxy.php",
urlPrefix : "www.srh.noaa.gov"
});
var template = new InfoTemplate("${name}", "<iframe src=${fcstlink} class="fcst"></iframe>");
var csvUrl = "http://www.srh.noaa.gov/images/rtimages/mrx/js_local/riverpoints.csv";
csv = new CSVLayer(csvUrl, {
copyright : "weather.gov",
infoTemplate : template
});
var logo = new PictureMarkerSymbol("http://www.srh.noaa.gov/images/mrx/surf.png", 20, 20);
var renderer = new SimpleRenderer(logo);
csv.setRenderer(renderer);
map.addLayer(csv);
csv.on("click", mapFcstAction);
var kmlUrl = "http://www.srh.noaa.gov/images/rtimages/mrx/kml/RiversLakes.kml";
kml = new KMLLayer(kmlUrl);
map.addLayer(kml);
kml.on('load', function(lyr) {
var layers = lyr.layer.getLayers();
array.forEach(layers, function(l) {
l.setInfoTemplate(null);
});
});
function centerMap() {
alert("CENTER");
map.graphics.clear();
map.centerAt([-83.71, 36.05]);
}
function mapFcstAction(evt) {
alert("FCST");
map.infoWindow.show(evt.screenPoint);
var screenX = evt.screenPoint.x;
var screenY = evt.screenPoint.y;
var newScreenX = screenX + 225;
var newScreenY = screenY + 250;
var newScreenCenter = screenUtils.toMapPoint(map.extent, 800, 550, new ScreenPoint(newScreenX, newScreenY));
map.centerAt(newScreenCenter);
}
});
... View more
02-23-2016
04:53 AM
|
0
|
0
|
1411
|
POST
|
Ken.. thanks again. I did run into a recurrence of the original problem. Now when I click on the csv points... I cannot get them to execute the click event that I had set up. Was wondering if you could see what might be going wrong. It is almost as if the csv layer is "beneath" the kml layer and therefore cannot have the csv.on("click", mapFcstAction) called. The map.infowindow.on("hide", centerMap) call seems to work fine. Kind of spinning my wheels right now with this. Eric map = new Map("map", {
basemap : "hybrid",
center : [-83.71, 36.05],
zoom : 8
});
map.on("load", function() {
map.infoWindow.set('anchor', 'bottom-right');
map.infoWindow.resize(625, 425);
});
map.infoWindow.on("hide", centerMap);
urlUtils.addProxyRule({
proxyUrl : "/proxy/proxy.php",
urlPrefix : "www.srh.noaa.gov"
});
var template = new InfoTemplate("${name}", "<iframe src=${fcstlink} class="fcst"></iframe>");
var csvUrl = "http://www.srh.noaa.gov/images/rtimages/mrx/js_local/riverpoints.csv";
csv = new CSVLayer(csvUrl, {
copyright : "weather.gov",
infoTemplate : template
});
var logo = new PictureMarkerSymbol("http://www.srh.noaa.gov/images/mrx/surf.png", 20, 20);
var renderer = new SimpleRenderer(logo);
csv.setRenderer(renderer);
map.addLayer(csv);
csv.on("click", mapFcstAction);
var kmlUrl = "http://www.srh.noaa.gov/images/rtimages/mrx/kml/RiversLakes.kml";
kml = new KMLLayer(kmlUrl);
map.addLayer(kml);
kml.on('load', function(lyr) {
var layers = lyr.layer.getLayers();
array.forEach(layers, function(l) {
l.setInfoTemplate(null);
});
});
function centerMap() {
alert("CENTER");
map.graphics.clear();
map.centerAt([-83.71, 36.05]);
}
function mapFcstAction(evt) {
alert("FCST");
map.infoWindow.show(evt.screenPoint);
var screenX = evt.screenPoint.x;
var screenY = evt.screenPoint.y;
var newScreenX = screenX + 225;
var newScreenY = screenY + 250;
var newScreenCenter = screenUtils.toMapPoint(map.extent, 800, 550, new ScreenPoint(newScreenX, newScreenY));
map.centerAt(newScreenCenter);
}
... View more
02-22-2016
12:12 PM
|
0
|
3
|
933
|
POST
|
Ken, Thank you so much for the help. That was the solution. I appreciate your time. I made the changes from dojo.connect(kml, 'onLoad', function(lyr) { var layers = lyr.getLayers(); dojo.forEach(layers, function(lyr) { lyr.setInfoTemplate(null); }); }); to kml.on("load", function(lyr) {
var layers = lyr.getLayers();
dojo.forEach(layers, function(lyr) {
lyr.setInfoTemplate(null);
});
}); and when I try to set the InfoTemplate to null so that it does not show up when a user clicks on the map... It is now causing the entire kml shape to no longer display. With the kml.on("load", function... the map looks like With the dojo connect function the kml layer appears without the ability to click on that layer and have an info window display. In the interest of coding this up properly with .on instead of dojo.connect... can anyone tell me what is going wrong? I appreciate the help thus far.
... View more
02-22-2016
08:08 AM
|
0
|
5
|
933
|
POST
|
Ken... Thanks for the reply. I was trying to access the CSVlayer click event but could not get it to work. Stupid question but I get access to the map click event via map.on("click", mapClickAction); How do I get access to the CSVLayer object click event?
... View more
02-19-2016
12:00 PM
|
0
|
7
|
933
|
POST
|
I have a CSVLayer that I loaded into a web application. The data that I want to display within the infowindow of that CSVLayer is too large to display nicely in the existing map window. Therefore when I click on a point within that CSVLayer, I need to execute some code that re-centers the map such that the entire infowindow is displayed within the map. The problem that I have is that I cannot figure out how to create a click event on just the CSVlayer. Currently I have a click event triggered on the map as a whole.. which does the recentering for me, but this proved problematic if I end up clicking on any other part of the map. In those cases, there is no infowindow to open and the map will still be forced to re-center. Below is my code for this application. <script src="http://js.arcgis.com/3.15/"></script>
<script>
var map, kml, csv;
require(["esri/map", "esri/layers/KMLLayer", "esri/layers/CSVLayer", "esri/renderers/SimpleRenderer", "esri/InfoTemplate", "esri/urlUtils", "esri/symbols/PictureMarkerSymbol", "esri/geometry/Point", "esri/SpatialReference", "esri/geometry/webMercatorUtils", "esri/geometry/screenUtils", "esri/geometry/ScreenPoint", "dojo/dom", "dojo/_base/array", "dojo/domReady!"], function(Map, KMLLayer, CSVLayer, SimpleRenderer, InfoTemplate, urlUtils, PictureMarkerSymbol, Point, SpatialReference, webMercatorUtils, screenUtils, ScreenPoint, dom, array) {
map = new Map("map", {
basemap : "hybrid",
center : [-83.71, 36.05],
zoom : 8
});
map.on("load", function() {
map.infoWindow.set('anchor', 'bottom-right');
map.infoWindow.resize(625, 425);
map.on("mouse-move", showCoordinates);
map.on("mouse-drag", showCoordinates);
});
var kmlUrl = "http://www.srh.noaa.gov/images/rtimages/mrx/kml/RiversLakes.kml";
kml = new KMLLayer(kmlUrl);
map.addLayer(kml);
dojo.connect(kml, 'onLoad', function(lyr) {
var layers = lyr.getLayers();
dojo.forEach(layers, function(lyr) {
lyr.setInfoTemplate(null);
});
});
urlUtils.addProxyRule({
proxyUrl : "/proxy/proxy.php",
urlPrefix : "www.srh.noaa.gov"
});
var template = new InfoTemplate("${name}", "<iframe src=${fcstlink} class="fcst"></iframe>");
var csvUrl = "http://www.srh.noaa.gov/images/rtimages/mrx/js_local/riverpoints.csv";
csv = new CSVLayer(csvUrl, {
copyright : "weather.gov",
infoTemplate : template
});
var logo = new PictureMarkerSymbol("http://www.srh.noaa.gov/images/mrx/surf.png", 20, 20);
var renderer = new SimpleRenderer(logo);
csv.setRenderer(renderer);
csv.attr('sites', 'sites');
map.addLayer(csv);
dojo.connect(map.infoWindow, "onHide", centerMap);
map.on("click", mapClickAction);
function showCoordinates(evt) {
var mp = webMercatorUtils.webMercatorToGeographic(evt.mapPoint);
var sp = screenUtils.toScreenGeometry(map.extent, 800, 550, evt.mapPoint);
dom.byId("info").innerHTML = mp.x.toFixed(3) + ", " + mp.y.toFixed(3) + "<br>" + sp.x + " " + sp.y;
}
function centerMap(){
map.graphics.clear();
map.centerAt([-83.71, 36.05]);
return;
}
function mapClickAction(evt) {
var screenX = evt.screenPoint.x;
var screenY = evt.screenPoint.y;
var newScreenX = screenX + 225;
var newScreenY = screenY + 250;
var newScreenCenter = screenUtils.toMapPoint(map.extent, 800, 550, new ScreenPoint(newScreenX, newScreenY));
map.centerAt(newScreenCenter);
}
});
</script>
... View more
02-19-2016
11:32 AM
|
0
|
9
|
2795
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|