Tag Info

Hot answers tagged

9

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: ...


8

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


7

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.


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). ...


7

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 ...


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

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

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 ...


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

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


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 ...


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

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 ...


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


3

The pe.dll available with the free download of ArcGIS Explorer can be used to do this. See Exploiting the ESRI Projection Engine (second edition) for discussion.


3

When choosing "Save selection as..." and the dialog Save vector layer as... shows up and I select GPX as format, I also have to check [x] Skip attribute creation then the GPX file is generated without any problems.


3

The GPX format does support only a defined list of attributes, so if your vector has any attribute that does not match what the specifications say, you'll get that error. When you export a vector to a gpx don't expect to have necessarily attributes with the coordinates, nevertheless they are present in the gpx file, example (obtained with QGIS): <?xml ...


3

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


3

use feature vertices to point in arcmap : Arctoolbox => data management tools => Features => Feature Vertices to point => select mid point type .


3

You can get the vertices by calling getVertices() function of LineString object. Assume you have a LineString obeject named as line, you can get vertices of the Line by using following code: var vertices = line.getVertices(); The function has an optional parameter nodes. If it's true, only endpoints will be returned, and false, only non-endpoints will be ...


3

If you just need to make sure a MULTILINESTRING is returned, use ST_Multi: ST_Multi — Returns the geometry as a MULTI* geometry. If the geometry is already a MULTI*, it is returned unchanged. http://postgis.net/docs/ST_Multi.html


3

You haven't stated what output you want so an array of geometry should do: CREATE OR REPLACE FUNCTION simplify_npoints(inGeom geometry, maxPoints integer) RETURNS geometry[] AS $$ DECLARE outGeom geometry[]=ARRAY[]::geometry[]; points geometry[]=ARRAY[]::geometry[]; counter integer:=0; BEGIN IF maxPoints=1 THEN RAISE ...


3

Am I misunderstanding? Isn't this just: SELECT ST_Asimuth(p.geom, ST_ClosestPoint(l.geom,p.geom)) AS azimuth FROM line l, point p If you have more than one item in the line and point tables, the question of what condition you join them on becomes important, but as you described it, it's just one item in each.


3

The ST_Polygonize aggregate in PostGIS will return a geometry_dump containing all possible polygons formed by a set of lines. I'm assuming the block IDs shown in your example are not related to the IDs of input linework. If this is the case, you can get your polygons and IDs with: SELECT (st_dump).path[1] as poly_id, (st_dump).geom FROM (SELECT ...


3

ST_GeometryType returns 'ST_Linestring', 'ST_Polygon','ST_MultiPolygon' etc. You can change check to use GeometryType which return mentioned values without ST_ prefix


3

Take a look at ST_FlipCoordinates (PostGIs 2.0 and up). That function was created to help people in your situation.


3

The ST_Envelope() function operates on single geometries, therefore you are right, you need aggregate your MULTILINESTRINGs before you pass them by St_Envelope(). St_Collect() is a good aggregation function for that job. SELECT ST_Envelope(st_Collects(foo.geom)) FROM line_table as foo WHERE foo.type='a'; If you want to retrieve the bounding box for each ...



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