POST
|
Have this same question, any idea why this happens or how to control it? I'm looking to try to include the Zoom to button to be within the actionBar.
... View more
|
0
|
0
|
7
|
POST
|
Robert, Thanks so much for your help on that, it now works. I set the following in zoomToUtils.js which now allows for a better zoom level: ext = new Extent(geometry.x - 0.1219, // These were all set to 0.0001
geometry.y - 0.1219,
geometry.x + 0.1219,
geometry.y + 0.1219,
geometry.spatialReference);
ext.isSinglePoint = false; // Was set to true My values for the above were just guesses, but it works great now and unless you have pointers I will go with them. Thanks again for your help, you have again saved me on this project! John
... View more
08-01-2019
12:38 PM
|
0
|
0
|
857
|
POST
|
Robert, Thanks for your response. I added your changes and can see in the console that the extentFactor is being set correctly but for some reason I don't see any difference in the zoom level. I've played around with a number of different values but it seems to not cause any difference in the actual zoom level. I'm trying to zoom layers that have been added dynamically so perhaps there is something off with the extent for those layers. Thanks, John
... View more
08-01-2019
11:00 AM
|
0
|
2
|
857
|
POST
|
I'm trying to set the zoom level for the 'Zoom to' feature from the attribute table using WAB 2.12. I believe the same method is shared when using the enable pop-up feature from the attribute table, or at least I hope it is shared. The default setting zooms in too close and I would like to set the zoom level so that it is farther out. I have tried modifying /jimu.js/zoomToUtils.js to set the extentFactor in the zoomToFeatureSet method: mo.zoomToFeatureSet = function(map, featureSet, /*optional*/extentFactor) {
var layer = featureSet.features &&
featureSet.features.length > 0 &&
featureSet.features[0].getLayer &&
featureSet.features[0].getLayer();
var layerId = layer ? layer.id : null;
extentFactor = 1.2; // Added this to set the zoom level extent
var extent = mo.graphicsExtent(featureSet.features, extentFactor);
console.log("In the zoomToUtils. extentFactor: " + extentFactor + " featureSet.features: " + featureSet.features + " extent: " + extent);
return mo.zoomToExtent(map, extent, layerId);
}; This seems to have no effect. I feel like I'm close but not quite there to get this working. Any help or advice would be appreciated. Thanks, John
... View more
08-01-2019
07:57 AM
|
0
|
4
|
1011
|
POST
|
I have an application that is adding featureLayers to an existing map. Is it possible to save a layer to Portal or AGOL so that layer may be accessed by other applications? I'm very new to the ArcGIS API and I thought this would be a somewhat common use case but have been unable to find anything relevant. Are there better ways to export or share a featureLayer? I'm using the ArcGIC API for JavaScript v 3.28. Thanks, John
... View more
04-08-2019
02:08 PM
|
0
|
0
|
224
|
POST
|
Hi, I have a Web AppBuilder application using a custom widget that adds featureLayers to a map. I would ideally like to save these featureLayers to Portal or AGOL so they may be used with other applications. I'm new to Esri APIs and I thought this would be a popular use case, but so far I haven't found any evidence for this kind of functionality. Is this possible, or are there better approaches to take for saving layers? Thanks! John
... View more
04-08-2019
12:08 PM
|
0
|
0
|
238
|
POST
|
In case anyone else has a similar problem, this is how I got it to work: When creating the graphic, set all of the attributes as well: const polyline = new context.esriJS.Polyline(polylineJson);
var routeInfoTemplate = new context.esriJS.InfoTemplate('Route Name:' + route.attributes.Name);
var routeAttributes = {
ObjectID: route.attributes.ObjectID,
Name: route.attributes.Name,
ViolatedConstraints: route.attributes.ViolatedConstraints,
OrderCount: route.attributes.OrderCount,
TotalCost: route.attributes.TotalCost
}; Then create a layer definition and use that to create a featureCollection in order to create a featureLayer. Add the layer to the map: var layerDefinition = {
name: "Route " + route.attributes.Name,
geometryType: route.geometryType,
fields: routeFields.fields //Stored externally, they set the column headers
}
var featureCollection = {
layerDefinition: layerDefinition,
featureSet: null // Ok for this to be null since attributes were set above
}
var featureLayer = new FeatureLayer(featureCollection, {
id: 'Routing Solution ' + route.attributes.Name,
showLabels: true
});
featureLayer.add(polylineGraphic);
map.addLayer(featureLayer); In the Web AppBuilder application the layer info will be available to the Attribute Table widget. Also, when testing check in the Attribute Table widget if the Filter By Map Extent button is selected, as that can prevent values from a layer from displaying in the table.
... View more
03-26-2019
07:03 AM
|
0
|
0
|
607
|
POST
|
Robert, The route object is returned from the Vehicle Routing Solution service as feature set. When I try to send in the full route object I get errors about features being undefined. That led me to try a style similar to what is in Feature collection | ArcGIS API for JavaScript 3.27. That got me past the feature error but to a new error of 'Converting circular structure to JSON.' My featureLayer creation currently looks like this: var featureCollection = {
layerDefinition: layerDefinition,
featureSet: {
features: config.fetchedRoute.value.features,
geometryType: config.fetchedRoute.value.geometryType
}
}
var featureLayer = new context.esriJS.FeatureLayer(featureCollection, { id: 'Routing Solution ' + route.attributes.Name, showLabels: true }); Any other thoughts or suggestions? Thanks, John
... View more
03-20-2019
11:22 AM
|
0
|
1
|
607
|
POST
|
I'm building a custom widget and am trying to add a layer to the Attributes Table. I believe my layer is successfully being added to the Attributes Table as I can see the column headers change for the layer when added. My issue is that I'm not seeing any data from my layer show-up in the Attributes Table. Where does the Attribute Table pull the data from for a layer? Below is a sample of how I am creating the FeatureLayer that will be added to the table: const polyline = new Polyline(polylineJson);
var routeInfoTemplate = new InfoTemplate('Route Name:' + route.attributes.Name);
var routeAttributes = {
RouteName: route.attributes.Name,
OrderCount: route.attributes.OrderCount,
};
const polylineGraphic = new context.esriJS.Graphic({
'geometry': polyline,
'symbol': { "color": colorArr, "width": 1, "type": "esriSLS", "style": "esriSLSSolid" },
'attributes': routeAttributes,
'infoTemplate': routeInfoTemplate
});
var layerDefinition = {
"name": "SHA Test " + route.attributes.Name,
"geometryType": "esriGeometryPolyline",
"fields": [{
"name": "Name",
"alias": "RouteName",
"type": "esriFieldTypeString"
}, {
"name": "OrderCount",
"alias": "Order Count",
"type": "esriFieldTypeString"
}]
}
// Define the featureCollection
var featureCollection = {
layerDefinition: layerDefinition,
featureSet: routes.attributes // routes are returned from the Rest Api
}
// Define the featureLayer
var featureLayer = new FeatureLayer(featureCollection, {
id: 'Routing Solution ' + route.attributes.Name,
showLabels: true
});
featureLayer.add(polylineGraphic);
map.addLayer(featureLayer); I'm very new to Esri APIs, so if I'm missing something obvious please feel free to point it out. I feel like this is probably very simple, but I appreciate any help in advance. Thanks, John
... View more
03-19-2019
01:51 PM
|
0
|
4
|
900
|
POST
|
Robert, Thanks for your help. I was able to remove the own() call and then break apart the dojo version to identify the layer and the widget currently in use, and from there could call publishData on the widget. Thanks, John
... View more
03-19-2019
11:13 AM
|
0
|
0
|
537
|
POST
|
Robert, I have been able to import dojo/_base/lang with success, but I have had no success with own. I did try to import dijit/Destroyable since that seems to house own, but still ran into problems using it. I'm wondering if part of the problem is with how 'this' is referenced from within the React component versus a regular widget.
... View more
03-18-2019
12:32 PM
|
0
|
1
|
537
|
POST
|
I am building a custom Widget using React and am having difficulty in adding new layer information to the Attribute Table. I found the following resource: Send a layer to the Attribute Table widget—Web AppBuilder for ArcGIS (Developer Edition) | ArcGIS for Developers but it uses a number of Dojo methods to bind the call to publishData which I am having difficulty calling from React. Is there a way to make the call to publishData to the Attributes Table using plain JavaScript without Dojo helper methods like hitch, own, and on? Thanks
... View more
03-18-2019
12:09 PM
|
0
|
4
|
656
|
Online Status |
Online
|
Date Last Visited |
13 hours ago
|