# Tag Info

12

You may not have to get too sophisticated--ArcGIS 10 has a tool to do just what you describe called Bearing Distance to Line (Data Management). You can even input a point shapefile as long as it has the attributes you need (i.e. X field, Y field, Distance Field, and Bearing). Of course you can add this tool to an arcpy script using: arcpy....

10

So, by example. Here's a simple table with two connected groups of edges: drop table lines; create table lines ( id integer primary key, geom geometry(linestring) ); insert into lines (id, geom) values ( 1, 'LINESTRING(0 0, 0 1)'); insert into lines (id, geom) values ( 2, 'LINESTRING(0 1, 1 1)'); insert into lines (id, geom) values ( 3, 'LINESTRING(1 1, 1 2)...

9

Plugin mmqgis for QGIS. http://michaelminn.com/linux/mmqgis/ (http://plugins.qgis.org/plugins/tags/mmqgis/)- Delete Duplicate Geometries

8

Assuming you're using QGIS >= 1.6.0, the menu option you need is Vector|Geometry Tools|Polygons to Lines, which will create a new shapefile with all the attributes of the original.

8

According to Romain D on it1me.com, it can be done with the Leaflet.PolylineOffset as referenced in the comments by MattPil29 above. I have adapted it for the data in your example. I turned off your original line by changing opacity to 0 in myStyle. There is probably a more elegant way to not add it. The other key is flipping the x,y coordinate to make L....

7

You could accomplish this a few different ways depending on what sort of output you are wanting, but the concept is the same. It's generally easier to do a simple rotation followed by a translation rather than trying to calculate the coordinates in a single step. In this case, the basic steps are: Create a line of the desired length at the origin (0,0). ...

6

For Java, I'd recommend JTS Topology Suite. There is both a "Nearest Point" and "Closest Point" routine (I'm not sure if it is the same, or was renamed between versions) that does what you want. The result from the above is LINESTRING (205 305, 250 300), so the first point of the result is your closest point coordinates, and the length property of the ...

6

