Subscribe to this thread
Home - General / All posts - convert points to lines
artlembo


3,400 post(s)
online
#21-Nov-17 03:54

Hi everyone,

If you saw the video I posted, you know that I'm working my way through some of the ArcGIS GeoAnalytics Server tools. This has been fun. The next step (and upcoming video) is to convert the hurricane points into individual lines. The following query does just that:

SELECT name, GeomConvertToLine(GeomConvertToPoint(GeomMergePoints([Geom (I)]),False)) AS g

INTO mergedlines

FROM

 (

  SELECT * FROM [huricanepts]

  ORDER BY name, [YEAR_],[MON],[DAY_],[TIME_]

 )

GROUP BY [STORM_NUM],NAME;

However, I really don't like the sequence: GeomMergePoints / GeomConvertToPoint / GeomConvertToLine

Of course it isn't horrible, but it feels somewhat wasteful. I already have point data, and I understand the need to merge them into a multi-part object, but the ConvertToPoint is an odd one to me. I'm not sure why it is necessary. It would be nice to just issue the ConvertToLine on the grouped points.

Thoughts?

danb

2,064 post(s)
#21-Nov-17 06:20

It doesn't seem very intuitive to me also. I can see myself struggling to derive this query because of it (though at least I now have an example (even if it does seem odd)).


Landsystems Ltd ... Know your land | www.landsystems.co.nz

adamw


10,447 post(s)
#24-Nov-17 08:51

Let's walk the sequence of calls in the reverse order:

GeomConvertToLine converts a geom (in this case, a multi-point) into a line. Do we want the conversion to keep branches? Yes, we do, if the original geom contains three branches, the resulting line should contain three branches as well, these branches should not be joined, it's just natural. GeomConvertToLine running on a geom that is already a line should just return the same line, right? Then it should not join branches, it should keep them.

Suppose we didn't have GeomConvertToPoint and had just GeomMergePoints. GeomMergePoints takes a set of points / multi-points, including those with branches, and joins them into a single geom. Do we want it to keep branches? Again, yes, we do, it's natural. If a particular object had three branches with 10 coordinates each, perhaps they have been split that way for a reason, that's useful info, why throw it away. GeomMergeLines / Areas don't throw that kind of info away, why should GeomMergePoints, etc.

That's why we need GeomConvertToPoint - it takes a multi-point with tons of branches returned by GeomMergePoints and joins all coordinates keeping the order into a single branch - which can then be turned into a single line branch in GeomConvertToLine. GeomConvertToPoint is there for its False parameter.

tjhb
10,094 post(s)
#24-Nov-17 09:21

Also discussed here.

More intuitive after Adam’s explanation.

Manifold User Community Use Agreement Copyright (C) 2007-2021 Manifold Software Limited. All rights reserved.