Tag Info

New answers tagged

0

This should work for both shapefile and separate dbf file import os import arcpy import csv def dbf2csv(dbfpath, csvpath): ''' To convert .dbf file or any shapefile/featureclass to csv file Inputs: dbfpath: full path to .dbf file [input] or featureclass csvpath: full path to .csv file [output] ''' #import csv rows = ...


0

Use two models: 1) Import/Reclass and 2) weighted sum/output. To get the year to sum on, use an interate rasters. In Model Builder, Add Field "Year", calculate field [year] as: left(%value%,4) That will get you the first four characters of your raster name to use as a year. Once you've got a year field for all your rasters, sum them together on the basis ...


1

Thanks for all the help but I think I fixed the problem. The computer had two versions of python 27 installed and seems that that is the reason behind python crashing when using the CalcFiled method. I removed the version Arcgis does not use and it is not crashing anymore so its working normal now. Thanks for the help


5

Try something like this: import arcpy from arcpy import env env.workspace = "E:\Example.gdb" # here you are creating a list of all features from your workspace lst = arcpy.ListFeatureClasses("", "Polyline") # and here you are looping for featureClass in list: arcpy.CreateRandomPoints_Management(


1

I would simply set my workspace (arcpy.env.workspace = "NAME OF GDB HERE") and then list the Line feature classes into a python list (fcs = arcpy.ListFeatureClasses("","Polyline")). Then you can loop through them. So same as other answer provided but with 1 minor difference - incorporating the Polyline option: import arcpy arcpy.env.workspace = ...


0

I had the same issue and fixed it by (re)building the attribute table just before tabulating the area in my script: arcpy.BuildRasterAttributeTable_management(ClassData, "Overwrite") TabulateArea(ZoneData, zoneField, ClassData, ClassField, TablePath, processCellSize)


5

If you are using arcpy functions in python to connect to your SDE instance, then you could create an SDE connection file with OS authentication. This SDE file does not store any credentials but uses the credentials of the executing user. Then you can set up the scheduled task to run as a user with the correct DBA credentials. Windows task scheduler will ...


0

Python IDE which is installed with ArcGiS can't use GDAL modules. You have few options: Install QGis and use python shell in QGis, Install new Python IDE and again install GDAL libraries, Install development enviroment like Eclipse, there you can set python interpreter and connect libraries installed somwhere else. I think that first option will be ...


3

In python: def function(string1, string2): return string1[-7:] + string2 Then use: function(!field1_name! , !field2_name!)


0

Been thinking on this since you asked, and I can still only solve part of the problem as you have framed it. It's a good approach and I'm not sure if there is a better one, but it did occur to me that you're trying to transfer attributes from the streets (gray lines - which I assume hold those attributes) to the pipes by creating an intermediate polygon ...


0

I don't often use topologies, but I do use geometric networks a lot. As far as I know, you can register the data as versioned, but you can't register the data as versioned with the option to move edits to base - which is asked when you first click to register the data as versioned. This option will be grayed out if any of the features participate in a ...


2

You can use tool Raster Calculator. Then type this expression: SetNull("raster_name"<0, "raster_name") Choose output and you should create new raster with elevation 0-n.


5

Alex Tereshenkov's comment does bring up a good point; you probably should look into using a validation script for this specific case. But to answer your question, you should be passing the path (or name) of the feature class, along with an optional wild card and field type to arcpy.ListFields; see the ESRI docs for ListField. That method actually returns ...


2

Focal Statistics and Raster Calculator are fairly different tools. First, you need to have a raster of cells that can be used to determined whether it's developed -- for a simple example, "house" (1) or "not house" (0). Run Focal Statistics on this data. Use a rectangular neighborhood (3 by 3 cells), statistics type SUM. I think this may be what you ...


2

If you are asking if a shapefile that is created with QGIS in a Mac environment will open with ESRI in a Windows environment, the answer is yes. A shapefile is a file format. It will respond to software the same, regardless of operating system. Think of it like a JPEG. You can make JPEGs on a Mac, and view them in Windows, or Linux.


0

Ok, I know this may seem counter to how you have been approaching this matter, but, here goes another idea for how you could tackle this issue. Instead of starting with your pipelines and trying to buffer them out to cover the empty space, why don't you start with a polygon of the entire city/area you are trying to perform this operation for. From that ...


0

with perfect run off and if time is not taken into account (instantaneous run off), your sink will be filled when the area of the catchment multiplied by the height of the precipitation is equal to its volume (assuming that there is no run off FROM the sink). So you want the volume of the sink divided by its catchment area. see watershed if you need to ...


0

