|
POST
|
Extended iterable unpacking is a fantastic enhancement, I really wish it could have made its way backwards to 2.7. Of course, Esri could help the situation by moving ArcGIS for Desktop to Python 3.x, but I am becoming suspicious that will never happen. I am sure I have lamented about this before, but I think Esri really missed an opportunity with ArcGIS Pro to take ArcPy to the next level. In some sense, that was done out of necessity with the ArcPy Mapping module (arcpy.mapping => arcpy.mp) because the interface is so different between Desktop and Pro, but the changes to all of the other modules and base package were minimal. As has been brought up in GeoNet before, it would be great to see the ArcPy Geometry classes expanded and made much more Pythonic, wouldn't have the change to ArcGIS Pro been a great break in the product line to introduce such new functionality? Oh well, c'est la vie in Esri-land.
... View more
12-13-2015
08:59 AM
|
0
|
0
|
1226
|
|
POST
|
Alternatively, do you have access to the ArcGIS for Desktop ISO/DVD? The ISO image or DVD has the 64-bit Background Geoprocessing packaged with the rest of the ArcGIS for Desktop related software.
... View more
12-12-2015
01:15 PM
|
1
|
0
|
3096
|
|
POST
|
The question you ask is very broad, really too broad for people to provide meaningful feedback. For example, stating "that the hardware is exactly the same (Memory, processors, etc)" but not providing any of the specs makes it impossible for someone to comment on how SQL Server or PostgreSQL will perform on that hardware, let alone compare the two DBMSes. Even if there were some general/generic performance statements that could be made about the two systems, performance is just one of many factors or business requirements that play into deciding between platforms. Regarding your second question about PostgreSQL with and without SDE, I would say it also depends on your requirements. Esri's SDE/geodatabase technology offers some advanced data models that don't exist natively in DBMSes, and it is the native data storage for ArcGIS software, but cutting out middleware usually helps performance if you don't actually need it. The more specifics you can provide about your situation and requirements, the more likely people will be able to provide feedback.
... View more
12-12-2015
01:09 PM
|
0
|
0
|
1291
|
|
POST
|
Are you doing this completely outside of ArcPy? Have you tried ArcPy Copy tool to see if it handles the YESNO field the way you want?
... View more
12-12-2015
11:44 AM
|
0
|
0
|
4934
|
|
POST
|
Not sure what version of ArcGIS you are using, but starting at ArcGIS 10.3 the "Extent object now supports JSON and polygon properties." >>> ext = arcpy.Describe(inStudy).extent
>>> new_ext_poly = ext.polygon.buffer(int((ext.XMax - ext.XMin)*0.01)).extent.polygon
>>> If you don't mind just a little rounding of the extent corners, you could drop .extent.polygon from the end of line 2.
... View more
12-12-2015
11:31 AM
|
1
|
0
|
1226
|
|
POST
|
I am not sure if the OP stated whether this is for ArcGIS for Desktop or ArcGIS Pro. Since extended iterable unpacking (PEP 3132) wasn't introduced until Python 3.0, neither lines 3 nor 4 will work with ArcGIS for Desktop since it is stuck with Python 2.x.
... View more
12-12-2015
11:14 AM
|
0
|
3
|
1226
|
|
POST
|
Can you elaborate on how you did this, that would be really helpful.
... View more
12-12-2015
10:57 AM
|
0
|
0
|
4625
|
|
POST
|
From my earlier comment in this thread: I suggest installing the Microsoft® ODBC Driver 11 for SQL Server® - Windows. I believe Esri is now packaging both the newer Microsoft ODBC Driver 11 and the older Native Client, but Microsoft has stopped updating the ODBC driver that is part of Native Client since they are moving forward using ODBC as the standard for native access to SQL Server and Windows Azure SQL Database. If you are dead set on using Native Client, it is packaged with the SQL Server Feature Pack. If you visit the Microsoft® SQL Server® 2012 Feature Pack download page, expand the "Install Instructions" section, and scroll a ways down; you can download only the SQL Server Native Client.
... View more
12-12-2015
10:54 AM
|
0
|
0
|
2954
|
|
POST
|
Ever since ArcSDE faded away as a standalone product and got integrated into ArcGIS for Server, at least from a marketing and licensing perspective, I have found some of the worthwhile documentation from earlier releases doesn't move forward. I believe the ArcSDE 10.0 C API Return codes are still mostly accurate for ArcGIS 10.2.x and ArcGIS 10.3.x: SE_INVALID_POINTER (-65) Returned by functions that are passed pointers to data that are either NULL or invalid. If you are trying to export geographic data as geographic data from an enterprise geodatabase, ArcSDESQLExecute is the wrong tool. The tool doesn't work with native spatial data types returned from various DBMSes.
... View more
12-08-2015
11:53 AM
|
1
|
1
|
5689
|
|
BLOG
|
This is the first in a multi-part series on ArcPy cursors; particularly, working with ArcPy cursors as iterable objects in Python. The first part in the series looks at some of the important components of iteration in Python. The second part in the series looks at iterating and looping over ArcPy Data Access cursors. The third part in the series looks at using several Python built-in and itertool functions with ArcPy Data Access cursors. The fourth part in the series will look at using generators or generator expressions to separate selection or filtering logic for code re-use. Fifth or following parts are unknown at this point. This and the following series of blog posts focuses on ArcPy Data Access cursors in the context of iteration, hence the title of the series. Now, it might seem silly to talk about iterable cursors since a cursor is basically worthless without iteration, but my experience scripting with ArcPy cursors and with responding to questions on GeoNet has motivated me to share some Pythonic ways of thinking about and working with cursors. When talking about iteration in Python, there are numerous terms and expressions that can be relevant to a discussion. Five terms that I believe to be especially important, and relevant to this series of blog posts, are: Glossary generator A function which returns an iterator. It looks like a normal function except that it contains yield statements for producing a series of values usable in a for-loop or that can be retrieved one at a time with the next() function. Each yield temporarily suspends processing, remembering the location execution state (including local variables and pending try-statements). When the generator resumes, it picks-up where it left-off (in contrast to functions which start fresh on every invocation). generator expression An expression that returns an iterator. It looks like a normal expression followed by a for expression defining a loop variable, range, and an optional if expression. The combined expression generates values for an enclosing function: >>> sum(i*i for i in range(10)) # sum of squares 0, 1, 4, ... 81
285
iterable An object capable of returning its members one at a time. Examples of iterables include all sequence types (such as list, str, and tuple) and some non-sequence types like dict and file and objects of any classes you define with an __iter__() or __getitem__() method. Iterables can be used in a for loop and in many other places where a sequence is needed (zip(), map(), ...). When an iterable object is passed as an argument to the built-in function iter(), it returns an iterator for the object. This iterator is good for one pass over the set of values. When using iterables, it is usually not necessary to call iter() or deal with iterator objects yourself. The for statement does that automatically for you, creating a temporary unnamed variable to hold the iterator for the duration of the loop. See also iterator, sequence, and generator. iterator An object representing a stream of data. Repeated calls to the iterator’s next() method return successive items in the stream. When no more data are available a StopIteration exception is raised instead. At this point, the iterator object is exhausted and any further calls to its next() method just raise StopIteration again. Iterators are required to have an __iter__() method that returns the iterator object itself so every iterator is also iterable and may be used in most places where other iterables are accepted. One notable exception is code which attempts multiple iteration passes. A container object (such as a list) produces a fresh new iterator each time you pass it to the iter() function or use it in a for loop. Attempting this with an iterator will just return the same exhausted iterator object used in the previous iteration pass, making it appear like an empty container. sequence An iterable which supports efficient element access using integer indices via the __getitem__() special method and defines a len() method that returns the length of the sequence. Some built-in sequence types are list, str, tuple, and unicode. Note that dict also supports __getitem__() and __len__(), but is considered a mapping rather than a sequence because the lookups use arbitrary immutable keys rather than integers. Compared to the old glossary from ArcGIS Resources, now renamed GIS Dictionary and housed over at Esri Support, the Python Glossary is quite substantial. That said, the Python Glossary is also one of those that makes sense to people that already know the answer, but it can be a bit of a reach for people new to the language. From looking over the glossary excerpt above, one can tease out that a few special/magic/dunder methods are very important to iteration: __iter__(), __getitem__(), and next() (or __next__() if one is working in Python 3.x). There are also a couple of important built-in functions that interact with those methods: iter() and next(). And last but not least, the for loop and the yield statement. There are more methods, functions, statements, and control structures involved with iteration, but the aforementioned ones are central to any discussion. For those readers interested in learning more about iterators, generators, sequences, etc...; there are numerous primers and tutorials that have already been written and are just a quick Google search away. Lists are so common in Python, and newcomers to the language get exposure to them so early, that I will use Python list examples for context alongside the ArcPy Data Access search cursor examples. The Python Glossary states that a list is "a built-in Python sequence," and a sequence is "an iterable which supports efficient element access using integer indices...." The ArcPy Data Access SearchCursor documentation states the search cursor "returns an iterator of tuples." Since iterators are also iterable, one gets a sense that built-in functions and expressions commonly used for manipulating lists may also be used with ArcPy cursors. Although one can use the built-in dir() function to attempt to return a list of valid attributes for an object, I am going to forgo inspecting the objects that way because it will introduce clutter from all of the attributes that aren't related to iteration. Instead, I will rely on the built-in isinstance() function along with built-in abstract base classes (ABCs) to look at iteration traits. >>> #import relevant ABCs from collections module
>>> from collections import Iterable, Iterator, Sequence
>>>
>>> #create a sample list and arcpy.da.SearchCursor
>>> l = [10, 20, 30, 40, 50]
>>> cur = arcpy.da.SearchCursor(fc,["OID@", "SHAPE@"])
>>>
>>> #look at iteration traits of sample objects
>>> abcs = (Iterable, Iterator, Sequence)
>>> [isinstance(l, abc) for abc in abcs]
[True, False, True] #Iterable, not Iterator, Sequence
>>>
>>> [isinstance(cur, abc) for abc in abcs]
[True, True, False] #Iterable, Iterator, not Sequence
>>>
>>> #look at the types for sample objects and iterators of sample objects
>>> it_l = iter(l)
>>> type(l)
<type 'list'>
>>> type(it_l)
<type 'listiterator'>
>>>
>>> it_cur = iter(cur)
>>> type(cur)
<type 'da.SearchCursor'>
>>> type(it_cur)
<type 'da.SearchCursor'>
>>>
>>> #look at identify of cursor objects
>>> id(cur)
262686224
>>> id(it_cur)
262686224
>>>
As one can see above, which basically demonstrates what is stated in the Python Glossary, a list is both an iterable and sequence but not an iterator whereas an ArcPy Data Access search cursor is both an iterable and iterator but not a sequence. From lines 20-21, we see that calling iter() on a list returns a new type of object as well as a new object, i.e., the listiterator. From lines 26-27, we see that calling iter() on a search cursor returns a search cursor instead of a new iterator object. Not only is a search cursor returned by calling iter(), but lines 30-33 show that the same search cursor object is returned when doing so. This design pattern of having an iterable be its own iterator is fairly common in Python. In the next post in this series, we will move beyond the components of iteration and start actually iterating over Python objects, including ArcPy Data Access cursors.
... View more
11-24-2015
11:06 AM
|
3
|
0
|
5458
|
|
POST
|
Check out the Copy tool. As the Usage notes cover: Any data dependent on the input is also copied. For example, copying a feature class or table that is part of a relationship class also copies the relationship class. The same applies to a feature class that has feature-linked annotation, domains, subtypes, and indices—all are copied along with the feature class. Copying geometric networks, network datasets, and topologies also copies the participating feature classes.
... View more
11-23-2015
03:04 PM
|
1
|
1
|
4400
|
|
POST
|
I am not even sure updating the Shape field is supported in the Field Calculator. I tried a few quick things and none of them worked. In terms of ArcPy and cursors, the new ArcPy Data Access cursors do not support empty geometries. If you try to insert or update an empty geometry using those cursors, it will simply get converted to a NULL value in the Shape field of the table. Fortunately, the older/original cursors do support empty geometries. If you select the records in the layer you want to update, the following code in the interactive Python window will replace their existing geometries with empty geometries (assuming you are working with polygons). >>> cur = arcpy.UpdateCursor("layer") #replace "layer" with layer name to be updated.
>>> for row in cur:
... row.setValue("SHAPE", arcpy.Polygon(arcpy.Array(None)))
... cur.updateRow(row)
...
>>>
... View more
11-23-2015
08:55 AM
|
1
|
0
|
2157
|
|
POST
|
Dan Patterson, thanks, and I understand about the limitations of the platform. I inquired about the ability to merge thread; but alas, Jive comes up short in that arena.
... View more
11-22-2015
06:07 PM
|
0
|
0
|
2123
|
|
POST
|
Response below copied from OP's cross-posted question/thread. Copying here so as to delete original response. Have you looked at Essential readings about the geodatabase documentation? If not, I strongly encourage you to spend some time reviewing that material. The Esri geodatabase (see What is a geodatabase?) is the native data structure for ArcGIS. The Esri geodatabase conceptual model exists independent of DBMSes, but it can be implemented in enterprise DBMSes to create an enterprise geodatabase, which has additionally functionality over file or personal geodatabases. Although ArcGIS can connect to DBMSes and consume spatial data without having ArcSDE/SDE/geodatabase middleware, the Esri geodatabase extends that functionality. For example, numerous Esri datasets or models (Raster dataset, Mosaic dataset, Geometric network, Parcel fabric, Topology, etc....) are implemented within the Esri geodatabase. If you want to work with those types of datasets or models, the choice is made for you. Also, there are limits to editing or manipulating spatial data in DBMSes when not connecting to an enterprise geodatabase. As simple as your question seems, it is too broad or open ended to get succinct answers. If ArcGIS is going to be your primary platform for consuming, manipulating, and managing spatial data; I can't imagine not using Esri geodatabases. If ArcGIS is simply a client for consuming spatial data for analysis, visualization, etc...; then it might work to forgo Esri geodatabases. In the end, what really drives the decision is your requirements, and no one can offer worthwhile advice without knowing more about those requirements.
... View more
11-22-2015
06:01 PM
|
1
|
0
|
4685
|
|
POST
|
Sigh, this is worse than a cross-post because the OP's original question was asked and answered. This duplicate post didn't come until 3 days later after others had already commented. Unless the OP wants to demonstrate some effort to read through documentation and ask specific questions tied to requirements, it isn't worth anyone's future time to comment any further.
... View more
11-22-2015
01:10 PM
|
2
|
2
|
2123
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 3 weeks ago | |
| 2 | 07-06-2026 12:29 PM | |
| 1 | 07-06-2026 12:00 PM | |
| 2 | 06-05-2026 10:30 AM | |
| 1 | 05-29-2026 08:22 AM |
| Online Status |
Online
|
| Date Last Visited |
an hour ago
|