# Tag Info

11

This code will work on the lastest dev build of QGIS. from qgis.utils import iface from qgis.core import * from PyQt4.QtCore import QVariant import random def createRandomPoints(count): # Create a new memory layer to store the points. vl = QgsVectorLayer("Point", "distance nodes", "memory") pr = vl.dataProvider() pr.addAttributes( ...

9

The answer depends on context: if you will be investigating only a small (bounded) number of segments, you might be able to afford a computationally expensive solution. However, it seems likely that you will want to incorporate this calculation within some kind of search for good label points. If so, it is of great advantage to have a solution that either ...

5

This sounds similar to "Linear Referencing" and that toolset would be available in ArcView. Additionally, you can script this tool very easily. Link to ESRI Help for Linear Referencing

5

it is much easier now in 10. Right click on the length field and select calculate geometry. you can select the pcs of the data or the document, then select the units.

4

Solving a linear reference problem like this without importing any modules is beyond my range.. I have used Shapely(python package for manipulation and analysis of 2D geospatial geometries. And it is BSD licenced :-) ) download it from here . The 2.6 version which is the only one that supports arcgis 10 arcpy..It is a simple installation(1.5 MB size) and ...

4

Based on your needs, as @LouisH referred to, using Linear Referencing is definitely the way to go. I cobbled together some code that should meet your need of not hard-coding elements, but instead requesting them as parameters. As explanation, the Linear referencing tool used below takes "Routes", in your case the line features, and places "Events", in your ...

3

You should use the IPolyCurve:SplitAtDistance Method. This Adds a new vertex point to the curve at a specified distance from the From point of the curve. For a split to happen, the split distance must be between the From and To points of the polycurve. Just remember to set the CreatePart to false. This way the polyline will not be split, but just ...

3

This is directly from the ESRI Help File: Accessing Data using Cursors This example shows a simple cursor operation. It prints out name and value of each string field for each row in a feature class. import arcpy fc = "D:/st_johns/roads.shp" # Create a search cursor # rows = arcpy.SearchCursor(fc) # Create a list of string fields fields = ...

3

The easiest approach I can think of is the ratio between the actual path length between start and end and the shortest distance (straight line) from the start to the end point. Straight lines will have ratios close to one while very curved lines will have a very high ratio. This should be a really easy to implement solution. Update: As Mike noticed ...

2