There are a couple options, actually. Use Clip to trim the raster of interest (e.g. DEM) to only the area that you want to analyze. Advantage: you have a permanent feature that you can always use -- good for repeated analyses over the same area. Disadvantage: duplicate rasters consume file space and/or can get confusing. Set the appropriate ...


1

buff_name = "name_to_test_first" # or =raw_input("Please enter a new data set name") while arcpy.Exists(buff_name + "*"): # I use a wild card because the new FC include the buffer size, so this is the name you don't want to exist buff_name=raw_input("Please enter a new data set name") #don"t forget to indent #else: this else has nothing to do ...


2

This is more a Python logic problem than a GIS problem, I'd recommend asking questions like these on Stack Overflow. Try this: import arcpy arcpy.env.overwriteOutput = 1 arcpy.env.workspace = "C:\\salzburg.gdb" sbgRivers = "sbg_rivers" buff_name = raw_input("Please insert a file name:") while arcpy.Exists(buff_name): for buffer_size in ...


0

I used to do this quite a few years ago for lease mapping, first using Excel spreadsheets, then database data. You need to join your spreadsheet data onto your PLSS features, using a unique identifier for each section. So for a given section, its unique ID would be something like: 05-14N-32W-14 where the order is meridian-township-range-section. The actual ...


0

Technically yes, but it kind of depends on your situation and existing data. What you're talking about are Feature Templates, also discussed at this blog post. However the templates may not display as you set them if there are already features symbolized in the map. If you do have existing data symbolized in the map, you don't have to create a layer file ...


0

Maybe you should start with a "repair geometry" and check your coordinate system to make sure that your shapefile is not the source of your problem. If calculateField still doesn't work, but the rest of your Python script runs properly, probably the best solution would be to use an arcpy.da.updateCursor() and compute the area for each row. Possible ...


0

I ran into this exact issue yesterday. My code uses a filter list to pick counties, zoom to them and mask all the others. That worked fine in the pyt. Then I added the functionality to load the layer it was built to work with. It works fine if the layer is already in the map, but if it adds the layer from the code it would load it/select/zoom to/ and unload ...


1

The documentation only makes mention of being able to use shape.area on Python expressions. You will need to use a Python expression to do this. I would very strongly recommend reinstalling ArcGIS. Python not working is indicative of a corrupt installation of ArcGIS, and working around it will not alleviate the problem in other areas.


4

You can create unique values but based on which polygon the point resides in. Add a unique attribute which is at least 10 times larger than the amount of points to your polygons, and the join this value to your points. Like in your example, the upper polygon would have 100. Join to your points and create unique values that is something like 101 and 102. ...


1

This is how I would do it: Convert your line to a raster (Polyline to Raster) Convert the raster to points (Raster to Point) Add Z value from the raster to the points (Extract Values to Points). A new field named RASTERVALU with the raster Z value is added. Turn the points into a feature layer and select the point with the minimum Z field value using for ...


2

You can try using the Maplex labeling engine which will give you more control than the standard labeling engine. In the labeling toolbar, enable Maplex. There are several options in which you can adjust the settings for feature weights and overlapping labels. See the ESRI documentation. Weights can range from 0 to 1,000. Features with high weights ...


0

This is possible by assigning a higher weight to the line layer's features than to the point layer's labels. Open the Properties dialog for the line layer, and choose the Labels > Placement option, then set a High value for the Feature Weight. This causes ArcMap to move those labels which would have overlapped the lines, or to omit drawing them where ...


1

Part of your error is in the tool you used. You may want to convert them (depends on what you're doing - it's more likely you'll want to go the other way and have your GPS points projected to your contour CS), but that's not what the Define Projection tool does. That tool is intended to be used when you know the projection the data is in, but it doesn't (no ...


4

If it originally shows as "unknown" for CS how is it/how would I know that it is a PCS? Decimal degrees range from -180 to +180 west/east and 90 to -90 north/south, so the values you're seeing are definitely not decimal degrees. If there was no metadata provided with the contour data (and the agency isn't able to provide any information), you may ...


3

