POST
|
Maybe you could use the fetchData() Promise from the PortalItem Class instead of the load() Promise you are using right now. You can specify the responseType there. I guess if you choose JSON for example you could possibly reduce workload for fetching the data and speed up your process. PortalItem | ArcGIS API for JavaScript 4.17
... View more
12-04-2020
06:24 AM
|
0
|
4
|
1550
|
POST
|
I have found the setLocale() Method: Localization | ArcGIS API for JavaScript 4.17 But it only seems to apply changes to the widgets which are used within the webmap, but not the actual webmap. For example the webmaps countries are labeled in English but I need it to be in Russian as it was applied to a widget (here in this example I have used the Measurement widget). Does anybody have an idea how to change the labeling language of the webmap itself and not just its components? Thanks in advance! Code require(["esri/views/MapView", "esri/WebMap", "esri/intl", "esri/widgets/Measurement"], function (
MapView,
WebMap,
intl,
Measurement
) {
var webmap = new WebMap({
basemap: 'topo'
});
var view = new MapView({
map: webmap,
container: "viewDiv"
});
const measurement = new Measurement({
view: view,
activeTool: "distance"
});
view.ui.add(measurement, "top-right");
view.when(function () {
intl.onLocaleChange(function(locale) {
console.log("locale changed to: ", locale);
});
intl.setLocale("ru");
});
});
... View more
12-04-2020
06:12 AM
|
0
|
0
|
911
|
POST
|
Hi guys we got some support questions from customers in which we are interested if anyone of you knows more about these issues and maybe how to achieve them with the tools available right now. 1) Is it true right now only points are supported for clustering? If yes: is it planned to support other geometry types as well, e.g. lines and polygons? We already opened an issue and an enhancement request for this topic - see: https://my.esri.com/#/support/cases/02553289 https://my.esri.com/#/support/bugs/ENH-000130897 2) Is is planned to support an „exploding animation“ for clusters on click (and/or mouseover) to get an object for each clustered object to access the individuell object information (via pop-up)? as shown in the uploaded pictures: 2_clusteranimation and 2_clusteranimation_popup 3) Is it true, that right now only FeatureServer services are supported for clustering? If yes: is it planned to support other service types as well, e.g. MapServer services? 4) Are there any plans to adopt the functionality which could make it possible to see which types of features and how many of them per category are clustered? as shown in the uploaded picture: 4_clusteranimation_advancedlabeling Thanks for your suggestions, opinions and information in advance! Best regards! Christian PS: With the currently available tools of the ArcGIS JS API maybe point 2) could be solved like this (maybe even point 4 with a similar approach, just not on a mouse event, but as soon as the MapView is ready) do a hitTest at mouseover/click on cluster https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#hitTest if hitTest isnt' the right choice maybe try query the feature layer at the current pointer position https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html then add the returned features as Graphics to the MapView (obviously adding the needed GraphicsLayer previously) create a popupTemplate for the newly added Graphics if the pointer leaves the current cluster remove all the Graphics from GraphicsLayer
... View more
07-15-2020
06:43 AM
|
0
|
0
|
875
|
POST
|
Thanks Mehdi Pira ! This is definitely a way in the right direction. Although I forgot to mention, that I need to calculate the distances based on a street network (SMP) and the results from your approach are direct lines between the points, right? Thank you anyway for the "Excel Hint" this was also very helpful! If anybody could suggest if I should rather try to implement a solution with ODCM Matrix or CF, maybe just a Route? The only thing we need is the distance in km.
... View more
07-07-2020
01:32 AM
|
0
|
0
|
2133
|
POST
|
Hey guys hoping the network analyst experts can provide me a suggestion for the following task. We have a *.csv file containing about 200k entries each entry lists the origin (XY Point) and the destination (XY Point) and an ID. The only thing we need to get out of the analysis is the Distance in km for each line in the csv file, nothing else (no Route Directions, Shapes etc). CSV ID, start_x, start_y, end_x, end_y values ===============values I was able to implement a script to solve what we need by using a ODCM with arcpy. But the problem is that (if I got it right) the ODCM calculates the routes for every entry which is okay for 1k or something like this but at 200k it takes "years". I am not quite satisfied with this solution because eventually I already know from which origin to which destination the route should be taken and I can't make it work using the Routing approach instead of ODCM. Any suggestions how to solve this? An arcpy or ArcGIS Pro Workflow would be great! Thanks in advance!
... View more
07-06-2020
07:10 AM
|
0
|
0
|
607
|
POST
|
Thanks Robert Scheitlin, GISP for your suggestion I was able to implement it! Here's a code snippet for all of you interested in how it works. 1) Highlight the streets on hover 2) Whenever this happens check the matching "Name" attributes of the streetsymbol and the street itself by applying queryFeatuers on the Streetssymbol FeatureLayer 3) Add the graphic with the matching symbol to the map 4) remove all graphics from graphicslayer before adding a new one var graphicslayer = new GraphicsLayer();
map.add(graphicslayer);
function addNumberGraphic(feature, symbol){
var numgraphic = new Graphic({
attributes: feature.attributes,
geometry: feature.geometry,
symbol: symbol
});
// take the given symbol as "base symbol" and modify it to your needs
numgraphic.symbol.width = 33;
numgraphic.symbol.height = 33;
graphicslayer.add(numgraphic);
}
streetsnumberlayer.queryFeatures().then(function(results){
// check by attributes of feature layer if currentStreetname
// matches the attribute Name of the feature
// if yes
graphicslayer.removeAll();
addNumberGraphic(feature, symbol)
});
... View more
06-25-2020
02:34 AM
|
2
|
0
|
1394
|
POST
|
Hey guys! I have a problem with a functionality we'd like to achieve. We have a map with two FeatureLayers (Streets of a Country, Streetsnumber). Streets of a country has a SimpleRenderer and displays lines on a 2D Map containing the streets in that country and the Streetsnumber has a UniqueValueRenderer displaying a png image with the street number in it somewhere on the streets. What I'd like to achieve is that the png image gets increased in size whenever the user hovers over the exact image AND if the user hovers somewhere over the street the image represents. For example if the user hovers the Route 66, the png (which is located somewhere on the Route 66) shoult increase in size and decrease if the hover is over. Right now we've made it to the point that the streets gets highlighted and the street png as soon as the user hovers it, but it should increase before it gets hovered - right when the street itself is hovered. See attachments. flnumber -> feature layer with the numbers on the map flstreets -> freature layer with the street lines on the map using JS API 4.15 view
.when()
.then(function () {
return flstreets.when();
})
.then(function (layer) {
return view.whenLayerView(layer);
})
.then(function (layerView) {
view.on("pointer-move", eventHandler);
function eventHandler(event) {
// the hitTest() checks to see if any graphics in the view
// intersect the x, y coordinates of the pointer
view.hitTest(event).then(getGraphics_Move);
}
var highlight, currentName;
function getGraphics_Move(response) {
// the topmost graphic from the flstreets
// and display select attribute values from the
// graphic to the user
var graphic_railway, name, targetnum, graphic_number;
var tooltip = document.getElementById("nametooltip");
if (response.results.length) {
//railwaygraphic
try {
graphic_railway = response.results.filter(function (result) {
return result.graphic.layer === flstreets;
})[0].graphic;
console.log(graphic_railway)
name = graphic_railway.attributes.Bezeichnun;
targetnum = indexrenderer.indexOf(name);
try {
graphic_number = response.results.filter(function (result) {
return result.graphic.layer === flnumber;
})[0].graphic;
var rend = graphic_number.layer.renderer.clone(); //rend temporary huge renderer
for (var r = 0; r < rend.uniqueValueInfos.length; r++) {
if (rend.uniqueValueInfos[r].label === name) {
rend.uniqueValueInfos[r].symbol.width = 33;
rend.uniqueValueInfos[r].symbol.height = 33;
graphic_number.layer.renderer = rend;
break;
}
}
} catch {
console.log("info: no number graphic");
}
function controlTooltip(name, e) {
if (currentName == name) {
var name = name;
//prevent tooltip from "wiggling" around by only changing the x and y values whenever a new feature is hovered
tooltip.style.top = "" + e.y + "px";
tooltip.style.left = "" + e.x + "px";
tooltip.style.display = "inline-block";
tooltip.style.visibility = "visible";
tooltip.style.position = "absolute";
tooltip.style.backgroundColor = "#fff";
tooltip.style.padding = "10px";
tooltip.style.borderRadius = "5px";
tooltip.style.fontFamily = "sans-serif";
tooltip.style.fontWeight = "bold";
tooltip.style.boxShadow = "2px 2px 1px #88888888";
tooltip.innerHTML = name;
currentName = name;
}
}
controlTooltip(name, response.screenPoint);
} catch {
console.log("Info: graphic is " + typeof graphic);
}
if (highlight && currentName !== name) {
flnumber.renderer = newrenderer; //set back to original renderer
tooltip.style.display = "none";
tooltip.style.visibility = "hidden";
highlight.remove();
highlight = null;
return;
}
if (highlight) {
return;
}
// highlight all features belonging to the same railway as the feature
// returned from the hitTest
var query = layerView.createQuery();
query.where = "Bezeichnun = '" + name + "'";
layerView.queryObjectIds(query).then(function (ids) {
if (highlight) {
highlight.remove();
}
highlight = layerView.highlight(ids);
currentName = name;
});
} else {
// remove the highlight if no features are
// returned from the hitTest
if (highlight) {
flnumber.renderer = newrenderer; //set back to original renderer
tooltip.style.display = "none";
tooltip.style.visibility = "hidden";
highlight.remove();
highlight = null;
}
}
}
});
... View more
06-24-2020
06:01 AM
|
0
|
2
|
1459
|
POST
|
Hi Tamia Rudnicky I can't provide a ready to use solution right off the cuff right now, but another thing I'd suggest is to try it with "old school" DOM Manipulation - selecting the <li> elements of the layerlist by class and remove exactly those you don't wanna have to show up. Do this for every layerlist you have in your application. var elements = document.getElementByClassName('classnameoflayerlistitem');
elements[indextoremove].parentNode.removeChild(elements[indextoremove]);
... View more
06-22-2020
11:20 PM
|
0
|
1
|
2204
|
POST
|
My approach would look something like this: I'd apply the tools in ArcGIS Pro and get the basic Python code from it, but I'm new to ArcGIS Pro and don't know which tools to use.
... View more
06-22-2020
06:39 AM
|
0
|
1
|
2133
|
POST
|
Sorry I forgot an important information. The distance should be calculated via a Routing service (Street Map Premium or ArcGIS Online).
... View more
06-22-2020
06:14 AM
|
0
|
3
|
2133
|
POST
|
I have a xls Excel file with a startpoint and endpoint column each containing x and y coordinates and I need to get the distance between each start- and endpoint. The result (the calculated distance) should be added as new column into the file. Can anybody help me out here with python code snippet or a workflow to achieve this? Thanks in advance
... View more
06-22-2020
05:49 AM
|
0
|
7
|
2229
|
POST
|
Thanks Egge-Jan Pollé that's exactly what I've done right now, because it's the easiest way.
... View more
06-22-2020
04:01 AM
|
1
|
0
|
1932
|
POST
|
Thanks Egge-Jan Pollé then I got it right, but it's not possible to simply add something like this to the url property? url: "https://i.stack.imgur.com/ILTQq.png"
... View more
06-22-2020
03:22 AM
|
0
|
1
|
1932
|
POST
|
I am trying to achieve the following: I'd like to use a png file as the marker symbol for my PictureMarkerSymbol, but it seems like it's only possible with local png files What doesn't work, but I'd like to achieve: var markerSymbol = {
type: "picture-marker",
url: "https://www.myurltothepicture.com/img/mypicture.png",
height: "60px",
width: "60px",
};
What works, but isn't what I need: var markerSymbol = {
type: "picture-marker",
url: "local/path/to/png/symbol.png",
height: "60px",
width: "60px",
};
Does anybody know if this is generally not possible, or am I doing something wrong? I'm using JS API 4.15 Thanks in advance for your help
... View more
06-22-2020
02:27 AM
|
0
|
4
|
1994
|
POST
|
The Layerlist has a Property called "operationalItems" which gives you access to the Layers displayed in the Layerlist. You can set the listMode property to "hide" and the Layer won't be shown in the Layerlist. myfirstlayerList = new LayerList({
view: view,
});
view.when(function () {
/* #################################################
OPTIONAL WIDGET SETTINGS
var items includes all 4 layers which
could be visible on the Layer Widget.
Set the listMode property to:
"show" - layer visible
"hide" - layer not visible
################################################# */
var hiddenLayer = ["insert title of layer HERE", "optional second title"];
var items = myfirstlayerList.operationalItems.items;
for (var j = 0; j < items.length; j++) {
if (hiddenLayer.indexOf(items[j].title) >= 0) {
items[j].layer.listMode = "hide";
}
}
}); The idea is that the code iterates through the hiddenLayer List in which you can put any FeatureLayer you wish to hide and if the given Layer is inside of the operationalItems it will set the listMode of its layer to hide. Layer | ArcGIS API for JavaScript 4.15
... View more
06-22-2020
01:45 AM
|
2
|
3
|
2204
|
Title | Kudos | Posted |
---|---|---|
3 | 06-21-2021 01:55 PM | |
1 | 01-26-2021 02:21 AM | |
1 | 01-24-2021 06:00 AM | |
1 | 01-24-2021 11:45 PM | |
1 | 12-22-2020 12:30 AM |
Online Status |
Offline
|
Date Last Visited |
06-24-2022
07:59 AM
|