|
POST
|
As per my tongue twister subject I am trying to work with MapImageLayer objects and their sub layers in V4 of the JS API. I have hydrated a web map into a map object. The web map has a map service (/MapServer), which is hydrated, naturally, to a MapImageLayer object. However, despite the map service having sub layers, they are not available to the layer object. At least this is what I surmise by interrogating the layer object’s allSubLayers property, which is empty. I feel like I'm missing a trick here. The API reference talks about working with sub layers but only when defined by the programmer, not coming from a web map. Ultimately, I aim to set layer definition queries on the sub layers but just need to get those layer objects before queries can be applied. I have created a test harness below, which illustrates my conundrum: <DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
<title>Load a basic WebMap - 4.11</title>
<style>
html,
body,
#viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
</style>
<link rel="stylesheet" href="https://js.arcgis.com/4.11/esri/themes/light/main.css" />
<script src="https://js.arcgis.com/4.11/"></script>
<script>
require(["esri/views/MapView", "esri/WebMap", "esri/config", "esri/widgets/LayerList"], function (MapView, WebMap,
esriConfig, LayerList) {
var webmap = new WebMap({
portalItem: {
// autocasts as new PortalItem()
id: "90613226a9bc41998a1c893d596badc8"
}
});
webmap.when(function () {
var allLayersAndSublayers = webmap.allLayers.flatten(function (item) {
return item.layers || item.sublayers;
});
var layerList = new LayerList({
view: view
});
view.ui.add(layerList, {
position: "top-left"
});
});
/************************************************************
* Set the WebMap instance to the map property in a MapView.
************************************************************/
var view = new MapView({
map: webmap,
container: "viewDiv"
});
});
</script>
</head>
<body>
<div id="viewDiv"></div>
</body>
</html>
... View more
07-30-2019
12:10 AM
|
0
|
2
|
1733
|
|
POST
|
When you say the web maps are still pointing back to the AGOL site, do you mean that the web map's services are still pointing to AGOL? If so, when using ArGIS Online Assistant it is a 2 step process when copying web maps: 1. Use Copy Content to move the web map between AGOL and Portal 2. Use Update the URLs of Services in a Web Map to change the service urls, so they now point to Portal services
... View more
07-24-2019
05:27 PM
|
0
|
0
|
993
|
|
POST
|
One thing to note here is that you should choose the web context url carefully in the beginning as changing it later can cause issues. This is because you will use the server web context url when federating Portal and ArcGIS Server. Changing the details of federation, such as the services url will break any existing hosted services that you have. Actually, changing the urls used for federation will break existing hosted services regardless of if there is a web context url or not.
... View more
07-24-2019
04:45 PM
|
0
|
0
|
1789
|
|
POST
|
Hi Brandon, Did you manage to find a solution to this issue? Mark
... View more
01-29-2018
07:06 PM
|
0
|
0
|
1244
|
|
POST
|
Hello, The same problem happened to me when I upgraded from 10.4.1 to 10.5. Working with Support they figured out that I had an invalid credential in my security configuration. The credential was used as the principal user to access AD for web tier authentication and it's password had changed but had not been updated. Support recommended the following: "Rename the security store settings file to; C:\arcgisserver\config-store\security\security-config_WINDOWS.json and replace the original with the default one for BUILTIN then restarted the AGS service. Then "Continue Server Upgrade" should work." It did work! If this is your problem you would then have to reconfigure your single sign on again after the upgrade. Hope this helps.
... View more
04-03-2017
04:31 PM
|
5
|
9
|
4395
|
|
POST
|
Hello, I have created a ArcGIS console stand alone application using the new project wizard in Visual Studio 2010. The default code created in the stub was around grabbing a desktop license:
class Program
{
private static LicenseInitializer m_AOLicenseInitializer = new SetCustomMapExtent.LicenseInitializer();
[STAThread()]
static void Main(string[] args)
{
//ESRI License Initializer generated code.
//m_AOLicenseInitializer.InitializeApplication(new esriLicenseProductCode[] { esriLicenseProductCode.esriLicenseProductCodeBasic, esriLicenseProductCode.esriLicenseProductCodeStandard, esriLicenseProductCode.esriLicenseProductCodeAdvanced },
//new esriLicenseExtensionCode[] { });
m_AOLicenseInitializer.InitializeApplication(new esriLicenseProductCode[] { esriLicenseProductCode.esriLicenseProductCodeAdvanced },
new esriLicenseExtensionCode[] { });
.
.
.
//Do not make any call to ArcObjects after ShutDownApplication()
m_AOLicenseInitializer.ShutdownApplication();
}
}
}
The problem is that when I compile this stub and run it, I get the error in the subject of this post. I am running this application on a machine with ArcGIS Desktop 10.1 SP1 with an Advanced license (borrowed) installed on it. Any help would be appreciated. Regards, Mark
... View more
05-15-2013
09:58 PM
|
0
|
1
|
4201
|
|
POST
|
Thanks for the feedback. In the end it was a closely related call I was after:
m_AOLicenseInitializer.InitializeApplication(new esriLicenseProductCode[] { esriLicenseProductCode.esriLicenseProductCodeAdvanced }, new esriLicenseExtensionCode[] { });
//ESRI License Initializer generated code.
String path = args[1]; //Path to map document
float xMin = float.Parse(args[2]); //New extent xmin
float yMin = float.Parse(args[3]); //New extent ymin
float xMax = float.Parse(args[4]); //New extent xmax
float yMax = float.Parse(args[5]); //New extent ymax
IMapDocument mapDoc = new MapDocument();
if (mapDoc.get_IsMapDocument(path))
{
mapDoc.Open(path, null);
IMap map;
for (int i = 0; i <= mapDoc.MapCount - 1; i++)
{
map = mapDoc.get_Map(i);
IMap currMap = map;
IEnvelope env = new EnvelopeClass();
IPoint llpoint = new PointClass();
llpoint.X = xMin;
llpoint.Y = yMin;
env.LowerLeft = llpoint;
IPoint trpoint = new PointClass();
trpoint.X = xMax;
trpoint.Y = yMax;
env.UpperRight = trpoint;
env.LowerLeft = llpoint;
env.UpperRight = trpoint;
IClone sClone = currMap.SpatialReference as IClone; //Assuming the map document has the correct spatial reference.
ISpatialReference newSR = sClone.Clone() as ISpatialReference;
env.SpatialReference = newSR;
currMap.AreaOfInterest = env;
}
mapDoc.Save();
}
//Do not make any call to ArcObjects after ShutDownApplication()
m_AOLicenseInitializer.ShutdownApplication();
}
... View more
05-15-2013
09:49 PM
|
0
|
0
|
753
|
|
POST
|
Hello, I am wondering if it is possible to set the custom extent of a map document's data frame using ArcObjects 10.1? I wish to take an existing map document, modify the custom extent of the data frame and then save it. Much the same way as you would do in ArcMap when editing the data frame properties (see image). [ATTACH=CONFIG]24276[/ATTACH] Any help would be appreciated. Regards, Mark
... View more
05-14-2013
12:56 AM
|
0
|
2
|
3259
|
|
POST
|
Hi, I cross posted this on the FME site and got some replies: https://safe.secure.force.com/AnswersQuestionDetail?id=906a0000000ckqqAAA Mark
... View more
05-01-2013
03:21 PM
|
0
|
0
|
671
|
|
POST
|
Hello, I have noticed that there are couple of archived forums asking this question. I recently had to figure out how to change the z order on the infowindow myself, so I thought I would share my solution with you. The only way I could figure out to do it was to modify the z index on the 'map_infowindow' html element. See the code below:
dojo.connect(map.infoWindow, 'onShow', function(){
document.getElementById('map_infowindow').style.zIndex = 9999;
});
This code will make sure that the infowindow is always on top. I hope this helps, Mark
... View more
10-16-2012
04:34 PM
|
0
|
1
|
6131
|
|
POST
|
I notice in the latest version of the API you can use the function esri.geometry.getExtentForScale and then set the map extent to change scale. Is there any way to do this in 1.6? If there is any method to set the map extent based on a given scale number then please let me know. Regards, Mark
... View more
03-01-2011
03:02 PM
|
0
|
1
|
699
|
|
POST
|
Note that the scalebar units are taken from the layer with the zero index, so the fix only applies to that layer. ie the map layer that is the first to be added to the map or if as in the previous example, the layer is added to index 0. The layer could also be moved to index 0 as well and that would affect calculations. Regards, Mark
... View more
01-09-2011
07:55 PM
|
0
|
0
|
1433
|
|
POST
|
After chasing numerous red herrings I have found the solution: When I load the WMS layer the 'units' property is not defined by default. This causes the api scale bar calculations to get pretty confused and come up with the wrong numbers on the scale bar. To get around this I had to manually define the WMS layer 'units' property as 'esriMeters':
wmsLayer.units = "esriMeters";
map.addLayer(wmsLayer,0);
I guess this could be caused by any layer that does not have it's 'units' property defined by default. I hope this helps other people who come across this problem. Regards, Mark
... View more
01-09-2011
07:51 PM
|
0
|
0
|
1433
|
|
POST
|
Sorry, my first example for 'onDrawEnd' is missing the line that creates a the new graphic:
dojo.connect(drawToolbar, "onDrawEnd", function(geometry) {
drawToolbar.deactivate();
editToolbar.deactivate();
var newAttributes = dojo.mixin({},selectedTemplate.template.prototype.attributes);
var newGraphic = new esri.Graphic(geometry,null,newAttributes);
selectedTemplate.featureLayer.applyEdits([newGraphic], null, null);
var infoTemplateInst = new esri.InfoTemplate("Attributes", "${*}");
newGraphic.setInfoTemplate(infoTemplateInst);
map.infoWindow.show(map.toScreen(newGraphic.geometry), map.getInfoWindowAnchor(map.toScreen(newGraphic.geometry)));
});
Note, I have also tried putting the setInfoTemplate statement before the applyEdits statement but it made no difference.
... View more
01-04-2011
01:48 PM
|
0
|
0
|
690
|
|
POST
|
I'm attempting to replace the editor widget with my own code to get greater control of the infotemplate. When I create a new feature using the template picker I then want to show an info window with the attributes of that feature class. However, I'm running into problems: If I use the 'onDrawEnd' event with the following code, the info window does not show the attributes. It simply shows the literal infoTemplate string: '{*}'.
dojo.connect(drawToolbar, "onDrawEnd", function(geometry) {
drawToolbar.deactivate();
editToolbar.deactivate();
var newAttributes = dojo.mixin({},selectedTemplate.template.prototype.attributes);
selectedTemplate.featureLayer.applyEdits([newGraphic], null, null);
var infoTemplateInst = new esri.InfoTemplate("Attributes", "${*}");
newGraphic.setInfoTemplate(infoTemplateInst);
map.infoWindow.show(map.toScreen(newGraphic.geometry), map.getInfoWindowAnchor(map.toScreen(newGraphic.geometry)));
});
If I use the 'onBeforeApplyEdits' event with the following code, info window does not show or is initially blank.
dojo.connect(featureLayers ,"onBeforeApplyEdits", function(adds,updates,deletes) {
dojo.forEach(adds, function(add) {
var infoTemplateInst = new esri.InfoTemplate("Attributes", "${*}");
add.setInfoTemplate(infoTemplateInst);
map.infoWindow.show(map.toScreen(add.geometry), map.getInfoWindowAnchor(map.toScreen(add.geometry)));
});
});
If I use the 'onClick' even with the following code it does work but it is initially blank. After I click again on the new feature, the info window displays correctly and continues to for subsequently created features.
dojo.connect(featureLayers , 'onClick', function(e) {
var infoTemplateInst = new esri.InfoTemplate("Attributes", "${*}");
e.graphic.setInfoTemplate(infoTemplateInst);
map.infoWindow.show(map.toScreen(e.graphic.geometry), map.getInfoWindowAnchor(map.toScreen(e.graphic.geometry)));
});
Has someone got an example of creating a new feature and then displaying an info window with the feature's attributes?
... View more
01-04-2011
01:24 PM
|
0
|
0
|
690
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 10-12-2021 03:26 PM | |
| 3 | 09-09-2021 04:19 PM | |
| 3 | 09-12-2021 04:54 PM | |
| 1 | 09-08-2021 09:42 PM | |
| 2 | 09-09-2021 05:31 PM |
| Online Status |
Offline
|
| Date Last Visited |
01-27-2022
03:29 PM
|