I have only tested this very briefly (and with a limited variety of data), but this script demonstrates one way this might be accomplished: import arcpy import csv import os import codecs import cStringIO def batch_convert_dbf_to_csv(input_dir, output_dir, rename_func=None): """Converts shapefiles and standalone DBF tables within the input directory ...


3

If you look for a full arcpy solution (without dbf) you can use import glob glob.glob('S:\\output_tables\\*.dbf') for listing you tables, then arcpy.ListFields() for the field names and outname = os.path.basename(inputtable)[3:-4] + ".csv" to create your output names and finally arcpy.da.SearchCursor() to get a Python iterable that you can ...


4

You should use the Reorder Stops To Find Optimal Route option. By default, a route traverses stops in the order you define. However, you can possibly shorten the route further by letting Network Analyst find the best order. It will account for a variety of variables, such as time windows. Another option is to preserve the origin and destination ...


0

Few tips from ESRI support: http://support.esri.com/es/knowledgebase/techarticles/detail/35151 Try "Change the data frame coordinate system to match the data being exported." first.


6

In ArcMap, Go to the Customize menu, click Style Manager. You will see a style on the left called "Dano". Under that, any categories which contain custom symbols, labels, etc. you've made will appear as a yellow folder. Click the one you're concerned with and you'll see your custom symbols on the right. Right-click to delete any you don't want. If your ...


0

As mentioned by Aaron, if you want to analyse a time series of NDVI data, you need to make sure that it is computed in a consistent way (based on the reflectance values and not on the digit numbers). You can find more information here If you do so, NDVI will be between -1 and +1, and the larger the value the more "green leaves" you are likely to observe (I ...


1

I should first mention that if your ASTER data are not calibrated to reflectance, you are not actually calculating NDVI correctly. Make sure you have the appropriate calibrations in place and are indeed using relectance values rather than DN, radiance or pixel brightness values. Very often products are already served-up to reflectance. The actual values ...


-1

Try converting your raster data set to points,use tool (get values to point) which will give you value of NDVI of every pixel to points. Then again you can convert to raster. OR Try 'calculate Statistics' in Raster tools.


3

Pending there are no errors in your data or calculations, values for NDVI will always fall between -1 and 1. NDVI values are calculated from reflectance, which is the fraction of radiation that is reflected by a given surface. It sounds like your NDVI raster might be in integer format, which means you'll have rounding errors (e.g. raster displays '1' instead ...


0

I was experiencing very similar difficulties, and tried repairing geometry with all files to no avail. What eventually worked was placing both files into their own file geodatabase, and then running the operation.


2

I actually had this exact same issue. I had a script that would search through sub folders in a root directory, check if they had shapefiles, convert the shapefiles to feature layers then to kmls. It would run through about 20-40 conversions and then just stop, no error codes, just the script would end. It would end at different places each time. My ...


4

I would approach this issue in this way. One can create a feature layer consisting of just one point feature and check whether it intersects the polygon feature layer (using arcpy.da.SearchCursor). However, this would be a bit inefficient since you are dealing with so many features. However, we could create a feature layer and check whether it intersects ...


1

I had a tool I made that basically did this, so I just tweaked it a little to fit what you need. It's called Calculate Point Statistics, and you can download it here: http://ianbroad.com/downloads/CalculatePointStatistics.tbx Source code: http://ianbroad.com/downloads/scripts/CalculatePointStatistics.py It takes an input Polygon and Point feature class ...


1

In order to use C# with the ArcGIS Platform I recommend that you review the ArcObjects API Reference for .NET, and in particular this ArcMap Overview. Something to be aware of at the outset is that little (some annotation is one exception) or no spatial data is stored in *.mxd files. Consequently, I suspect that what you are looking to do is to access ...


2

Seeing as you have Info (Advanced) level of license you can use the cool geoprocessing toys. Get the values of the polygons onto the points either by spatial join, identity or intersect. I think that intersect would be my choice. This will generate a point for each intersection i.e. if a point falls in more than one buffer then there will be one instance ...


2

I just did some basic tests, converting a raster to a binary mask by performing a Con, which created an 8-bit output. From there, I could use Copy Raster to convert the output to a 1-bit raster: arcpy.CopyRaster_management("in_raster", "C:/workspace/foo.img", "", "", "", "", "", "1_BIT") I confirmed that ArcGIS and GDAL both see this as a 1-bit raster. ...


0

Explode the polyline to ensure it is not a multi-geometry. Run Repair features on the polyline features class which may re-order the line segments. Additionally, if you need to reverse the line orientation, which flips the start and end vertices, you can select the line while editing, click the "Edit Vertices" button, right click on the line and select ...


1

I have wanted to comment first, but then it seemed more appropriate to wrap it to be an answer (even though it might be incomplete). I've run your code on my machine (top hardware laptop with SSD) appending a file geodatabase feature class to a SQL Server geodatabase feature class on the same machine which took me around 13 min. I cannot tell you for sure ...


0

As mentioned by @0kcats in the Comments, the ArcGIS 10.2.1 for Desktop release may well have addressed your performance concerns: The Generate Near Table and Near tools have been completely rewritten to be dramatically faster and they now have an optional Method parameter that determines how distances are computed. When Method is set to GEODESIC, ...



Top 50 recent answers are included