I don`t know if this helps, or even if it counts as an answer, but as I was sitting here thinking about the question I just posted, I had a thought: What if you place a circle of a particular radius on your contour line. That circle will intersect the contour line in at least two places. The straighter the line, the shorter the distance along the contour ...

2

In the computer graphics community, it is often necessary to find a bounding box around an object. Consequently, that is a well-studied problem, with fast algorithms. E.g., see Wikipedia's Minimum bounding box algorithms article. You could find the minimum-area rectangle surrounding your polyline, and then use the rectangle's aspect ratio, height/length. ...

2

Simplifying contours may cause undesirable results such as line crossing. I would recommend to generalize the input raster to 10 or 20 metre resolution (Aggregate Tool) then run the Contour tool again with the 1m interval parameter. You might need to change the contour interval to more then 1m depending on the scale of the map.

2

In ArcGIS you can use an edgematching process from the Spatial Adjustment toolbar: The edgematching process aligns features along the edge of one layer to features of an adjoining layer. It is mainly used when you want to merge separate adjacent layers, such as soils or contours sheets, and you need to ensure the features from those layers will ...

2

This seems to potentially answer your question: https://github.com/bbecquet/Leaflet.PolylineDecorator I can't' comment on the appropriateness of the method... seems like a lot of code for a simple problem.

2

There are existing tools to densify polylines. For example this link for ArcMap 10 however you indicate Arcobjects in your tag line, so this may not be appropriate for your situation.

2

do you mean inside the field calculator? in this case I suggest you to use python because starting from 10.0 it's the "official" language supported in ArcGIS 10.0 is the last ArcGIS version that uses VBscript, staring from 10.1 it will be deprecated and unsupported with Python in field calculator you have to use !Shape.length! or !Shape.area! (Python "!" ...

1

OK, after you updated your question: the edgematching process is not the right tool. You need a tool like the Integrate Tool (ArcGIS). But the Integrate Tool has one disadvantage: you can NOT fix a master layer (your red lines). In this question Polyline Global Snap Wizard is given as a solution (ET Geowizards) because the master layer will not change his ...

1

Managed to solve it by myself. As the line symbol I use is made of two overlapping lines, I simply had to open the "Rendering order" and change the darker, wider line to higher rendering layer. So: Wide/dark line symbol's rendering order to layer 0 and narrow/brighter line symbol's rendering order to layer 1 -> The lines look merged after rendering.

1

You could go back to the cad, create a surface and then make your own contours to match. If you have map 3d or civil 3d. or even if your original cad has elevation values or is in 3d, you can import to polylinez shapefile with that. Then use your choice of software, esri, autodesk, or opensource to re-create the contours.

1

You might be better off exporting each elevation to its own layer. Then you can introduce a snapping tolerance for the lines (like 10m) This will be dependent on the size and length of the gaps. You might think using *Creating lines that connect to other line*s it the correct approach: ...

1

You could buffer the polylines (minimally) and then run the sampling on the resulting polygons. It could work fine by itself if you don't have any other limiting factors, eg. on minimum interpoint spacing, density or somesuch. For more complicated cases, I would create a much denser random sample and then pick appropriate (whatever that may be) points in a ...

1

I found this question trying to do what I think is the same thing. I wanted it all done via arcpy. Using Linear Referencing wasn't making sense to me because I don't already have the point events (and I couldn't figure out how to use LR to get them). The crux of what I ended up using was line = arcpy.Polyline(arrayPts) pt = line.positionAlongLine ...

1

Might be an overkill, but if you have access to Network Analysis extension you could create network from your polylines and then create service areas around your input points, specifying SA size as the distance of interest. Here is a cursory example with 111 meters SA from the point: Then you would have to find points where SA crosses the line.

1

I've used this ArcObjects class to split line features before at specific distances. http://edndoc.esri.com/arcobjects/8.3/Samples/Editing/Edit%20Commands/Line%20Edit%20Toolbar/clsDivideLineFeatures.htm

1

you can use two Data Management method with arcpy: First of all is Split Line At Point (info): import arcpy from arcpy import env env.workspace="C:/data" arcpy.SplitLineAtPoint_management("streets.shp","events.shp","splitline_out.shp","20 Meters") Second is Split Line At Vertices (info): import arcpy from arcpy import env env.workspace = "C:/data" ...

1

I'm not certain I understand the entirety of your question. I do not think you need D3 for the task you describe. You could define your polyline directly in GeoJSON, and provide it as a GeoJSON file using an URL. Take a look at the .url and .geoJson methods at http://polymaps.org/docs/geoJson.html#po.geoJson - As for the styling, you should be able to ...

1

It sounds like the solution to your problem might require a different approach (based on @whuber's comment) but I have previously seen that a Shapefile's drawing order is based on the order the features are written to the file. If you have access to FME (or a trial of it) you can use the Sorter transformer to sort by any single or combination of attributes ...

1

Calculate Field with geometry in 10.x REQUIRES that you use Python. VBScript access to geometry is no longer supported. Python is the recommended scripting language for ArcGIS. Use Python if you want access to geoprocessing functionality, including feature geometry. Use VBScript if you have VBA or VBScript experience and are comfortable with ...

1

By searching "curvature" and "polyline", I got this info How can I find the curvature of a polyline?. There he suggested using go back to definition of curvature - K= DF/Ds. Here by F he means phi, or T in wikipedia's notation here (http://en.wikipedia.org/wiki/Curvature). Say you have a sequence three points, p0, p1 and p2. calculate distance s ...

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