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


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


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

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

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

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

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


5

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


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


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

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

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

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

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


2

http://docs.codehaus.org/display/GEOTDOC/Closest+Point+on+a+Line seems to discuss the solution to your problem. --- update by author of that page -- This page has been ported to sphinx based documentation: http://docs.geotools.org/latest/userguide/library/jts/snap.html That page just goes through how the JTS classes for snapping to a line can be used.


2

Try the following: IMapBookmarks pMapBookmarks; ISpatialBookmark pSpatialBookmark; IEnumSpatialBookmark pBookmarkEnum; IAOIBookmark pAOIBookmark; pMapBookmarks = (IMapBookmarks)pMap; pBookmarkEnum = pMapBookmarks.Bookmarks; pBookmarkEnum.Reset(); pSpatialBookmark = pBookmarkEnum.Next(); pAOIBookmark = (IAOIBookmark)pSpatialBookmark; IEnvelope pEnv = new ...


2

It looks like you need a third table with the same schema than the T1 table and a function to do that. Assuming that the t1's srid is 95702 and t2's srid is 95993: CREATE OR REPLACE FUNCTION my_merge_function() RETURNS integer AS $BODY$ DECLARE rec record; BEGIN DELETE FROM T3; FOR rec IN SELECT T1.sld_name as sld_name, .... , ...


2

PostGIS has a "cleangeometry()" function which I believe works like SpatiaLite's "SanitizeGeometry()". My mantra is that there is never a single solution in GIS, so here's two other off-beat approachs: If you have multiple lines you could pack them all in a multilinestring and use the ST_LineMerge function. It will kill the duplicates and join the ...


2

If you know beforehand what your polygon is, you could do: SELECT * from linetable WHERE ST_Intersects(linetable.the_geom,(SELECT the_geom from polytable where id='123')); or SELECT * FROM linetable WHERE ST_Intersects(linetable.the_geom, ST_GeomFromText('POLYGON((0 0,0 1,1 1,0 1,0 0))'); There are many ways to fetch the polygon you want, but the path ...


2

You should not bother about using &&. That functionality is built in for example ST_Contains. You should also avoid using buffer in this way. What is it really that you want to get. Now you are selecting the linestrings where s1 is totally contained in the buffered line from r1. But from you write, what you want is all lines in s1 that is ...


2

Have a look at the Delete Duplicates tool that you can find in the Tool Manager. It will let you delete duplicates in a table based on attribute values, such as an ID. Might be a good idea to create a backup of your table before using the tool. This is in MapInfo Professional :-) Peter


2

if you have qgis; use SPIT - Shapefile to PostGIS Import Tool to adding your shapefile as postgis table run this query: . SELECT id, ST_AsText(ST_Centroid(the_geom)) as Cetroids FROM myPolyLines; or SELECT id,CENTER(the_geom) as Cetroids FROM myPolyLines; ST_Centroid — Returns the geometric center of a geometry. Computes the geometric center ...


2

How about select st_union(t1.wkb_geometry) as wkb_geometry into some_table from ( select wkb_geometry from r_lines union select wkb_geometry from a_lines ) t1 then viewing the result of some_table The query above unions all your lines in r_lines and all your lines in a_lines into one result, then merges all of that together in one line and writes ...


2

As far as the first question is concerned, there is a PostGIS function just for that, ST_DumpPoints. The first example in the docs page is exactly what you need. It's a set-returning function, so it doesn't just dump the points, but also some info (the path array) that relates them to the original geometry. Since you only care about the points, you could ...


2

I believe you are designating a style on each loop pass which then does not use the default render intent on the stylemap. Before you do a lineFeature.style = ..., Try extending the default style in your stylemap and apply it to the feature instead of telling the feature to use a style which does not have any label info on it. Update remove the ...


2

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;



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