POST
|
I've started to use v.4.4 of the api today and I wondered if it's possible to use the draw and buffer or if you would suggest I stuck with 3.2 for now? I can't find an update for these functions on the new version sample code examples.Thanks
... View more
09-13-2017
08:35 AM
|
0
|
2
|
514
|
POST
|
I'm using identify to return info about multiple DynamicMapServiceLayers, and using the initializeSidebar function rather than a popup. This works fine but 3 of my services contain related data in a table that I'd like to identifya layer on so that it brings back the related fields in an additional side panel that's different from the initial identify For example I identify layer 1 - it has a field called UNIT1. That field is related to table 1 field UNIT2. I want the additional relationship identify to return all the data in the table including 'UNIT2' in a different side panel. I've carried out a bit of research online but can't really understand how to return the related fields. Can anyone help? This is the first part of my code to identify the layer: function executeIdentifyTask(event) { IdentifyParams.geometry = event.mapPoint; IdentifyParams.mapExtent = map.extent; var deferred = identifyTask .execute(IdentifyParams) .addCallback(function (response) { // response is an array of identify result objects // Let's return an array of features. return arrayUtils.map(response, function (result) { var feature = result.feature; var layerName = result.layerName; feature.attributes.layerName = layerName; if (layerName === 'My Layer') { var taxParcelTemplate = new InfoTemplate("", "My layer <br/> <b>UNIT1:<b> ${UNIT1} "); feature.setInfoTemplate(taxParcelTemplate); } return feature; }); }); map.infoWindow.setFeatures([deferred]); map.infoWindow.show(event.mapPoint); } This is the 2nd part to add the results of the identify in a side panel; function initializeSidebar(map) { var popup = map.infoWindow; //when the selection changes update the side panel to display the popup info for the //currently selected feature. connect.connect(popup, "onSelectionChange", function () { displayPopupContent(popup.getSelectedFeature()); }); //when the selection is cleared remove the popup content from the side panel. connect.connect(popup, "onClearFeatures", function () { //dom.byId replaces dojo.byId //dom.byId("featureCount").innerHTML = "No features were selected, click again on the map layer"; //registry.byId replaces dijit.byId $("#leftPane").html(); domUtils.hide(dom.byId("pager")); }); //When features are associated with the map's info window update the sidebar with the new content. connect.connect(popup, "onSetFeatures", function () { displayPopupContent(popup.getSelectedFeature()); //dom.byId("featureCount").innerHTML = popup.features.length + " feature(s) selected"; //enable navigation if more than one feature is selected //popup.features.length > 1 ? domUtils.show(dom.byId("pager")) : domUtils.hide(dom.byId("pager")); }); } function displayPopupContent(feature) { var content = feature.getContent(); $("#leftPane").html(content); } } function selectPrevious() { map.infoWindow.selectPrevious(); } function selectNext() { map.infoWindow.selectNext(); } });
... View more
10-11-2016
08:14 AM
|
0
|
0
|
514
|
POST
|
Hi Ken - thank you for the response, it's helped alot. I think my problem is the fact I'm using the same 'switch' to add the map as I am to remove it. Other than adding a different switch for each event I'm guessing I should add an if clause ie. if the map layer is 'on' and the switch is clicked again then removeLayer... Olivia
... View more
08-16-2016
02:10 AM
|
0
|
1
|
514
|
POST
|
How can I use dojo.disconnect to remove a map layer I've added. My code doesn't seem to work, it adds the map layer fine but I can't remove it? Any help would be good: <script> var node = dojo.byId("switch1"); var eventHandle = dojo.connect(node, "onclick", function addMapLayer1(e) { var soils1 = new ArcGISDynamicMapServiceLayer("https://map/arcgisserver/mapserver", { opacity: 1, "visible": true }); dojo.disconnect(eventHandle); soils1.setVisibleLayers([1]); map.addLayer(soils1); </script> <html> <div class="switch tiny" style=" float:right;padding-top:0px;"> <input class="switch-input" id="switch1" type="checkbox" name="exampleSwitch"> <label class="switch-paddle" for="switch1"> <span class="switch-active" aria-hidden="true">On</span> <span class="switch-inactive" aria-hidden="true">Off</span> </label> </div> </html>
... View more
08-15-2016
08:41 AM
|
0
|
3
|
1687
|
POST
|
Hi I have an application with 3 feature layers and a select option. When the user clicks on a polygon for example the attributes for the related fields is returned. This is fine for attributes that are text based but I cannot figure out how to show a link within the infoTemplate rather than just the full string. e.g. var content = "<b>Classification year</b>: ${CLASSIFICATION_YEAR}" + "<br/>" +
"<b>Overall classification</b>: ${OVERALL_CLASSIFICATION}" + "<br/>" +
"<b>Link</b>: ${CLASS_DS_URL}";
var infoTemplate = new InfoTemplate("${WATER_BODY_NAME}", content); The class_ds_url shows the full string but how can I amend the script so it just has a clickable 'Link'?? Help is appreciated!
... View more
01-22-2016
04:28 AM
|
0
|
2
|
1610
|
POST
|
So for examples instead of: var queryTask = new QueryTask("http://arcgis/rest/services/live/SEARCH/MapServer/15");
var query = new Query();
query.returnGeometry = false;
query.outFields = [
"NAME"
];
]; I would do this: var queryTask = new QueryTask(jsonString);
var query = new Query();
query.returnGeometry = false;
query.outFields = [
"NAME"
];
]; I can't seem to find any examples of it and just wondered if it's possible? Thanks
... View more
08-27-2015
02:50 AM
|
0
|
1
|
2353
|
POST
|
Hi I'm wondering if someone could help with this query. I am running a queryTask on a service which returns a postcode polygon on a map. I want to give the user the option to select from multiple results so that in case it returns more than one postcode result the user can then select the correct postcode from a dropdown. My current code is as follows: function execute() {
//
var queryTask = new QueryTask("http://mapservice1");
var query = new Query();
query.returnGeometry = true;
query.outFields = [
"POSTCODE"
];
query.text = dom.byId("Postcode").value.toUpperCase();
queryTask.execute(query, showResults);
};
function showResults(results) {
var resultItems = [];
var inBuffer = [];
var resultCount = results.features.length;
for (var i = 0; i < resultCount; i++) {
inBuffer.push(results.features.geometry);
var featureAttributes = results.features.attributes;
var graphic = results.features;
graphic.setSymbol(symbol);
map.graphics.add(graphic);
var strNum = 100;
var newExtent = graphic.geometry.getExtent();
newExtent.xmin = newExtent.xmin - strNum;
newExtent.ymin = newExtent.ymin - strNum;
newExtent.xmax = newExtent.xmax + strNum;
newExtent.ymax = newExtent.ymax + strNum;
map.setExtent(newExtent);
for (var attr in featureAttributes) {
resultItems.push("<b>" + attr + ":</b> " + featureAttributes[attr] + "<br>");
}
resultItems.push("<br>");
}
var query2 = new Query();
query2.geometry = geometryEngine.union(inBuffer);
query2.returnGeometry = false;
query2.outFields = ["NAME", "OBJECTID"];
var queryTask2 = new QueryTask("http://e/SEARCH/MapServer/15");
Should I add an extra function before 'showResults' in the case that the queryTask returns multiple postcode results? Any help would be appreciated.
... View more
08-18-2015
02:37 AM
|
0
|
0
|
2316
|
POST
|
I'm trying to add REST map services from a JSON file I have. The file includes the service url values and I'd like to add these to a map. Users click on a table of contents and the service name and owner are returned including the url text but not sure how to add the service to my basemap: $(document).ready(function () {
for (index in jsonString.Land) {
$('#land ul').append('<li><a href="#" data-owner="' + jsonString.Land[index].owner + '">' + jsonString.Land[index].name + '</a></li>');
}
for (index in jsonString.Air) {
$('#air ul').append('<li><a href="#" data-url="' + jsonString.Air[index].url + '" data-owner="' + jsonString.Air[index].owner + '">' + jsonString.Air[index].name + '</a></li>');
}
for (index in jsonString.Water) {
$('#water ul').append('<li><a href="#" data-url="' + jsonString.Water[index].url + '" data-owner="' + jsonString.Water[index].owner + '">' + jsonString.Water[index].name + '</a></li>');
}
for (index in jsonString.Heritage) {
$('#heritage ul').append('<li><a href="#" data-url="' + jsonString.Heritage[index].url + '" data-owner="' + jsonString.Heritage[index].owner + '">' + jsonString.Heritage[index].name + '</a></li>');
}
for (index in jsonString.Waste) {
$('#waste ul').append('<li><a href="#" data-url="' + jsonString.Waste[index].url + '" data-owner="' + jsonString.Waste[index].owner + '">' + jsonString.Waste[index].name + '</a></li>');
}
$('a').on('click', function () {
$('#show').html($(this).attr('data-owner') + '<br>' + $(this).attr('data-url'));
});
}); I'd hope to add a variable featurelayer that indexes the JSON string?
... View more
07-16-2015
07:40 AM
|
0
|
0
|
4175
|
POST
|
Just cannot get it to return the local authority. I will just keep trying. Thank you very much for your help, it has been very helpful.
... View more
07-07-2015
08:00 AM
|
0
|
0
|
158
|
POST
|
Afraid it doesn't seem to return anything?: var query2 = new Query(); query2.geometry = geometryEngine.union(inBuffer); query2.returnGeometry = false; query2.outFields = ["NAME"]; var queryTask2 = new QueryTask("http://rest/services/live/SEARCH/MapServer/15"); queryTask2.execute(query2, function (results2) { for (var j = 0; j < results2.features.length; j++) { resultItems.push("<b>Local Authority:</b> " + results2.features .attributes.NAME + "<br>"); } dom.byId("info").innerHTML = resultItems.join(""); console.log(); }); dom.byId("results") function addToMap(result) { } my html: <body> Postcode : <input type="text" id="Postcode" value=""> <input id="execute" type="button" value="Get Details"> <br /> <br /> <div id="info" style="padding:5px; margin:5px; background-color:#eee;"> </div> <table id="mapTable"><tr><td><div id="map"></div></td></tr> </table> <div id="result" style="padding:5px; margin:5px; background-color:#00ff90;"> </div> </body>
... View more
07-07-2015
05:40 AM
|
0
|
2
|
694
|
POST
|
Hi Steve Thank you for the help. I added the console.log as you suggested and I got this: Hopefully you can make out the attributes: Object NAME: Glasgow City' so yes it works. Just need to work out how to get that onto the screen as a widget now! Lots to learn... Olivia
... View more
07-07-2015
04:48 AM
|
0
|
4
|
694
|
POST
|
Hi Robert I added the geometryEngine module but I am still not getting back a local authority. I'm wondering if it's something to do with my html now?? The attached code returns the polygon showing the postcode polygon but still no local authority??
... View more
07-07-2015
03:23 AM
|
0
|
6
|
694
|
POST
|
I'm using an OS services layer so there is no opportunity for me to amend the features in the layer unfortunately. I really need a layer that includes the postcode and the local authority but unfortunately they are held separately. I will keep plodding on and also have a look at codepoint as you suggest. Thank you.
... View more
07-06-2015
08:44 AM
|
0
|
8
|
694
|
POST
|
It work to an extent although I still don't get the local authority name back?? I've attached my code for info...Perhaps I've been staring at it for too long??
... View more
07-06-2015
08:29 AM
|
0
|
2
|
888
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|