Tag Info

New answers tagged

2

For this, you need to create new ogr features and save them to the layer and not simply create geometries ( geom1.AddPoint(linkpoint[0],linkpoint[1]), feature1.SetGeometry(geom1)), with dataSource.SyncToDisk() at the end (SyncToDisk() might be helpful to ensure that a particular feature is flushed to disk but it is not necessary here, look at the script). # ...


0

This is just a problem of too few decimal places being shown. You need to use DOUBLE instead of FLOAT as the field data types. Also, after you calculate geometry on each lat-long field, you can right click on the field name in the attribute table and go to properties. Click the [...] button next to Numeric, and increase the number of decimal places up to ...


0

There is a Curvature GP tool in Spatial Analyst that may be helpful. It can tell you how convex or concave a surface is. For example it can be used to determine ridges and valleys. You would still need to convert the output raster to vector - likely it would be lines that you convert to initially.


0

At first you have to know a SRID (EPSG) code of the coordinate reference system (CRS) to which you want to convert lat/lng coordinates - each of existing CRS has any kind of distortion (see this). For example, for Europe, the EPSG:3035 is used for statistical mapping at all scales and other purposes where true area representation is required (equal area ...


1

You need to construct your string properly. Instead of: 'POINT("shot.lon" "shot.lat")' Try: 'POINT(' + "shot.lon" + ' ' + "shot.lat" +')' EDIT - However - for your example, that will only give you distance in degrees. This will work for projected coordinates (UTM, for example) but not decimal degrees.


0

I have symbols set up for all those options (you probably do too). Something like this ... symbols = {}; symbols.circle = new SimpleFillSymbol().setColor(new Color([0, 0, 180, 0.25])); or in your "else if" block, } else if (type === "circle") { symbols.arrow = new SimpleFillSymbol().setColor(new Color([0, 0, 180, 0.25])); All of the second part ...


6

The Describe object also has the hasM and hasZ properties.


1

I think the two messages are separate. The first message is just a warning that anything such as formulae, formatting and additional worksheets cannot be saved in a CSV as it is a simple ascii format. The second message suggests that you maybe have a text field as one of your attributes which contains a comma. This will effectively introduce an extra ...


3

There are a number of definitions to "centroid", but the most common solution for labeling a linear feature involves either the midpoint along the arc or the midpoint of the longest segment on the arc. Averaging the vertices is unlikely to be "on" the feature and will over-emphasize the significance of short segments. If it's acceptable for the label to be ...


0

Tuple of values to cursor.InsertRow must be complete. If SHAPE@ in nfields, it has to be defined somehow. Period. You might consider creating null geometry


2

Instead of cutting out polygons, an alternative is to reshape your polygon (Toggle editing > Edit > Reshape Features) into your desired corridor. The topology should remain intact as no polygons are being removed.


1

Hi Athena and welcome to PyQGIS programming! For having a good start you could take a look at PyQGIS Cookbook! Anyway, the snippets below is an example what you are trying to do of: from PyQt4.QtCore import QVariant ## create an empty memory layer vl = QgsVectorLayer("Point", "myLayer", "memory") ## define and add a field ID to memory layer "myLayer" ...


2

You have forgotten to add the feature: lineLayer = QgsVectorLayer("LineString", 'test layer', "memory") pr = lineLayer.dataProvider() # define the fields of the layer pr.addAttributes([ QgsField("ID", QVariant.String), QgsField("latStart", QVariant.String), QgsField("lonStart", QVariant.String), QgsField("latEnd", QVariant.String), QgsField("lonEnd", ...


1

I am no expert but I would assume when you draw any points, lines or polygons, they will have to be placed in a vector layer beforehand. The following code is from here which describes how to add a line layer and attributes: from qgis.core import QgsVectorLayer, QgsField, QgsMapLayerRegistry from PyQt4.QtCore import QVariant #create Layer ...


1

You are correct that if your data are in a small region that you should use a geometry type. However, you would also normally transform the Lat/Long coordinates to a spatial reference system for the region. Normally most folks choose a UTM Zone, which describes coordinates for Eastings and Northing with length units in metres. Check out ST_Transform to ...


0

When using st_length() I can convert to geography using st_length(line.line_geometry :: geography) as was suggested or using ST_Length2D_Spheroid(line.geometry, 'SPHEROID["GRS 1980",6378137,298.257222101]'). Both answers seem to be the same as far as precision is concerned: 580139.3016159851 vs 580139.3016215176. I'm guessing the slight difference is due to ...



Top 50 recent answers are included