POST
|
I was getting this issue with angular. Just in case anyone else gets it I will post my solution as this is the first google hit. The cause is if you are using routing you need to set the path without the route import { setAssetPath } from '@esri/calcite-components/dist/components'; setAssetPath(window.location.origin);
... View more
08-03-2023
07:24 PM
|
0
|
1
|
1155
|
POST
|
I'm seeing exactly the same thing in pro 3.1.0, two features with the same spatial reference. The layers have the same spatial reference, I check they have the same WKID in code just to be sure, still fails. Feels like a bug in the code of the geometry engine " at ArcGIS.Core.Geometry.GeometryEngine.CheckForEqualSpatialReferences(SpatialReference sr1, SpatialReference sr2)\ To me its feels like the code might be they are checking that they are the same instance of spatial reference object, rather than that they are the same? My workaround therefore was to use the SR of on of the layers to rebuild the geometry of the other. In my case I used the SR of the polygon layer to create a new point var point = new MapPointBuilderEx(inPoint.X, inPoint.Y, polyLayer.GetDefinition().GetSpatialReference()).ToGeometry();
... View more
06-15-2023
03:40 AM
|
1
|
0
|
301
|
POST
|
I have a secured a secured service that you either try to print or export it fails to export the secured layers. Print and export map don't appear to include the token. If you manually add the token to each layer that works. I'm using a built in user via a simple login with username and password. Is this a bug? version arcgis==2.0.1 code sample (with workaround) gis = GIS(portal_url, username=portal_username, password=portal_password)
wm_item = gis.content.get('ITEMID')
wm = WebMap(wm_item)
e = polygon.extent
ext = {'spatialReference': {'latestWkid': 3857, 'wkid': 102100},
"xmin": 14219202.665619811,
"ymin": -3017623.8659692756,
"xmax": 14225164.753826046,
"ymax": -3005929.0006416594}
# DW another esri bug? Doesn't add the token on print or export
for layer in wm.layers:
layer.token = gis._con.token
map_options = {
"extent": ext
}
# compose combined JSON
print_options = {
"mapOptions": map_options,
"operationalLayers": wm._webmapdict["operationalLayers"],
"baseMap": wm._basemap,
"exportOptions": {"dpi": 96},
"layoutOptions": layoutOptions
}
printed_file_url = wm.print(file_format='JPG', layout_template="A4 Landscape",
extent=ext, layout_options=layoutOptions)
... View more
10-13-2022
10:48 PM
|
0
|
0
|
247
|
POST
|
Here is a work around if anyone else runs into this wm_item = gis.content.get('item')
wm = WebMap(wm_item)
e = polygon.extent
ext = {'spatialReference': {'latestWkid': 3857, 'wkid': 102100},
"xmin": 14219202.665619811,
"ymin": -3017623.8659692756,
"xmax": 14225164.753826046,
"ymax": -3005929.0006416594}
# legend
ids = []
for layer in wm.layers:
ids.append({"id": layer.id})
layoutOptions = {
"titleText": "my title",
"authorText": "my author",
"copyrightText": "Copyright",
"customTextElements": [{
"date": datetime.now().strftime("%m/%d/%Y")
}],
"scaleBarOptions": {},
"legendOptions": {
"operationalLayers": ids
}
}
# DW another esri bug? Doesn't add the token on print or
for layer in wm.layers:
layer.token = gis._con.token
map_options = {
"extent": ext
}
# compose combined JSON
print_options = {
"mapOptions": map_options,
"operationalLayers": wm._webmapdict["operationalLayers"],
"baseMap": wm._basemap,
"exportOptions": {"dpi": 96},
"layoutOptions": layoutOptions
}
# dw don't use wm.print the print from the web map as it has a bug which causes the
# legend not to display.
res2 = export_map(print_options, format="JPG", layout_template="A4 Landscape", gis=gis)
print(res2.url)
... View more
10-13-2022
10:40 PM
|
0
|
1
|
390
|
POST
|
Version: arcgis==2.0.1 Issue: When you specify layout options using webMap.Print these options are ignored. This includes title, author, copywrite, scalebar and legend. Code: wm_item = gis.content.get('item')
wm = WebMap(wm_item)
ext = {'spatialReference': {'latestWkid': 3857, 'wkid': 102100},
"xmin": 14219202.665619811,
"ymin": -3017623.8659692756,
"xmax": 14225164.753826046,
"ymax": -3005929.0006416594}
layoutOptions = {
"titleText": "LADR",
"authorText": "Oz Minerals",
"copyrightText": "Copyright Oz Minerals",
"customTextElements": [{
"date": datetime.now().strftime("%m/%d/%Y")
}],
"scaleBarOptions": {},
"legendOptions": {
"operationalLayers": ids
}
}
printed_file_url = wm.print(file_format='JPG', layout_template="A4 Landscape",
extent=ext, layout_options=layoutOptions) The problem in the esri code is this, it hangs the layout options off the map_otions whereas they should be on the print options I think this is how it should be:
... View more
10-13-2022
10:31 PM
|
0
|
2
|
394
|
POST
|
If you have a featureclass: var layerParams = new FeatureLayerCreationParams(fc);
var layer = LayerFactory.Instance.CreateLayer<FeatureLayer>(layerParams, MapView.Active.Map);
... View more
08-23-2022
10:43 PM
|
1
|
1
|
1599
|
POST
|
Does anyone know why auto imports won't work with core in VSCode? They work fine when using the types I have resolved the issue by creating a definition file based on the types and a find and replace. However, I'd like to know why/get esri to fix this so I don't have to maintain this. Without my definition file, no suggestions show up for esri imports: With my definition file, I get auto complete suggestions:
... View more
07-11-2022
04:32 PM
|
0
|
2
|
499
|
POST
|
I decided it would be better to separate the code from the esri code. To install rename the LayerListView.js to LayerListView_esri.js and copy over the files. This version also adds a drag handle styled as per the map viewer
... View more
09-19-2021
06:53 PM
|
0
|
0
|
1087
|
POST
|
I had to do this and Victors sample is definitely missing functions (e.g. createItem) and things with the laterlist look like they have changed since. I have wrapped up the code into blocks that can just be pasted into layerListview. The css will give you the map viewer style dotted line. Notes Because wab doesn't nest the expanded items (the layer swatch) it only supports dragging above an item. Feature layers can't be moved, this is a limitation of 3x. there well may be edge layer types I haven't tested. tested and working with 2.20 LayerListView.js _setUpDnD: function () {
this.dndList = new Source(this.layerListTable.parentNode, {
skipForm: true,
singular: true
});
dojo.connect(this.dndList, "onDropInternal", this, "onDrop");
this.dndContainer = new Container(this.layerListTable);
// listen for drag and check we can drop
this.onMouseMoveHandler = this.own(dojo.connect(this.dndList, "onMouseMove", lang.hitch(this, "handleDragMoveDnd")));
this.onMouseMoveHandler = this.own(dojo.connect(this.dndList, "onDndStart", lang.hitch(this, "handleDragStart")));
aspect.around(this, "addLayerNode", function (orig) {
return function(){
var args = orig.apply(this, arguments);
// ignore any layer which isn't a parent
if(arguments[0].parentLayerInfo){
return args;
}
// we need to add a node and a class as the dnd requires it
var id = args.layerTrNode.getAttribute("layerTrNodeId");
var layerInfo = this.operLayerInfos.getLayerInfoById(id);
// you can't move feature layers!
var lyr = layerInfo.originOperLayer.layerObject;
if (lyr.type && lyr.type.toLowerCase() === "feature layer") {
return args;
}
args.layerTrNode.setAttribute("id", args.layerTrNode.getAttribute("layerTrNodeId"));
// we also need the d&d class
domClass.add(args.layerTrNode, "dojoDndItem");
this.dndList.setItem(args.layerTrNode.id, args.layerTrNode)
return args;
}
}, true)
},
handleDragMoveDnd: function (a) {
Manager.manager().canDropFlag = true;
if (this.dndList.isDragging) {
// var layer2ContentTrNode = query("tr[layerContentTrNodeId='" + this.dndList.current.id + "']", this.layerListTable)[0];
query(".dndDashedLine", this.layerListTable).forEach(function (n) {
domClass.remove(n, "dndDashedLine");
})
if (this.dndList.current) {
if (this.dndList.currentDragInfo && this.dndList.currentDragInfo != this.dndList.current.id) {
// if its the next node don't let it drop it before/after depending on direction
// turn the map into an array
var layerInfoArray = this.operLayerInfos.getLayerInfoArray();
var ids = []
array.forEach(layerInfoArray, function (currentLayerInfo, index) {
if (this.dndList.map[currentLayerInfo.id]) {
ids.push(currentLayerInfo.id);
}
}, this);
var currentIdx = ids.indexOf(this.dndList.currentDragInfo);
var nextIdx = ids.indexOf(this.dndList.current.id);
if (domClass.contains(this.dndList.current, "dojoDndItemAfter")) {
// do not let users drop before. This is the issue with the jimu list which doesn't
// have the content (eg the layer swatch) is not a child of the layer item. we let this
// go if its the very bottom item
domClass.add(this.dndList.current, "dndDashedLine");
if(!nextIdx == ids.length - 1){
Manager.manager().canDropFlag = false;
domClass.remove(this.dndList.current, "dndDashedLine");
}
}
if (domClass.contains(this.dndList.current, "dojoDndItemBefore")) {
domClass.add(this.dndList.current, "dndDashedLine");
if (nextIdx - currentIdx === 1) {
Manager.manager().canDropFlag = false;
domClass.remove(this.dndList.current, "dndDashedLine");
}
}
} else if (this.dndList.currentDragInfo === this.dndList.current.id) {
Manager.manager().canDropFlag = false; // don't let it drop on top of itself
}else{
Manager.manager().canDropFlag = false;
}
}
else {
// this will happen when user mouses over a feature layer
Manager.manager().canDropFlag = false;
}
dojo.toggleClass(Manager.manager().avatar.node, "dojoDndAvatarCanDrop", Manager.manager().canDropFlag);
}
},
handleDragStart: function (a, c, e) {
if (this.dndList.current) {
this.dndList.currentDragInfo = this.dndList.current.id;;
}else{
this.dndList.currentDragInfo = null;
}
},
onDrop: function (nodes) {
this.dndList.getAllNodes().forEach(function (n) {
domClass.remove(n, "dndDashedLine");
})
// new position
var allNodes = this.dndList.getAllNodes();
var newPos = -1;
for (var i = 0; i < allNodes.length; i++) {
if (allNodes[i].id === nodes[0].id) {
newPos = i;
break;
}
}
// old position
var layerInfo = this.operLayerInfos.getLayerInfoById(nodes[0].id);
var oldPos = -1;
var layerInfoArray = this.operLayerInfos.getLayerInfoArray();
array.forEach(layerInfoArray, function (currentLayerInfo, index) {
if (layerInfo.id === currentLayerInfo.id) {
oldPos = index;
}
}, this);
// if we have less d&d nodes its because there are feature layers
if (layerInfoArray.length !== allNodes.length) {
newPos += (layerInfoArray.length - allNodes.length);
}
var steps = -1;
if (oldPos < newPos) {
steps = newPos - oldPos;
steps = this.operLayerInfos.moveDownLayer(layerInfo, steps)
} else {
steps = oldPos - newPos;
steps = this.operLayerInfos.moveUpLayer(layerInfo, steps)
}
this.emit('dnd-drop', nodes);
// just for good look
this.refresh();
} style.css .jimu-widget-layerList .dojoDndItemBefore.dndDashedLine{
border-width: 0 !important;
border-top: #009cff !important;
border-style: dashed !important;
border-top-width: 2px !important;
}
.jimu-widget-layerList .dojoDndItemAfter.dndDashedLine{
border-width: 0 !important;
border-bottom: #009cff !important;
border-style: dashed !important;
border-bottom-width: 2px !important;
}
.jimu-widget-layerList .dojoDndItem{
border-width: 0 !important;
}
.jimu-widget-layerList .layer-list-table {
border-collapse: collapse !important;
}
... View more
09-16-2021
10:42 PM
|
0
|
1
|
1092
|
POST
|
Are there any updates on this? We had a use case where we want to get some attribute information on mouse over such as the name of the location they are hovering over. I believe this information exists in the Esri tile layers, it just isn't exposed by hit test. To demonstrate this I include two samples both using the same Esri Tile layer (they look different because one is styled one not). Once using the open layers API and the other using Esri JSAPI Open layers https://codesandbox.io/s/esri-vector-tile-mouse-over-open-layers-293f6https://codesandbox.io/s/vector-tile-info-forked-293f6?file=/main.js JSAPI https://codepen.io/davidwilton/pen/RwVXgva?editors=1000 With open layers I not only get the name of the item but also the NLS With Esri I get nothing but the layer name
... View more
08-19-2021
09:58 PM
|
3
|
0
|
1519
|
POST
|
For anyone else looking to use a custom font I really struggled with this so documenting here. There doesn't appear to be a documented way on how to create a PBF font for Esri. A tip I got was the easiest way is to create a vector tile package with the font in in. Then rename the VTPK to .zip unzip and the font will be under resources\fonts\
... View more
08-16-2021
03:03 PM
|
0
|
0
|
1613
|
POST
|
For anyone else looking to use a custom font I really struggled with this so documenting here. There doesn't appear to be a documented way on how to create a PBF font for Esri. A tip I got was the easiest way is to create a vector tile package with the font in in. Then rename the VTPK to .zip unzip and the font will be under resources\fonts\ You then set the url for the fonts as Rene suggests. Keep in mind that the url doesn't accept multiple locations so you will have to host all the fonts you use (would have been nice if the url took an array and would look at multiple locations)
... View more
08-16-2021
03:02 PM
|
0
|
0
|
1468
|
POST
|
Hi Kirk, we had this one too, was puzzling us because the list works find outside of pro. The esri Pro team helped us out. You need the ItemContainerStyle below" <ListView Grid.Row="1" ItemsSource="{Binding Items, Mode=TwoWay}" ItemContainerStyle="{DynamicResource Esri_ListBoxItemHighlightBrush}">
<ListView.ItemTemplate>
<DataTemplate>
... View more
09-24-2020
04:38 PM
|
0
|
0
|
481
|
POST
|
Solution is to clone the map spatial reference: var extprj = projection.project(new Extent(ext), new SpatialReference(this.map.spatialReference.wkid)); // project ext this.map.setExtent(extprj);
... View more
08-18-2020
08:10 PM
|
2
|
0
|
992
|
POST
|
When using client side projection utility I was getting this error "cannot construct a PeUnit, no constructor in IDL". Google gave no results so I thought I'd log the solution here: This causes the issue var extprj = projection.project(new Extent(ext), this.map.spatialReference); // project ext this.map.setExtent(extprj); The solution is to create a new extent/clone it to pass into the projection var extprj = projection.project(new Extent(ext), new SpatialReference(this.map.spatialReference.wkid)); // project ext this.map.setExtent(extprj); If you don't any time attempts are made to clone the map spatial reference it causes errors. I was using an older version of the API (3.24) so may have been resolved
... View more
08-18-2020
08:10 PM
|
0
|
2
|
1006
|
Title | Kudos | Posted |
---|---|---|
1 | 11-19-2019 07:46 PM | |
1 | 06-15-2023 03:40 AM | |
1 | 08-23-2022 10:43 PM | |
3 | 08-19-2021 09:58 PM | |
2 | 08-18-2020 08:10 PM |
Online Status |
Offline
|
Date Last Visited |
08-04-2023
04:20 AM
|