1
vote
2answers
160 views

Creating a new feature class with python and then adding attibutes

I am having trouble adding rows to a shapefile after it has been created. I'm not sure if I need to create the shapefile in memory and add the data or creating then re-open the file. While I've ...
1
vote
1answer
91 views

Arcpy ERROR 000732 when ApplySymbologyFromLayer

I want to split a shapefile by certain attribute and then apply a symbology layer, finally output it as a KMZ file. R1 = outpath + 'R1.lyr' arcpy.MakeFeatureLayer_management(fc, R1, "WHERE CAUSE") ...
3
votes
1answer
70 views

How to find number of fields in shapefile using Python?

I've been looking at the ArcGIS resources for python but I can't seem to figure this one out. I'm looking for a method to gain access to the number of fields that are within a shapefile / feature ...
1
vote
2answers
121 views

How to add shapefile as layer to map using Python and ArcPy?

I am working on an application and I am a beginner in Python :( I want to add a shapefile, the execution is successful and everything but no result appears on ArcMap, here is the code I use: import ...
0
votes
1answer
114 views

How to read shapefile of road segments into Python data structure to get begin and end point coordinates? [duplicate]

How can I take a shape file that has road segments and read it into a data structure in python that I can use to get begin and end points with? For example x, y to x2, y2. It's not a large shape ...
1
vote
1answer
135 views

How to convert shapefile to KML file using ArcPy? [duplicate]

Python script that checks to see if a specific layer file exists in the current workspace and, if it does, converts the layer file to a KML file. Does it work with a shapefile? Code so far: for file ...
2
votes
2answers
259 views

How to select specific filenames nested within several folders?

I have hundreds of shapefiles that are stored in separate folders, which are nested within several other folders. Among the shapefiles I only need the ones that are named 'POINT*.shp' How do I get ...
2
votes
2answers
64 views

Accessing features via arcpy

i try to use arcpy to accessing the features of a shapefile. I tried to use a searcheCursor, like that: cursor = arcpy.da.SearchCursor(Points, ["SHAPE@XY"]) for row in cursor: x, y = row[0] ...
2
votes
1answer
113 views

How to check if a shapefile is empty with arcpy

I have a bunch of shapefiles in a folder. But some of them are empty, i.e. there are no rows within the shapefile. Is there a simply to find those empty shapefile out?
3
votes
1answer
184 views

How to convert all shapefiles in folder into KML using ArcPy?

I was trying to convert all the shp in a folder into kml. featureclasses = arcpy.ListFeatureClasses() for fc in featureclasses: # Set Local Variables composite = 'COMPOSITE' pixels = ...
1
vote
2answers
486 views

How to loop through a list of shapefiles and rename them?

I am trying to upgrade a simple script to list all shapefiles in a folder and if necessary in any folders within and then loop through the list of shapefiles and rename them. import arcpy # Set ...
0
votes
2answers
177 views

Help writing script using a shapefile - select by attribute

I am trying to take an existing shapefile and narrow down the attributes using the 'select by attribute' The problem I am trying to solve is: Find parcels that have an acreage >= 100. The code I ...
9
votes
6answers
338 views

How to programmatically check if the number of shapes = number of table records?

I have a handful of approximately 1000 shapefiles that are corrupted (see attached error message). The shapefiles were generated from eCognition Developer 8. There is a script tool that seems to ...
0
votes
0answers
124 views

How to convert shapefile to tpk using python(ArcGIS 10.1)?

I'd like to convert shapefile to tpk using Arcpy.I surf in ArcGIS 10.1 help but i couldn't find any desire reference to help me . How can i convert shapefile to tpk using arcpy ? which function i need ...
0
votes
0answers
13 views

MapInfo8.0 is not letting me edit layers imported from the server? [duplicate]

I have imported 4 layerts from my server for use in MapInfo, when i went to edit these layers the edit tool for each of these layers is grey and non accessible. Any suggestions would be greatly ...
1
vote
2answers
636 views

How to Add Shapefile with Symbology from Layer File to ArcMap MXD using ArcPy/Python?

Say I have a Shapefile: C:\DATA\points.shp A layer file: C:\SYMBOLOGY\symbology.lyr And a map document: C:\MAPS\map.mxd How can I add points.shp to map.mxd with the properties of symbology.lyr ...
3
votes
2answers
479 views

Csv to Shp conversion? [duplicate]

I am working on a really big script right now where I have a csv file that I have removed rows and columns from, and edited the headers. I need to create one big shapefile for the entire csv file then ...
1
vote
1answer
94 views

Arcpy CreateUniqueName usage: keep original input names

This is a continuation of the question I asked here: At this point I'm really just trying to get everything in one place and keep the original shapefile basename. I'll tackle merging like-named ...
5
votes
1answer
458 views

Using ArcPy to batch merge based on shapefile name?

ArcGIS 10 SP4 Python 2.6.5 I have quite a few shapefiles that are in many different directories. I'd like to pull out groups of like shapefiles, merge them, and move the results into a FGDB. I've ...
2
votes
2answers
424 views

How to overwrite a Shapefile

I want to be able to overwrite a shapefile if it exists. I think my code needs some tweaking. I am using v10. I am able to delete the actual .shp file but the .dbf, .shx, etc still remain, so if I try ...
2
votes
1answer
319 views

Create a shapefile from geometry

Please excuse my lingo, I am still learning some aspects of geo spatial and arcpy. I have a python script that takes a shapefile. The shapefile consists of a polyline. I have traversed the polyline, ...
3
votes
1answer
139 views

shapefile batch clip and merge combined

I have two shapefiles, one is polyline, the other polygon. For each polygon I would like to clip the polyline vectors inside. Using arcpy I already found part of a possible solution: ...
6
votes
3answers
178 views

Are there any open source Python modules compatible with arcpy that will allow complex SQL queries?

I am trying to handle string (non-geometry) duplicates in a large attribute table of a shapefile without having to convert to gdb and back or connect to a postgres db. I need to be able to use a count ...
1
vote
2answers
407 views

Arcpy (10.0) and centroids/points shapefile

I'm trying to create a point shapefile from a grid index polygon shapefile I created using arcpy. I know this is simple, but could anyone give a few pointers out there. Here is what I've done now: but ...
3
votes
1answer
503 views

Automate removal of duplicate polygon nodes from shape file in Arcmap

I have a whole lot of polygon shape files, many of which have got duplicate nodes. This makes processing difficult as almost all tools (erase, union, calculate area) do not work. I found that by ...
4
votes
2answers
648 views

Python - Check for number of shapefiles in a directory

I want to test: to see whether or not ONE AND ONLY ONE shapefile (which will be based on a filename wildcard) exists in a directory. Add these shapefiles to a list Use this list variable as an ...
4
votes
2answers
3k views

Arcpy - How do I specify the precision and scale of a new field?

I'm wanting to create a field with a maximum of 1 decimal place and then calculate a value into it: (I know that all my values are < 10) arcpy.AddField_management('C:/shapefile.shp', 'myField', ...
7
votes
3answers
3k views

How to include variable in where clause of arcpy.Select_analysis?

I am trying to loop through a shapefile, selecting each feature in turn and copying it to a temporary shapefile to by included in a union analysis. I'm using a cursor to find the ID name for each ...
5
votes
1answer
2k views

How to programmatically add shapefile to data frame in Arcmap

I have a toolbox with python script which creates a shapefile from JSON txt file, but it does not show the generated shapefile in arcmap, i have to add it from the output location. What code shall I ...
4
votes
2answers
1k views

Check if shapefiles exists in folder

In ArcGIS modelbuilder I want to check if a shapefiles exists, if not I want to create the shapefile in that folder. I guess the calculate value tool within ArcGIS modelbuilder can be used, but I need ...
2
votes
1answer
167 views

Using ArcPy to fetch Information from a .GDB

I am new to GIS and I would appreciate if you could guide me a little. I have a .gdb folder with data and I need to process that data to find educational institutions which are within say X Km of the ...
6
votes
1answer
1k views

Get shape filename in attribute field using field calculator

I apologize for crossposting against the ESRI geoprocessing forum, but it seems like this one gets answers. I'd like to have a modified append tool (ArcToolbox) that takes multiple shapefiles with ...
4
votes
1answer
2k views

How to add field in attribute table by python

I have research on the question (How to add an attribute field to an existing Shapefile via Python) but could not implement it. If you can give me examples on how to add field name in attribute ...
8
votes
3answers
7k views

How to create a shapefile in ArcGIS 10 using arcpy?

How can I create a shapefile using Python in ArcGIS 10? I have lat & long. From this I need Python code which will create a shapefile and display it in ArcGIS 10. Thanks.
6
votes
2answers
507 views

reorder a polygon shape file (not sort)

I've written a script which produces a polygon shape file of the extents of all the thousands of rasters in our library. I want to organise the FID so that the files with the largest extents are on ...