Hot answers tagged

23

Shapefiles have a limitation of maximum 254 characters per field (See switchfromshapefile.org). If you need more than that you will need to switch to a different format. If you don't know which file format you want to choose, go for Geopackage, which is an OGC standard (and in newer versions of QGIS and other GIS packages the default file format). PostGIS ...


18

Yes - I use the Rectangle Text tool from the Draw toolbar instead. It is not well known (see the number of times it is requested on ArcGIS Ideas) but is documented as Adding text that flows within a graphic: You can add text that flows within a graphic to your map annotation or graphic text by using the Polygon Text, Rectangle Text, and Circle Text ...


12

Python has a built-in for leading zeros. Use str.zfill() to add leading zeros into a text field. my_string = "1" print my_string.zfill(2) # Prints 01 my_string = "1000" print my_string.zfill(2) # Prints 1000 (example from https://stackoverflow.com/a/21620624/5754917) So in the field calculator you just need to specify the name of the field with ...


10

Insert text > Properties > Angle 160


9

Yes, it's possible with the unidecode library in python... (documentation). This tries to find the nearest ASCII equivalent to each unicode character. from unidecode import unidecode s=""" osm_id,code,fclass,population,name,longitude,latitude 276645544,1003,village,221,KrĨ,14.248410,49.194988 444571400,1003,village,88,Radonice,14.548085,49.143251 488567474,...


8

Assuming all your text files are into the same directory, you can run this code snippet in the QGIS Python console to get your files loaded as individual layers in QGIS: import os.path, glob layers=[] for file in glob.glob('/tmp/xy/*.txt'): # Change this base path uri = "file:///" + file + "?delimiter=%s&xField=%s&yField=%s&useHeader=no&...


7

For ArcGIS v10 and greater you may add a text document as an attachment to a geodatabase feature class features. Attachments provide a flexible way to manage additional information that is related to your features. Attachments allow you to add files to individual features and can be images, PDFs, text documents, or any other type of file. For ...


7

There is a bug in 2.18.8 : issues.qgis.org/issues/16600#change-79959 Install/use a version <> 2.18.8


6

Try using an annotation feature class for the 'DRAFT' text, manually editing the text, and setting the transparency for the layer at 50%. This allows you to see the features under the text, and it is not necessary to export the document for use in another program.


6

As far as I know, there is no way to make text transparent in ArcMap. My suggestion for a workaround would be to export to PDF and then add the watermark using Adobe. That's what I do to add watermarks to my maps. The limitation of this would be that it requires Adobe Standard I believe. If you don't have Adobe Standard, here is a link with some other ...


6

I don't think you can - not with a text box at least. (QGIS 2.18.3) By text box, I'm assuming you mean 'label' But you can use an HTML frame, and a bit of CSS instead. This will give you more typographic control, and let you define line spacing in pixels, mm, ems etc. Something like this, which double-spaces lines. You can use the line-height css style ...


5

If you are talking about ArcMap then there is not a center tag. Isn't the text always centered? Do you mean justified? I guess it doesn't matter since there is no justified tag either. These are the documented tags: Font: <FNT name='Arial' size='18'> & [LABELFIELD] & </FNT> Color: <CLR red='255' green='255' blue='255'> & [...


5

It might depend on your operating system which you did not mention. Usually "command > filename" works to print the output into a file instead of the terminal. Note that this only captures the result, not any debug information, if you want to pipe debug information to a file you'll need to specify the location in a config setting like: ogrinfo --debug on --...


5

A way of converting an attribute table to a comma separated text file is to run the Table to Table tool. The location would be a folder such as c:\temp\mydata and the output table would be test.txt. If you set the field mappings then you can choose which fields get exported. But you may get yourself into trouble, what happens if a text value contains a ...


5

Have you checked the default setting? Settings -> Options... -> CRS -> CRS for new layers (Prompt for CRS)


5

Use double quotation marks for field names. Use single quotation marks for strings. In your example, "PROP_TYPE" IS "RES" You're asking QGIS to select features whose value in the "PROP_TYPE" field is the same as their value in the "RES" field. In order to select features whose value in the "PROP_TYPE" field is the string value 'RES', use this ...


4

that's probably not done with one transformer. I'd use a StringSearcher or SubstringExtractor to get the characters that make Problems. You can then try if a StringReplacer can replace the characters. If again a the german characters are not replaced correctly you could analyse the ASCII code with the CharacterCodeExtractor and replace it with ...


4

You can Select All Elements under the Edit menu. Beware that this select all graphics in the current view (either Data or Layout View), both on- and off-screen. That means all lines, map annotation, markers, etc.


4

A similar approach to what has Erica published, but with more details: Export text files to a file geodatabase table (useful because you will get 0 for the vertex ID for those polygons which have only 3 points - thus no need to handle this later on); Convert those tables into dictionaries; polygons {41880: (26287, 26286, 26748, 26747), 41879: (26748, ...


4

Instead of setting the text contents of each element set their name to something like "Text1" or even better you could make the element names match up with the key names in your table like 'AEGbuffer'. If it were me I would also add a suffix to the fields so i can make sure I am operating only on the table elements. You might come back later and add text ...


4

Definitely, you need a "Group stats" plugin: a litle tutorial from Anita Graser: https://anitagraser.com/2013/02/02/group-stats-tutorial/ It works like a dynamic table in Excel.


4

If you are just adding text to the end of an existing string, then just concatenate text onto the end: elm.text = "{0} - Additional text goes here".format(elm.text) So Area 1 becomes Area 1 - Additional text goes here


4

Are you trying to write multiple lines to the file or multiple values in the same line? Take into account that the f.write() method takes only one argument which is the value to be written in a specific line. Using the f.writelines() method allows you to specify a list of values to be written in a specific number of lines (depends on the size of the listt ...


4

You should be able to import GeoJSON geometry objects directly. Here is an example of a MultiPolygon: feature_geometry = { 'type': 'MultiPolygon', 'coordinates': [[[ [-90, 24], [-90.001, 40], [-90.001, 39.001], [-90, 31.001], [-90, 27] ]]] } Also, as mentioned in the comments, you can directly convert geojson into a shapefile using ...


4

Based on Michael Stimson's answer, I've changed the header of the file into ncols 1440 nrows 720 xllcorner 30 yllcorner 450 cellsize 1.000000000000 NODATA_value -9999 It worked like a charm afterwards


4

Try replacing both the newline and 'aaa': .replace('\naaa', "\nTEXT_ELEMENT")


4

A google on "python replace nth occurence of string" will take you here: Replace nth occurrence of substring in string and the accepted answer has a function for it: def nth_repl(s, sub, repl, nth): find = s.find(sub) # if find is not p1 we have found at least one match for the substring i = find != -1 # loop util we find the nth or we find ...


4

If your CSV contains columns with values that are all valid numeric representations then it will be read in and interpreted as a numeric field and so available in graduated styles. If the column contains text that cannot be read as a number, then it will be interpreted as character values, and so not available for graduated styles. For example this CSV: ...


3

Go to Data Frame Properties Frame Background Properties Change Symbol Edit Symbol Chose Type: Marker Fill Symbol Marker... Edit Symbol... Character Symbol Add letters in different layer. Change color(white), size,Mask-Gray.10% and offset. Fill Properties- Separation-x-250,y-250.


3

In your MXD, check the Size and Position tab of your text element Properties, and if you make its name be called say "TextElement1" then changing: for TextElement in arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT"): TextElementName = "road 90" if TextElementName == "TextElementName": true print 'text' in your code to be: for ...


Only top voted, non community-wiki answers of a minimum length are eligible