POST
|
I have a layer in a sde geodatabase and a table in RDBMS (sql server). I do a join between them and show a label based on fields in the RDBMS table (in arcgis 10.2). The service is fine and shows the label well, but when trying to show the service on my application (based on runtime 10.2.5 for .net) it doesn't show a thing (I tried using a simple label or a label based on VBScript.Neither works)... The only way it works is by exporting the joined layer as a new one and showing the label out of it. It is a wrong step methodically, I know, but I didn't find any other way. It seems 10.2.5 is poor in addressing joins,symbology and label issues. Did you find a solution ?
... View more
01-30-2016
11:43 PM
|
0
|
0
|
653
|
POST
|
Hi All, I work on ArcGIS 10.1. I found the "Street Data Processing Tools". On the website it said that the toolbox works on ArcGIS 10.1 but when I downloaded the files and tried to install them according to the site's instructions, I got the following error message: which means (as far as I understand) that the computer is searching for a ESRI.ArcGIS.Geoprocessing DLL for Arcgis 10.2 - ( I have the same dll on my computer, (in the 10.1 installation) version=10.1.0.0). So, MY QUESTION IS THIS: Is there somewhere a version I can install on ArcGIS 10.1 ? Thanks in advance
... View more
12-04-2014
01:31 AM
|
0
|
2
|
4387
|
POST
|
I'm working on ArcGIS 10.1. I have a dataset with a streets layer and a turn table. I want to create a road network for calculating routes. Problem: Every time I create the network and build it I get a lot of build errors of the same type: SourceName: no_turn * ,ObjectID: 5 ** , Cannot find edge element corresponding to turn identifier 1. What is the problem? (The data is valid - it was used to make a correct network in the past - I took the data from there and tried to make a new, identical network.) * no_turn is the name of the turn table. ** 5 - the number of the objectid of the specific turn
... View more
12-02-2014
04:47 AM
|
0
|
1
|
4036
|
POST
|
Simply put, you should never try to export or make layers or copy feature classes inside a cursor. That is not what cursors are for. Exporting a geometry object is something else, but that is far to complex a solution for your need. Use the search cursor to get a list of the unique vaues in the myID field myIdList = []
cur = arcpy.da.SearchCursor(Input_Point_Layer,field1)
for row in cur:
myID = row[0]
if myID not in myIdList:
myIdList.append(myID) now loop through the list; making layers of, and copying out features with, each myId value: for my in myIdList:
outLayer = "outLayer"
if arcpy.Exists(outLayer):
arcpy.Delete_management(outLayer)
newFC = r"%s\out_%s" % (pathVar, my)
if arcpy.Exists(newFC):
arcpy.Delete_management(newFC)
where = "\"myID\" = '%s'" % (my)
arcpy.MakeFeatureLayer_management(Input_Point_Layer,
outLayer,
where)
CopyFeatures_management(outLayer, newFC) Mark, I know that cursors "are not meant" for this, but a. it works. b. I didn't find any other way, I would appriciate it if you show me a different way. The two loops you presented are not good enough - I want a single loop, as I loop over a table of 150,000 lines and want it to be quick...
... View more
04-28-2014
03:25 AM
|
0
|
0
|
632
|
POST
|
Hmmm, that's tricky. Maybe the Select_analysis would work better: sql = '"' + field1 + '"' + ' = ' + str(int(row[0]))
arcpy.Select_analysis(Input_Point_Layer, rowBasePoint,sql) If that doesn't work, I might you might need a different sql statement (because you're using a '.gdb'). Try this too: sql = '[' + field1 + ']' + ' = ' + str(int(row[0]))
arcpy.Select_analysis(Input_Point_Layer, rowBasePoint,sql) Let me know how it goes. Hi Joshua , Sorry for the late reply. Your Idea worked beautifully, when I used Select_Analysis instead of CopyFeatures. Thanks!
... View more
04-28-2014
03:20 AM
|
0
|
0
|
632
|
POST
|
I think your diagnosis is correct. You'll have to create a feature layer and export that instead of the row. Assuming "myID" is unique, this should work: sql = '"' + field1 + '"' + ' = ' + str(int(row[0])) #use this line if myID is a number (and remove the other line)
sql = '"' + field1 + '"' + ' = ' + "'" + str(int(row[0])) +"'" #use this line if myID is a text (and remove the other line)
arcpy.MakeFeatureLayer_management(Input_Point_Layer, "selection", sql)
arcpy.CopyFeatures_management("selection", rowBasePoint) (insert this code where the arcpy.CopyFeatures_management line is) Let me know how it goes. Good luck! Hi Joshua, thanks for answering. I did as you wrote (in my case the myID is a number), but it made a feature class consisting of all the features in the original fc, and not just the ones selected by the "row". Any IDEAS?
... View more
04-22-2014
09:08 AM
|
0
|
0
|
632
|
POST
|
Hi, I'm trying to run the following script using python that uses the 10.1 introduced arcpy.da.SearchCursor (with a group by sql clause) to run over a feature layer, select two features with the same field value (hence the group by), export the current features to an outside feature layer, and then calculate a route (using network analyst) between the two point. The PROBLEM(for now, at least): when the script runs the arcpy.CopyFeatures, the script fails. I suspect that it is due to the the input features - that row is not a valid input feature. But there I'm stuck, what should I put instead? Am I right in the diagnosis? what can I do to solve it? Thanks. import arcpy # Check out any necessary licenses arcpy.CheckOutExtension("Network") # Script arguments Field_To_Group_By = arcpy.GetParameterAsText(0) if Field_To_Group_By == '#' or not Field_To_Group_By: Field_To_Group_By = "myID" #" # provide a default value if unspecified Input_Point_Layer = arcpy.GetParameterAsText(1) if Input_Point_Layer == '#' or not Input_Point_Layer: Input_Point_Layer = "D:\\Projects\\A\\MyDefaultGDB.gdb\\MyDefaultInput" # provide a default value if unspecified # Local variables: FTGB = Field_To_Group_By Add_Locations_Output_Layer = FTGB Solved_Layer = Add_Locations_Output_Layer Routes = Solved_Layer route__Value_ = Routes Route__Name___2 = route__Value_ Route__Name___3 = Route__Name___2 totals__2_ = Route__Name___3 Solve_Succeeded = Add_Locations_Output_Layer Value = Field_To_Group_By BasePointsResult = "D:\\Projects\\A\\BasePoints.gdb\\" net_ND = "D:\\Projects\\A\\MyRoute.gdb\\net\\net_ND" totals = "D:\\Projects\\A\\SumsOfRoutes.gdb\\totals" Make_Route_Result_Layer = "Route" count = 0 field1 = "myID" sql = [None,"GROUP BY myID, OBJECTID"] currObj = arcpy.da.SearchCursor(Input_Point_Layer,field1,sql_clause=sql) try: for row in currObj: rowBasePoint = BasePointsResult + "basePoints_" + str(int(row[0])) print count # Process: Make Route Layer arcpy.MakeRouteLayer_na(net_ND, "Route", "Seconds")#, "USE_INPUT_ORDER", "PRESERVE_BOTH", "NO_TIMEWINDOWS", "", "ALLOW_UTURNS", "Oneway", "NO_HIERARCHY", "", "TRUE_LINES_WITH_MEASURES", "") print "MakeRouteLayer" print row # Process: Copy Features - create BasePoints arcpy.CopyFeatures_management(row, rowBasePoint )#, "", "0", "0", "0") print "basePoints_" + str(int(row[0])) print "Copy Features -basepoints" # Process: Add Locations arcpy.AddLocations_na(Make_Route_Result_Layer, "Stops", row, "Name # #;Attr_Length # 0", "5000 Meters", "", "Roads SHAPE;net_ND_Junctions NONE", "MATCH_TO_CLOSEST", "APPEND", "SNAP", "30 Meters", "EXCLUDE", "Roads #;net_ND_Junctions #") print "Add Locations" # Process: Solve arcpy.Solve_na(Add_Locations_Output_Layer, "SKIP", "CONTINUE", "") # Process: Select Data arcpy.SelectData_management(Solved_Layer, "Routes")
... View more
04-22-2014
06:46 AM
|
0
|
6
|
2339
|
POST
|
You cannot use '*' when using sql_clause. You must specify each field explicitly. OK, I GOT IT (I THINK). The same fields should be in the "group-by" part and in the "fields" part. THANK YOU JAMES, THANK YOU MATHEW it is very confusing, and the ObjectID part is weird, I wouldn't have got it on my own in a million years. Thanks.
... View more
04-08-2014
08:02 AM
|
0
|
0
|
615
|
POST
|
You cannot include Shape_Length (see bold above) in your select because it is not included in your GROUP BY portion. Remove it and see if it at least completes without error. OK, THANKS I GET AN ANSWER BY RUNNING THE BELOW TEXT: import arcpy
fc = "D:\\Projects\\proj1\\SumsOfRoutes.gdb\\all_routes_1stBatch"
field1 = "r_Identity"
##field2 = "Shape_Length"
sql = [None,"Group BY r_Identity, ObjectID"]
fields=[field1]
cursor = arcpy.da.SearchCursor(fc,fields,sql_clause=sql)
# print r_Identity and Shape_Length of each feature in feature class
for row in cursor:
print str(row) Only I don't understand the thing with the OBJECTID, and more so, this constellation DOES NOT HELP ME, AS I CAN'T REACH THE OTHER FIELDS OF THE FEATURES. substitute field1 with "*" brings back the runtime error
... View more
04-08-2014
07:37 AM
|
0
|
0
|
615
|
POST
|
Update: This must be a bug or something because I don't see how this can be correct. According to Shaun's reply in this thread: http://forums.arcgis.com/threads/77876-Group-By-functionality-of-da.cursors-sql_clause the suggestion is to include the "ObjectID" field in the group by clause to overcome the error you are experiencing. Here's my working code:
fc = r'H:\Documents\ArcGIS\Default.gdb\RainGauges'
fields = ('Data_Type')
sql=[None, "GROUP BY Data_Type, ObjectID"]
cursor = arcpy.da.SearchCursor(fc, fields,sql_clause=sql)
for row in cursor:
print row[0]
HOWEVER, this completely defeats the ability to actually group rows because the ObjectID is a unique value!! lol... Maybe I am simply misunderstanding here, but that is exactly what is happening in my test data. That is, it doesn't matter if real/actual groups exist in my select fields, they will NEVER group correctly because I must include the ObjectID in the group by clause (it is unique values). I am happy to be corrected on this one! I get the same runtimeerror as before... 😞
... View more
04-08-2014
07:23 AM
|
0
|
0
|
1446
|
POST
|
OK, James, I tried to rewrite the script by your 2 suggestions: import arcpy
fc = "D:\\Projects\\proj1\\SumsOfRoutes.gdb\\all_routes_1stBatch"
field1 = "r_Identity"
field2 = "Shape_Length"
sql = [None,'Group BY r_Identity']
fields=[field1,field2]
cursor = arcpy.da.SearchCursor(fc,fields,sql_clause=sql)
# print r_Identity and Shape_Length of each feature in feature class
for row in cursor:
print str(row) I get the following error: RuntimeError: An invalid SQL stament was used. [SELECT r_Identity, Shape_Length, OBJECTID FROM all_routes_1stBatch GROUP BY r_Identity] Any Ideas as to what's wrong? and the question I asked Joshua: I know listing only 2 fields will increase the efficiency of the cursor, but will it enable me to use other fields in the layer later on?
... View more
04-08-2014
07:19 AM
|
0
|
0
|
1446
|
POST
|
Hi Joshua, Thanks for the quick response. 1. As far as I Know, the sql_clause is a string. As evidence, when I do as you suggested and write sql = (None,'GROUP BY r_Identity') I get the following error: TypeError: 'where_clause' is not a string , so that is why I have the quotation marks. Any Ideas? 2. I know listing only 2 fields will increase the efficiency of the cursor, but will it enable me to use other field in the layer, later on?
... View more
04-08-2014
06:59 AM
|
0
|
0
|
1446
|
POST
|
Hi, I'm trying to run a code that uses a "join by statement" inside a searchcursor (it was done to imitate the join by inside the iterate features tool in the modelbuilder). I've tried this code (as a trial before implementing it on the real script), but I can't seem to find the right syntax or any documentation. import arcpy fc = "D:\\Projects\\proj1\\SumsOfRoutes.gdb\\all_routes_1stBatch" field = "r_Identity" field2 = "Shape_Length" ##sql = "(None, 'GROUP BY \"r_Identity\"')" sql = "(None,'Group BY r_Identity')" fields=["*"] cursor = arcpy.da.SearchCursor(fc,fields,sql_clause=sql) # print r_Identity and Shape_Length of each feature in feature class for row in cursor: print(str(int(row.getValue(field))) + ": " + str(row.getValue(field2)) + " meters") Does anybody know how it should be written? EDIT: for the script above, I get the following error: TypeError: 'sql_clause' should be sequense of 2 strings(prefix, postfix) Thanks.
... View more
04-08-2014
06:22 AM
|
0
|
18
|
3735
|
POST
|
Hi, I have a app that was built in runtime by an outside programmer. As I'm the closest to the line of expertise I was asked to give my opinion on the app and maybe a few programming tips(regardless of me not having the source code). It turns out that in the app I can load a mpk and show it's layers on a map and do an identify their data. However, when I load a mpk that has both a polygon layer and a point\line layer, an Identify returns only the polygon Info, but never the point or line info. At first I thought that the location of the feature layer within the MPK matters, and that I should move the polygon layer to the bottom, but this has no effect. I was told unofficially by the programmer that this is an ESRI bug, but I was wondering if there is a solution, do you know of any? thanks
... View more
03-04-2014
12:01 PM
|
0
|
1
|
1168
|
POST
|
Hello, I'm using Arcgis SDK for WPF version 2.4. In my application I create a dynamic, on-the-fly simple GraphicsLayer - each graphic in the GraphicsLayer has a timeextent attribute that is given at the time of its creation. I'm trying to bind the GraphicsLayer to a TimeSlider control by code (like this example, but in wpf and using a graphicsLayer) - I'm setting a timeextent for the map and going through all the steps, but the Graphics aren't binded to the slider. Am I doing something wrong? How can I get it to work? any advice will be welcomed. Thanks in advance. Enclosed is my source code: using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using ESRI.ArcGIS.Client;
using ESRI.ArcGIS.Client.Geometry;
using ESRI.ArcGIS.Client.Symbols;
namespace timeSlider_FeatureLayer_09092013
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void btnGo_Click(object sender, RoutedEventArgs e)
{
var intervals = new List<DateTime>();
Graphic g = new Graphic()
{
Geometry = new MapPoint(200000, 600000),
Symbol = LayoutRoot.Resources["MySmallMarkerSymbol"] as Symbol
};
var dt = Convert.ToDateTime("01/01/2011 11:11:11");
g.Attributes.Add("myDt", dt);
g.TimeExtent = new TimeExtent(dt);
intervals.Add(dt);
eventGL.Graphics.Add(g);
g = new Graphic()
{
Geometry = new MapPoint(180000, 600000),
Symbol = LayoutRoot.Resources["MySmallMarkerSymbol"] as Symbol
};
dt = Convert.ToDateTime("02/02/2012 12:22:22");
g.Attributes.Add("myDt", dt);
g.TimeExtent = new TimeExtent(dt);
intervals.Add(dt);
eventGL.Graphics.Add(g);
g = new Graphic()
{
Geometry = new MapPoint(200000, 580000),
Symbol = LayoutRoot.Resources["MySmallMarkerSymbol"] as Symbol
};
dt = Convert.ToDateTime("03/03/2013 13:33:33");
g.Attributes.Add("myDt", dt);
g.TimeExtent = new TimeExtent(dt);
intervals.Add(dt);
eventGL.Graphics.Add(g);
testTS.Intervals = intervals;
DateTime dtMin = Convert.ToDateTime("01/01/2011 08:00:00");
DateTime dtMax = Convert.ToDateTime("03/03/2013 17:00:00");
testTS.MinimumValue = dtMin;
testTS.MaximumValue = dtMax;
testTS.Value = new TimeExtent(testTS.MinimumValue, testTS.MaximumValue);//MinimumValue.AddYears(3));
testTS.DataContext = eventGL;
testTS.Loop = true;
TimeExtent te = new TimeExtent();
te.Start = dtMin;
te.End = dtMax;
g.TimeExtent = te;
}
}
}
<Window x:Class="timeSlider_FeatureLayer_09092013.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:MY="clr-namespace:timeSlider_FeatureLayer_09092013"
xmlns:esri="http://schemas.esri.com/arcgis/client/2009"
xmlns:esriToolkitPrimitives="clr-namespace:ESRI.ArcGIS.Client.Toolkit.Primitives;assembly=ESRI.ArcGIS.Client.Toolkit"
Title="MainWindow" Height="350" Width="525">
<Grid x:Name="LayoutRoot">
<Grid.Resources>
<esri:SimpleMarkerSymbol x:Key="MySmallMarkerSymbol">
<esri:SimpleMarkerSymbol.ControlTemplate>
<ControlTemplate>
<StackPanel>
<Ellipse Width="50" Height="50" Fill="Red"/>
<TextBlock Text="{Binding Attributes[myDt]}"/>
</StackPanel>
</ControlTemplate>
</esri:SimpleMarkerSymbol.ControlTemplate>
</esri:SimpleMarkerSymbol>
<!--<esri:SimpleMarkerSymbol x:Key="MyMediumMarkerSymbol" Color="#FFFCEC01" Size="8" Style="Circle" />
<esri:SimpleMarkerSymbol x:Key="MyLargeMarkerSymbol" Color="#FFF60D0B" Size="12" Style="Circle" />-->
<MY:timeStrConverter x:Key="timeStrConvert"/>
</Grid.Resources>
<esri:Map x:Name="MyMap" WrapAround="True"
TimeExtent="{Binding ElementName=eventGL, Path=Value}">
<esri:ArcGISTiledMapServiceLayer ID="BaseLayer"
Url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer" />
<esri:GraphicsLayer x:Name="eventGL">
<esri:GraphicsLayer.MapTip>
<Border Height="80" Background="White">
<StackPanel>
<TextBlock>�?�?�?ק�?</TextBlock>
<Rectangle Width="20" Height="20" Fill="Blue"/>
<TextBlock Text="{Binding Attributes[myDt], Converter={StaticResource timeStrConvert}}" Foreground="Black"/>
</StackPanel>
</Border>
</esri:GraphicsLayer.MapTip>
</esri:GraphicsLayer>
</esri:Map>
<Button x:Name="btnGo" Width="100" Height="20" VerticalAlignment="Top" Click="btnGo_Click" >Go</Button>
<esri:TimeSlider Name="testTS" Height="20" VerticalAlignment="Bottom" TimeMode="TimeInstant" Value="{Binding ElementName=eventGL, Path=TimeExtent}"/>
<Grid>
<!--<Rectangle Fill="Transparent" RadiusX="2" RadiusY="2" Margin="0,223,287,5">
</Rectangle>-->
<!--<StackPanel Margin="5">
<TextBlock Text="{Binding Start.Year}" FontSize="12" />
<TextBlock Text="->" FontSize="12" />
<TextBlock Text="{Binding End.Year}" FontSize="12" />
</StackPanel>-->
<!--<esri:TimeSlider x:Name="MyTimeSlider" Height="20" TimeMode="TimeExtent" MinimumValue="{Binding ElementName=MyMap, Path=g, Mode=OneWay}" MaximumValue="{Binding ElementName=MyMap, Path=g, Mode=OneWay}" Value="{Binding ElementName=MyMap, Path=g, Mode=OneWay}" Margin="0,0,265,291"></esri:TimeSlider>-->
<!--<esri:TimeSlider x:Name="MyTimeSlider" Height="20" TimeMode="TimeExtent" MinimumValue="{Binding ElementName=MyMap, Path=Layers[EarthquakesLayer].TimeExtent.Start, Mode=OneWay}" MaximumValue="{Binding ElementName=MyMap, Path=Layers[EarthquakesLayer].TimeExtent.End, Mode=OneWay}" Value="{Binding ElementName=MyMap, Path=Layers[EarthquakesLayer].TimeExtent, Mode=OneWay}" Margin="0,0,265,291"></esri:TimeSlider>-->
</Grid>
</Grid>
</Window>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
namespace timeSlider_FeatureLayer_09092013
{
public class timeStrConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
DateTime dt;
if(DateTime.TryParse(value.ToString(), out dt))
{
return dt.ToShortDateString();
}
return null;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
... View more
09-15-2013
07:26 AM
|
0
|
1
|
697
|
Title | Kudos | Posted |
---|---|---|
1 | 04-28-2013 10:00 PM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|