New answers tagged

2

Before ArcGIS 10.2 you could not rename a field using the Alter Field-tool. With 10.2. upwards is much easier to get this to work. You have to add a new field with the desired precision to your shapefile and copy all the values from the one column to the next one using fieldcalculator. Then you can delete the original column and rename the new one to the ...


0

@ gcarrillo Nice response and almost works perfectly :) When the lines are clipped some are broken into 2 (or more) segments if they pass in and out of a more complex polygon. When this occurs the correct start co-ordinates are returned but the end co-ordinates are NULL. When exported to csv they are blank. Is there a way of generating two (or more) line ...


3

This is a fairly simple task. Load both datasets into QGIS Join the two datasets using the column they both share. There are a lot of tutorials on joining on the internet. I.e.: http://maps.cga.harvard.edu/qgis/wkshop/join_csv.php or https://infogeoblog.wordpress.com/2013/02/18/joining-layers-in-qgis/ Now you just need to use the Field Calculator ...


1

Some idea...You can work around the problem by creating a Python add-in. Do job when Tool is clicked (or onKeyDown(self, keycode, shift) ). Next tool are triggered and do: #get extend mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd)[0] XMIN = df.extent.XMin YMIN = df.extent.YMin XMAX = df.extent.XMax YMAX = df.extent.YMax ...


0

What you are describing sounds to me like a Spatial Definition Query which is currently at the ArcGIS Idea stage for ArcMap. I suggest that you add your vote to it, if you have not already. You may want to submit a new ArcGIS Idea in case the existing one, which is more elaborate, does not cover the simpler Filter by Map Extent that you envisage.


1

There's also the MMQGIS plugin which, when downloaded and installed from the toolbar (Plugins > Manage and Install Plugins...), has the tool: Attributes Export to CSV File


2

Export the layer as a shapefile, find the shapefile on your PC. Copy/Rename the filename of the DBF part of the shapefile exportes to be 8 or under characters if it's not. (OLD MS DOS FILENAME ISSUE). Then, drag-drop the DBF right into Excel. Save as XLS. The copy paste method right form QGIS made text/character returns in a blob reset to the next row and ...


1

Insert a column Add your prefixes (air, car, water) by selecting the respective attributes using "select by attributes" and populate the fields using "field Calculator" Insert another column and concatenate the two fields. Hope this solves your problem.


4

Select the rows that you want to add the text in using the Select by Attribute from the selection drop down, then using a query to get only those rows. Open the attribute table then use the Field Calculator to add the required text in the rows, enable editing before you use the field calculator as any changes made outside of an editing session are ...


2

After adding the shapefile in QGIS,right click the layer and select properties, from there go to the Style tab and select Categorized This will allow you to change symbology based on a attribute, select the column you want to use (the attribute) and click classify this will add all the different attributes you can then style. Assign color to individual ...


1

To show that, it is just a rendering setting. Try the following: Right click on layer name in the Layers panel and select Properties Select the Style tab, Categorized drop down, and select the field that has the zones classes defined in the Column drop down Then click the Classify button and change the class symbol, size, and color as needed screen ...


1

If you join by id, as mentioned by @raphael, you could use the following expression in the Field Calculator which would replace values from the old column with those in the joined column. And if there's a NULL in the joined column, the old column will keep its original value: if( "JoinColumn" IS NULL, "Column", "JoinColumn" )


1

If you join the two layers by your unique ID, you will be left with one layer with 150 records and 2x the columns. In the attribute table just delete the extraneous columns and your old column. Then rename the new column to the old column name and save this layer over your old one and you should be golden.


2

As Stefan says, you have the wrong data, the basemap is just an image with no elevation data. A quick an easy way would be to download the 0m and 4000m Bathymetry data sets from Natural Earth, and clip the 0m shapefile with the 4000m shapefile (use Erase tool in ArcGIS or Difference in QGIS). Or if you need a more detailed raster data set I'd recommend ...


1

You have the wrong data. The ESRI Ocean Basemap is designed as basemap. It's also cached, so you only have the image tiles available and therefore it cannot be used for analysis. You need to get a spatial dataset with x, y & z values in order to perform depth analysis.


6

What about using re and set and setting a flag ( here 0 and 1) in python- re will extract all the names (last and first) from BENNETT MCCARL & ARNETTE BENNETT without &. For pattern matching re is of highest priority- you can use re how you want. import re def sorter(val): words = re.findall(r'\w+',val) uniques = set(words) if ...


3

Field calculator expression based on this answer def cw(sentence): words = sentence.split() counts = {} nMax=0 for word in words: if word not in counts:counts[word] = 0 counts[word] += 1 nMax=max(nMax, counts[word]) return nMax '================================================== cw( !MUID!) It will return maximum count of same words in ...


6

You can use the Python collections module and an Update Cursor to accomplish this. This method adds a new field and populates it with a 1 if there are any duplicates, otherwise a 0 if there are no duplicates. import arcpy, collections shp = r'C:\temp\names.shp' # Add a field called "check" to store binary data. arcpy.AddField_management(shp, field_name = ...


