|
POST
|
You would need to implement a Scrip tool within your model that uses validation logic to collect the number of items selected in your parameter. You could have the tool dialog throw an error on the parameter, which would prevent the user from executing the tool, until your condition is met. Understanding validation in script tools http://desktop.arcgis.com/en/desktop/latest/analyze/creating-tools/understanding-validation-in-script-tools.htm Customizing script tool behavior http://desktop.arcgis.com/en/desktop/latest/analyze/creating-tools/customizing-script-tool-behavior.htm ** Note: You'll want to seek out the "To Customize a message" section in the above page.
... View more
09-17-2015
04:35 PM
|
0
|
1
|
1082
|
|
POST
|
Could you provide a small sample to show what you're doing in your application? I tested these coordinate systems on my end and everything appears to be working fine. World Imagery (3857) http://services.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer World Street Map (3857) http://services.arcgisonline.com/arcgis/rest/services/World_Street_Map/MapServer World Topo Map (3857) http://services.arcgisonline.com/arcgis/rest/services/World_Topo_Map/MapServer Esri Imagery World 2D (4326) ** Extended Support ** http://services.arcgisonline.com/arcgis/rest/services/ESRI_Imagery_World_2D/MapServer Esri StreetMap World 2D (4326) ** Extended Support ** http://services.arcgisonline.com/arcgis/rest/services/ESRI_StreetMap_World_2D/MapServer ** Code I used to test ** XAML <Window x:Class="GallMap.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:esri="http://schemas.esri.com/arcgis/runtime/2013"
Title="Gall Stereographic Map"
Height="350"
Width="800">
<Grid>
<Grid.Resources>
<Style TargetType="{x:Type Border}">
<Setter Property="Margin" Value="10" />
<Setter Property="Padding" Value="5" />
<Setter Property="Background" Value="White" />
<Setter Property="BorderBrush" Value="Black" />
<Setter Property="BorderThickness" Value="2" />
</Style>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="FontSize" Value="20" />
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="Background" Value="White" />
<Setter Property="Foreground" Value="Black" />
<Setter Property="TextAlignment" Value="Center"/>
</Style>
</Grid.Resources>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<esri:MapView x:Name="MyMapView1" Margin="3" />
<esri:MapView x:Name="MyMapView2" Grid.Column="1" Margin="3"/>
<Border VerticalAlignment="Bottom" HorizontalAlignment="Center" Grid.ColumnSpan="2">
<Border.Effect>
<DropShadowEffect />
</Border.Effect>
<StackPanel Orientation="Horizontal">
<StackPanel.Resources>
<Style TargetType="{x:Type RadioButton}">
<Setter Property="Margin" Value="4,0,4,0" />
</Style>
</StackPanel.Resources>
<RadioButton Content="World Imagery" Checked="ToggleButton_OnChecked"/>
<RadioButton Content="World Street" Checked="ToggleButton_OnChecked" />
<RadioButton Content="World Topo" Checked="ToggleButton_OnChecked" IsChecked="True" />
<RadioButton Content="World Imagery 2D" Checked="ToggleButton_OnChecked" />
<RadioButton Content="World Street 2D" Checked="ToggleButton_OnChecked" />
</StackPanel>
</Border>
<Border HorizontalAlignment="Left" VerticalAlignment="Top">
<Border.Effect>
<DropShadowEffect />
</Border.Effect>
<TextBlock Text="{Binding ElementName=MyMapView1, Path=SpatialReference.Wkid, StringFormat=Map WKID: {0}}" Padding="5" />
</Border>
<Border HorizontalAlignment="Left" VerticalAlignment="Top" Grid.Column="1">
<Border.Effect>
<DropShadowEffect />
</Border.Effect>
<TextBlock Text="{Binding ElementName=MyMapView2, Path=SpatialReference.Wkid, StringFormat=Map WKID: {0}}" Padding="5" />
</Border>
</Grid>
</Window> XAML.cs using Esri.ArcGISRuntime.Controls;
using Esri.ArcGISRuntime.Geometry;
using Esri.ArcGISRuntime.Layers;
using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
namespace GallMap
{
public partial class MainWindow : Window
{
private readonly Dictionary<string, string> m_urls = new Dictionary<string, string>
{
{"World Imagery", "http://services.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer"},
{"World Topo", "http://services.arcgisonline.com/arcgis/rest/services/World_Topo_Map/MapServer"},
{"World Street", "http://services.arcgisonline.com/arcgis/rest/services/World_Street_Map/MapServer"},
{"World Imagery 2D", "http://services.arcgisonline.com/arcgis/rest/services/ESRI_Imagery_World_2D/MapServer"},
{"World Street 2D", "http://services.arcgisonline.com/arcgis/rest/services/ESRI_StreetMap_World_2D/MapServer"}
};
public MainWindow()
{
InitializeComponent();
}
private void ToggleButton_OnChecked(object sender, RoutedEventArgs e)
{
var tag = (sender as RadioButton).Content.ToString();
var mapviews = new[] {MyMapView1, MyMapView2};
foreach (var mapview in mapviews)
{
var layer = new ArcGISDynamicMapServiceLayer(new Uri(m_urls[tag]));
var wkid = Array.IndexOf(mapviews, mapview) == 0 ? 53016 : 54016;
var map = new Map
{
SpatialReference = SpatialReference.Create(wkid),
InitialViewpoint = new Viewpoint(new Envelope(-141, 7, -51, 78, SpatialReference.Create(4326)))
};
map.Layers.Add(layer);
mapview.Map = map;
}
}
}
}
... View more
09-17-2015
04:24 PM
|
1
|
3
|
2433
|
|
POST
|
You should be able to calculate this without using a python codeblock. It should be as simple as putting the path to the shapefile in quotes as follows: r"C:\Path\To\Shapefile.shp" I would think that you'd want to first calculate this on all of your shapefiles prior to running the merge tool. This could be done by doing the following: 1. Use the arcpy.da.walk or arcpy.ListFeatureClasses methods to locate the shapefiles on disk. 2. For each shapefile found check to see if it has the field that will be storing the path, if not add this field. 3. In the field calculate pass the path to the feature class surrounded by quotes to persist this information in the field. Let me know if this helps.
... View more
09-16-2015
03:54 PM
|
0
|
0
|
588
|
|
POST
|
Hi Daniel, Not sure if you're still having this problem, but if you are could you upload some screenshots of the expressions you're using?
... View more
09-16-2015
03:48 PM
|
0
|
0
|
452
|
|
POST
|
You could accomplish this by building a tool using the PythonAddins framework or the ArcObjects AddIns framework. I know that you stated you didn't want to use ArcObjects, but I feel that you'd probably prefer the AddIns framework over the COM component approach. Both the PythonAddins and ArcObjects AddIns routes will create a file which the user can install on their machine without any administrative privileges. What is a Python add-in? http://desktop.arcgis.com/en/desktop/latest/guide-books/python-addins/what-is-a-python-add-in.htm Creating a Python add-in tool http://desktop.arcgis.com/en/desktop/latest/guide-books/python-addins/creating-an-add-in-tool.htm Building add-ins for ArcGIS for Desktop (ArcObjects) http://resources.arcgis.com/en/help/arcobjects-net/conceptualhelp/#/Building_add_ins_for_ArcGIS_for_Desktop/0001000000w2000000/ Walkthrough: Building custom UI elements using add-ins http://resources.arcgis.com/en/help/arcobjects-net/conceptualhelp/#/Walkthrough_Building_custom_UI_elements_using_add_ins/0001000001ms000000/
... View more
09-16-2015
03:47 PM
|
0
|
0
|
700
|
|
POST
|
I believe your problem is that you're using ArcGISTiledMapServiceLayer for your basemap instead of ArcGISDynamicMapServiceLayer. I would think you'd need to use the latter because you're needing your basemap to be projected on the server from 3857 to 4269. I've included a copy of the project I tested this with. You'll see that if you change line 33 to ArcGISTiledMapServerLayer that you can replicate your issue, which is that when the feature layer is added and the coordinate for the map is changed to 4269 the basemap no longer renders. Step One. Click the Add Shapefile button to add the shapefile to the map. This will set the coordinate system of the map to 4269. Step Two. Click the Add Basemap tool to insert the basemap into the map. Note that if you use ArcGISDynamicMapServerLayer that the server will handle projecting the basemap from 3857 to 4269 and it will still be visible in the map. If you use ArcGISTiledMapServiceLayer the layer will not project the basemap. As a result the basemap will not be visible. *** Below is the relevant logic in case you don't want to download the attachment *** private async void ButtonBase_OnClick(object sender, RoutedEventArgs e)
{
string tag = (sender as Button).Tag.ToString();
switch (tag)
{
case "basemap":
var basemap = new ArcGISDynamicMapServiceLayer(new Uri("http://services.arcgisonline.com/ArcGIS/rest/services/Ocean_Basemap/MapServer"));
MyMapView.Map.Layers.Insert(0, basemap);
break;
case "shapefile":
var table = await ShapefileTable.OpenAsync(_shpPath);
var layer = new FeatureLayer
{
ID = table.Name,
DisplayName = table.Name,
FeatureTable = table
};
MyMapView.Map.Layers.Add(layer);
break;
default:
MyMapView.Map = new Map();
break;
}
}
... View more
09-16-2015
03:25 PM
|
0
|
1
|
1462
|
|
POST
|
I don't think that would be possible via the installer. I'll need to ask around to double check.
... View more
09-16-2015
01:50 PM
|
0
|
2
|
1675
|
|
POST
|
Are you seeing any features that you can modify in the wizard? I installed ArcPad on my machine and the modify dialog appears blank. I honestly can't think of any features that you'd be able to customize with the ArcPad install.
... View more
09-16-2015
01:30 PM
|
2
|
4
|
1675
|
|
POST
|
Are you having problems using a layer with this particular projection? I can see two Gall Stereographic projections listed in the list of supported coordinate systems for runtime. Are you using either of these? 53016 : Sphere_Gall_Stereographic 54016 : World_Gall_Stereographic Projected Coordinate Systems https://developers.arcgis.com/net/desktop/guide/projected-coordinate-systems.htm
... View more
09-16-2015
12:11 PM
|
1
|
6
|
2433
|
|
POST
|
In ArcGIS this could be done in a number of ways. You could review these options to see if they'll work with your workflow. 1. Call the Add XY Coordinates (Data Management) tool after setting the Output Coordinate System environment variable to a system that uses lat/long values, such as WGS1984. Add XY Coordinates (Data Management) http://desktop.arcgis.com/en/desktop/latest/tools/data-management-toolbox/add-xy-coordinates.htm http://resources.arcgis.com/en/help/main/10.2/index.html#/Add_XY_Coordinates/001700000032000000/ 2. Call the Project Data Management tool to project the feature class to WGS1984. Then you could calculate the xy coordinates of the points in Lat/Long or parse them in python. Project (Data Management) http://desktop.arcgis.com/en/desktop/latest/tools/data-management-toolbox/project.htm http://resources.arcgis.com/en/help/main/10.2/index.html#/Project/00170000007m000000/http://desktop.arcgis.com/en/desktop/latest/tools/data-management-toolbox/project.htm 3. Use a cursor to project the records within a feature class to WGS1984. This would return you the lat/longs in a tuple if you use the Shape@XY token SearchCursor (arcpy.da) http://resources.arcgis.com/en/help/main/10.2/index.html#//018w00000011000000http://desktop.arcgis.com/en/desktop/latest/analyze/arcpy-data-access/searchcursor-class.htm Reading Geometries http://resources.arcgis.com/en/help/main/10.2/index.html#//002z0000001t000000http://desktop.arcgis.com/en/desktop/latest/analyze/python/reading-geometries.htm 4. Create a point object and use its projectAs method to project the point to WGS1984, after which you can parse the X and Y values. PointGeometry https://pro.arcgis.com/en/pro-app/arcpy/classes/point.htmhttp://desktop.arcgis.com/en/desktop/latest/analyze/arcpy-classes/pointgeometry.htm 5. NON ESRI : If the data comes in as shapefiles you can use osgeo.ogr to open it, parse the coordinates, and then use pyproj to project it to the needed system.
... View more
09-16-2015
11:35 AM
|
2
|
0
|
5574
|
|
POST
|
Looking your look it appears that you're wanting to create a project tool specifically for shapefiles where your users are presented with your list of specific coordinate systems. I would think that you'd only need the tool validator for the second parameter, which would populate the input coordinate system name based on the shapefile chosen by the user. import arcpy
class ToolValidator(object):
"""Class for validating a tool's parameter values and controlling
the behavior of the tool's dialog."""
def __init__(self):
"""Setup arcpy and the list of tool parameters."""
self.params = arcpy.GetParameterInfo()
def initializeParameters(self):
"""Refine the properties of a tool's parameters. This method is
called when the tool is opened."""
return
def updateParameters(self):
"""Modify the values and properties of parameters before internal
validation is performed. This method is called whenever a parameter
has been changed."""
if self.params[0].altered:
sRef = arcpy.Describe(self.params[0].value.value).spatialReference
self.params[1].value = sRef.PCSName if sRef.PCSName not in ("", " ") else sRef.GCSName
return
def updateMessages(self):
"""Modify the messages created by internal validation for each tool
parameter. This method is called after internal validation."""
return The third parameter would be a list and you could specify the values using the tool's UI as you showed in the Werteliste.JPG. The actual work of the tool would need to take place in the script being called by the tool. You wouldn't want to execute this in the tool validator. You would need to use the needed logic to convert the name of the coordinate system the user selected into a valid system for the project tool.
... View more
09-16-2015
11:15 AM
|
1
|
0
|
1491
|
|
POST
|
Could you provide some of your logic so that I can why how you're passing the FeatureSet to the MakeFeatureLayer tool along with some logic that shows what you'd need to use this layer object for?
... View more
09-16-2015
10:28 AM
|
0
|
0
|
617
|
|
POST
|
I don't believe this is possible within a supported manner using arcpy, but I have executed task similar to this using ArcObjects. Not sure if this helps, but you could into the following pages to determine if this will give you more insight on how to accomplish this. Automating ArcGIS for Desktop Applications http://resources.arcgis.com/en/help/arcobjects-net/conceptualhelp/index.html#/Automating_the_ArcGIS_Desktop_applications/0001000001nn000000/
... View more
09-16-2015
10:24 AM
|
1
|
0
|
1770
|
|
POST
|
Hi Manuel, I spoke with one of the developers responsible for this area of the software earlier today. I've confirmed that this behavior is a bug and I'll be logging a bug for it. You can submit a ticket to support along with a reference to this geonet thread and the analyst will be able to seek me out to get you attached to the bug. In the meantime, the workaround for this behavior will be to use the Calculate Value tool to stitch together the path to the output feature class.
... View more
09-15-2015
08:12 PM
|
1
|
0
|
1187
|
|
POST
|
Your logic looks correct to me. If you step through your code could you verify that fc.Fields is returning values? I wrote up a quick console application to test this and everything works fine for me. I've pasted my logic below if you want to give it a shot. using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.esriSystem;
using System;
using System.Windows.Forms;
namespace ListFields
{
class Program
{
[STAThread]
static void Main(string[] args)
{
ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.Desktop);
IAoInitialize aoInit = new AoInitializeClass();
aoInit.Initialize(esriLicenseProductCode.esriLicenseProductCodeAdvanced);
var mxdPath = BrowseFolderForFile("Please select a *.mxd file", "Map Document (*.mxd)|*.mxd");
if (string.IsNullOrEmpty(mxdPath))
throw new ArgumentException("Invalid MXD Path");
var mxd = new MapDocumentClass();
mxd.Open(mxdPath, string.Empty);
var uid = new UIDClass { Value = "{40A9E885-5533-11D0-98BE-00805F7CED21}" };
for (int i = 0; i < mxd.MapCount; i++)
{
var map = mxd.Map;
var enumLayer = map.Layers[uid, true];
enumLayer.Reset();
ILayer layer;
while ((layer = enumLayer.Next()) != null)
{
var featClass = (layer as IFeatureLayer).FeatureClass;
Console.WriteLine("Layer {0} has {1} fields.", layer.Name, featClass.Fields.FieldCount);
for (int j = 0; j < featClass.Fields.FieldCount; j++)
Console.WriteLine("...{0:00}. {1}", j, featClass.Fields.Field .Name);
}
}
Console.Write("\nPress enter to exit...");
Console.ReadLine();
}
static string BrowseFolderForFile(string title, string extension)
{
OpenFileDialog openFileDialog = new OpenFileDialog
{
Filter = extension,
Multiselect = false,
ShowHelp = true,
Title = title
};
return openFileDialog.ShowDialog() == DialogResult.OK ? openFileDialog.FileName : null;
}
}
}
... View more
09-15-2015
08:00 PM
|
1
|
0
|
677
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 01-19-2016 04:45 AM | |
| 1 | 09-24-2015 06:45 AM | |
| 1 | 09-15-2015 10:49 AM | |
| 1 | 10-12-2015 03:07 PM | |
| 1 | 11-25-2015 09:10 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:23 AM
|