If the LineString is simply to be subdivided at a position closest to the given Point, you could do what you want with this (splits LineString at closest Point to given Point and remerges the two segements afterwards) SELECT ST_AsText( ST_LineMerge( ST_Union( ST_Line_Substring(line, 0, ST_Line_Locate_Point(line, point)), ...

6

No, probably not. I'm going to assume from the coordinates of your point that you are working in longitude/latitude coordinates, but that you want to express your distances in meters. Rather than building a real "circle", recognize that for the purpose of a true/false test you can express the query as a distance calculation. SELECT routes.* FROM routes ...

6

Consider some test data similar top the thick line in the question's figure: SELECT 'LINESTRING (114 374, 200 380, 250 350, 259 343, 350 280, 380 180, 383 169, 360 80)'::geometry AS geom INTO TEMP data; the straight line (dashed) can be constructed from the start and end points: SELECT ST_AsText(ST_MakeLine(ST_StartPoint(geom), ST_EndPoint(geom))) FROM ...

5

You could use pgRouting driving_distance(). If your point A is a node in the network, it's easy. Otherwise you'll probably have to introduce a temporary node. An example using pgRouting 100 km around a node:

5

After you click the first time you can either use the context menu as Zachary suggested or what I find quicker is to use the shortcuts: Ctrl + L for Length Ctrl + A for angle (or direction), Ctrl + G for both at the same time and F2 to finish the sketch.

5

After you click to start the line, right click to open the edit tool's context menu. On this menu is a button named Length. Clicking this button opens a dialog that lets you set the length of the line segment. There is also a button for doing Direction/Length.

5

Yup, it looks like that is the behaviour from JTS and GEOS. The problem is that your LINESTRING is invalid. If you have PostGIS 2.0, you can use ST_MakeValid(geometry) to fix the LINESTRING to a POINT. This query verifies your bug, and uses ST_MakeValid as a workaround. WITH data AS (SELECT 'POLYGON((150 280, 99 215, 190 210, 150 280))'::geometry AS poly, ...

5

In PostGIS it's a two-stage process. First you need to find the overall length of your line geometry with ST_length() Say that produces a value of 150. Then you need to divide your desired length, 75, by the total length, giving you 0.5. Finally, with that value call ST_Line_Interpolate_Point() or ST_Line_Substring() to return the substring rather than a ...

5

The thing you need to do is a temporal analysis. As you said you have two vector data(shp) of different times. you can find the change using geometry processing. In QGIS load two vectors and GoTo Vector->GeoProcessing and from there you can use Difference function which will give another shape as a result. Hope that helps

5

Skip the trig, create view mypoints as select id, st_makepoint( st_x(st_endpoint(geom)) + (st_x(st_endpoint(geom))-st_x(st_startpoint(geom)))/2, st_y(st_endpoint(geom)) + (st_y(st_endpoint(geom))-st_y(st_startpoint(geom)))/2 ) as geom from mytable; then select geom from mypoints where id = 1; should work fine, for all values of id

5

There is few resolutions of this issue, maybe there are few better ones but this two should do also: 'By hand' (in steps) Cut every line with another line which intersects it Create table road_1 as Select row_number() over() as ID, input.name, (st_dump(st_split(input.geom, blade.geom))).geom as geom from roads input join roads blade ...

5

I think it is a little bit tricky, because of the different node sets of your both polygons (green polygon A, red different segments of polyon B). Comparing the segments of both polygons give a clue which segments of polygon B will be modified. Nodes polygon A Nodes of the "different" segments polygon B Unfortunally this show only the difference ...

5

Here are a few new tricks, using: EXCEPT to remove geometries from either table that are the same, so we can focus only on geometries that are unique to each table (A_only and B_only). ST_Snap to get exact noding for overlay operators. Use the ST_SymDifference overlay operator to find the symmetric difference between the two geometry sets to show the ...

5

There are several linear referencing functions that can be used to reference subsets of LineStrings, which can be converted to a geography and get the length of the geodesic with ST_Length. For example, get the distance along line that are near points pta and ptb: SELECT ST_Length(ST_LineSubstring( line, ST_LineLocatePoint(line, pta), ...

4

This is a simple way to find the center of lines in QGis: Vector > Analysis > Mean Coordinates This worked very nice and fast. Points are created in another shapefile, and the attribute table already comes with the coordinates along with the Unique ID field you selected earlier. I tried before to convert the lines into polygons, then extracting the ...

4

To get point in order and link to orginal geometry use SELECT (ST_DumpPoints(the_geom)).path as path, id, (ST_DumpPoints(the_geom)).geom FROM linestrings) and remove dublicates from http://wiki.postgresql.org/wiki/Deleting_duplicates remember that you need to have one unique id for dublicate removing, if you dont have one you need to create it

4

SELECT name,ref,type,ST_Distance(ST_Buffer(r.geom,20),ST_SetSRID(ST_MakePoint(lon, lat),4326)) FROM roads r ORDER BY 4 ASC LIMIT 1; For point in lon/lat coordinates: SELECT name,ST_Distance(r.geom,ST_SetSRID(ST_MakePoint(lon, lat),4326)) FROM roads r ORDER BY 2 ASC LIMIT 1;

4

Given your description, there are a few measures that you could use. If the data is time varying (i.e. those polylines are really tracks and you are comparing them to a reference route), you could use something like a simple root-sum-squares to get a good measure. A more "geo" approach, then Hausdorff distance is a good metric. Its supported in GEOS and JTS,...

4

After analysing your MultiLineString, I can say that st_linemerge cannot merge it, not because it's not properly ordered, but because it's impossible to be ordered and merged into a single LineString containing all its 12 parts. Therefore, st_linemerge works as expected, as stated in st_LineMerge, and, because merging cannot be done, it returns the original ...

4

There actually is no difference between the two functions, which both yield 1.195 km. The problem is that in your question the axis order is flipped for trajectory, so you are seeing different answers than you expect. SELECT ST_AsLatLonText(point_a) AS point_a_latlon, ST_AsLatLonText(point_b) AS point_b_latlon, ST_Distance_Spheroid(point_a, point_b, ...

4

You can do this with two "Rule-based Labelling" labels, with no filters. This lets you put multiple labels on a feature. The first rule labels the feature with the attribute you want at the start, the second rule with the end attribute. Initially your labels will appear in the centre of the line, so we need to fix that. Do that with "data defined" ...

4

You will need: 1) A table with LineString geometries: CREATE TABLE lin ( id serial PRIMARY KEY, geom geometry(LineString, 31370) ); CREATE INDEX ON lin (id); CREATE INDEX ON lin USING gist (geom); 2) A table with Point geometries where you want to split your overlapping lines. They can represent train/metro stations, intersections, bifurcations etc. ...

3

I've not tried it, but GDAL's gdal_rasterize should do the trick with its -3d option: gdal_rasterize -3d -tr 10.0 10.0 -l streams streams.shp streams.tif

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