2

Assuming your source data is a FeatureClass/Table in a File GeoDatabase then the following query will select the rows you require: SUBSTRING(name FROM 1 FOR 7) = 'BENNETT' AND SUBSTRING(name FROM (CHAR_LENGTH(name) - 6) FOR 7) = 'BENNETT name is the field, I just happened to call it name. The first part is testing the left hand side the second part is ...


0

As an alternative to using ArcMap, you may want to look at ArcGIS Pro. As you can see in the graphic below I have two attribute panes floating separately (ready to be moved to another screen, if I wish), and two others docked with tabs at the bottom. Technically there still seems to be no option to minimize these panes, or to auto-hide (unpin) them ...


0

Click "Table" in the top left on the Attribute Table screen that pops up when you right click an attribute on the table of contents on the map screen. Tabs for multiple tables show up on your map screen. Close the attribute table window to see your map which will have tables on the far left. Only other possibility is that I clicked the attribute name i.e. ...


2

It is likely because you are attempting to copy directly from a .MDB file. I have just noticed this issue copying sewer and manhole features within a .MDB to another shapefile. IT doesn't happen every time, but probably has something to do with linking of attribute fields. Fix: Export those layers (you are trying to copy from) to another shapefile saved ...


3

You can use the Join attributes by location tool. Say you have the following layers: layer_a : the layer to which you want to attach attribute values from layer_b layer_b : the layer from which you want to take attribute values Go to Vector > Data Management Tools > Join Attributes by Location. Then, set the parameters as below: The tool will create ...


2

To add a column containing some attribute of a feature of another layer, with which there exists a topological relation: Define a function: layer properties -> attributes -> field calculator -> function editor Input code which does the work Eg is_contained_in() returns the value from column of feature from B which contains feature A from qgis.core ...


1

First of all, I would suggest you to save your layer as a new layer once you have performed the simple join, in order to properly save the new attached columns in the layer attributes table. To achieve that: in the TOC, right-click on layer to save > Save As... and select Esri Shapefile for instance, which is the most currently used format (unless you need a ...


5

You can use Python and the Field Calculator to strip off the numeric value at the beginning of the string. Select "Python" at the top, and then enter the following in the Code Block: def stripDigit(text): if text.split(' ',1)[0].isdigit(): return text.split(' ',1)[1] else: return text Then, in the bottom-most field, enter the ...


2

Edited To clarify, do you have multiple fields that you are trying to delete OR multiple values concatenated together in one field that you are trying to split apart or extract a certain portion of. If it is the latter, my apologies, but if it is the former, then my answer still applies. I usually use the Delete Fields tool in the Data Management Tools > ...


2

Make sure subtypes have not been defined for one of the fields in the feature class you are assigning a domain to. In the Feature Class Properties, choose "Subtypes". If a subtype field has been defined, click into each row in the table "Subtypes" and add the domain in the table "Default Values and Domains" below. A dropdown menu will appear only for the ...


2

It would be more convenient if you had a TripID field to identify the pairs. Right now, I assume they go after each other (first two rows for TripID = 1, next two rows for TripID = 2 and so forth). You could use Python if you are comfortable with scripting to select each point in the trip pair (start, end) and test whether both of them are within the ...


1

you need to create a new field in your attribute table and call it [Z] and make it float type, then do a field calculate on it making the new field [Z] = int([X]) once you have done this, you can run the stats on the new float field [Z] and it will work. you can never get stats on a field that is a string. you will always have to convert it to int or ...


1

A more robust soulution to mike's answer: long = toreal(regexp_substr(geom_to_wkt(centroid($geometry)), '(-?\\d+\\.?\\d*) -?\\d+\\.?\\d*')) lat = toreal(regexp_substr(geom_to_wkt(centroid($geometry)), '-?\\d+\\.?\\d* (-?\\d+\\.?\\d*)'))


0

I figured out eventually that I was getting this error because within the large annotation data set, there were characters that were not numbers (ex. ', !, #, etc.) and it was therefore throwing that error.


0

I just didn't know what I needed to search for. I've now discovered the concatenate option under "String > concat". To solve my problem I used the expression; concat('500m.',$ID)


1

I found a solution Instead of editing the fields myself I found a plugin that coould do the job (quickmultiattributeedit) Thank you for your help and time


2

Try this if("laeskaerm"='1' OR "laeskaerm"='true','true','false') in 2.2 Case when "laeskaerm"='1' OR "laeskaerm"='true' then 'true' Else 'false' End


2

You could use the following expression to update your "laeskaerm" field: CASE WHEN "laeskaerm" = 1 THEN 'True' WHEN "laeskaerm" = 2 THEN 'False' ELSE "laeskaerm" END


1

the simplest way I would do it is to create a new column, lets call it ElevationINT, that is short-integer or long-integer (depending on which values you have in your initial data). I would then just do a simple Field Calculator on ElevationINT using the values from the Elevation column. All the integer values will be copied as is, however all the floating ...



Top 50 recent answers are included