Tag Info

New answers tagged

2

If the crash doesn't happen when copying from a local geodatabase I'd start by looking at some aspects of the source geodatabase: The Feature Class Bad features can cause problems with exporting data, faults such as self-intersecting or unclosed polygons, rings in the wrong direction etc.. Most DBMS have a methods for validating the geometry of the ...


1

As a cavaet, be very careful about doing any geometry comparisons particularly geometry objects. One should be aware that the geometric operations are 2D whether you have 3D objects. You will have to compare the individual values to check for equality, preferably in Python. On a second, but related point, be careful what the geometry means. Consider the ...


3

Use the geometry object's equals method. With polygons and polylines, if their symmetric difference is empty they are considered equal. So for example, in the below, g2 is the same as g1, it just has an extra vertex in the middle, and g3 is opposite to g1, so always equal. >>> g1 = arcpy.Polyline(arcpy.Array([arcpy.Point(1, 1), arcpy.Point(3, ...


4

You can use Find Identical, using the geometry of the features. Alternately, you can spatially join a feature class to itself, and use the "ARE_IDENTICAL_TO" as your match option. This can be useful if you have a bunch of features stacked on top of each other and you want to deduplicate (features with a Join_Count > 1). I recently used this to clean up some ...


1

here's some untested code that should give you close to what you're after. two main things... -make big empty numpy array and fill it one raster at a time EDIT...no surprise...big array didn't fit. -also store a year numpy array for easy masking of years. some suggestions in comments as I went. import arcpy import numpy as np import datetime # Define time ...


1

Have you checked your path variables? PYTHONPATH should be set to C:\Python27\Lib and PYTHONHOME should be set to C:\Python27 (Or wherever your python install is located). Also note that python is installed with ArcGIS, and it can cause confusion if you have more than one install of python.


2

You are on the right track and the geopandas GeoDataFrame is a good choice for rasterization over Fiona. Fiona is a great toolset, but I think that the DataFrame is better suited to shapefiles and geometries than nested dictionaries. import geopandas as gpd import rasterio from rasterio import features Set up your filenames shp_fn = ...


0

If you can do from osgeo import gdal,ogr your GDAL was built with the Python bindings otherwise you wouldn't be able to import it. If you want to start a GDAL utility (gdalwarp, gdal_translate, gdal_merge) from within Python your best bet is to use Pythons subprocess module as these utilities are spawned from the command line. An example: import ...


4

This line here creates a timedelta object: # Calculates the difference between firstLogdt and lastLogdt timeDiff = lastLogdt - firstLogdt A datetime object is different type than a timedelta. The timedelta object doesn't fit with a date field (hence the TypeError). You could instead create a double field instead of a date field, and store the difference ...


1

I am hoping this example will help answer the question too and is on newer software. It builds on the answers and comments mentioned above. Setup: Windows 7 SQL Server 2012 R2 ArcGIS 10.2.2 (Server and Desktop) Load needed to be nightly. It was ~9300 records and 234 attributes. The original model was below and was done all in SQL Server 2012 R2/SDE ...


2

I think this will perform what you are looking for. It iterates the first two fields of each row and compares each value to the dct. dct = {} subregion = 0 with arcpy.da.UpdateCursor(fc_in, (fld_o, fld_d, fld_name1)) as cursor: for row in rows: for i in row[:2]: if not i in dct.keys(): dct[i] = subregion ...


6

in provides a quick logical test for determining if a value is contained in a list, dict, or string. if from_g in dct_max: either from_g is found in dct_max (true) or it's not (false). The rest of your questions would be resolved by researching how dict objects work (lots of good examples on Stack Overflow).



Top 50 recent answers are included