4

I have worked with 2D geometry for CAD - My questions are general and relate to understanding operations on geometric entities (lines).

Should geometric operations such as line-line intersection be done in the projected spaces (such as EPSG 3857) ?

I've had a brief look at the geos library, but it is unclear whether the inputs should be in a linear projected space.

If operations are done in projected space - does this introduce significant error in the result when the output is un-projected?

  • 2
    Short answer is just that it depends. Any "straight line" between two vertices will traverse a different line on the Earth depending on the projection. This is not going to affect operations that are relevant only to the vertices, but any time two segments (lines or polygon edges) cross then the interpretation will be different in different coordinate systems. There's no universal right answer, it depends on how the data is set up and what the intention of the operation is. There are many poor choices of projection, so choosing the right one is just as important as using one. – mdsumner Oct 14 '14 at 7:23
6

Possible error of your geometric operation depends on:

  • overall size of the objects - bigger size increase errors,
  • projection that you use,
  • datum that you use (each datum suits some parts of the Earth more than the others)
  • quality of your data.

Generally you don't want to work with unprojected data at all unless there is some specific reasons like finding an orthodrome on a global scale (there is a Gnomonic projection for a regional scale) or you are working with global data in general (in this case you store data unprojected but project it for specific operations you need to perform: distance calculation, etc.). Note that there is no universal projection and for each task and the region of the world an appropriate projection (more precisely - CRS) have to be used for achieving the best results.

If your project demands to work with more than one projection you should pay a lot of attention to your data quality and integrity. Here a question: will a parallel and a meridian cross in any projection? The picture below is an unprojected image of the countries and a parallel and a meridian.

enter image description here

'Yes' would you say - they will cross in any projection. But I say - 'Nope if your data sucks ass'. Lets project our data into the Bonne projection:

enter image description here

Both parallel and meridian were defined only by 2 points each (start and end). That leaded to a disaster in specific projection. But if we know that we will use our lines in specific projection we can adapt our data to it. Lets add some nodes to our lines an project them again: much better result.

enter image description here

So when you are working with GIS, especially if you are going to modify your data - you have to understand the pros and cons of CRS. Don't be afraid to use projections - be afraid to use wrong one.

  • The illustrations are excellent and bring your point home well. But isn't this really an argument to project the data well rather than an argument against using projected coordinates for geometric analysis? (+1, btw) – whuber Oct 14 '14 at 15:35
  • @whuber, ty. Well definitely yes (did you really mean 'projected' and not 'uprojected' BTW?). – SS_Rebelious Oct 14 '14 at 16:29
  • Well, I guess I could have meant either :-). Adopting a basic research principle from historians, I would favor the coordinate system in which the data were created: it has to be considered the original and most accurate. If that's a projected system, use it or be careful about the reprojection process. If it's a geographic system, chances are you might have to project it for many kinds of vector analyses--and once more, as your post shows, take care to project the data well and appropriately. – whuber Oct 14 '14 at 16:42
  • @whuber, I mostly agree with you. But in case of unprojected data (don't really know why such CSR some times is called 'geographic') it depends on the task. For example I have a 20 km track from GPS, is there a reason why I should compute distances between points on the ellipsoid and not on the flat surface? Every task and conditions are unique and sometimes you are good to go with unprojected data and make all computations and operations on ellipsoid, but most of the time it will be more efficient to use a projection. – SS_Rebelious Oct 14 '14 at 17:02
  • We are not in disagreement. In your example everything will work fine. Yet if you had the same kind of GPS data but were plotting, say, the position of a satellite every hour, your answer might be different: ellipsoidal calculations have obvious merit in that circumstance. As @Ting L claims elsewhere in this thread, all non-metrical geometrical questions--incidence, containment, intersection, separation, and so on--will be solved correctly and efficiently in suitably projected coordinates provided the data are accurately and continuously projected into a connected, simply-connected region. – whuber Oct 14 '14 at 17:23
1

Map projections inevitably introduce distortions either in distance or in area, direction etc. For projections designed for a relatively small geographical area, such as a State Plane coordinate system, certain types of distortion are often negligible/tolerable.

An appropriate projection should be chosen carefully for each type of measurement, especially for large geographical features. For example, an equal area projection should be used for area measurement.

Specifically for the problem of determining the intersection point of two lines, geodesic lines (great circle flight path) should be used instead of straight lines in a projected coordinate system.

enter image description here

Geodesic lines reflect the shortest path between two points. And geodetic features (geodesic lines/circles) can be created, e.g. using ArcGIS, which are

spatially accurate and geodetically correct in any projection

1

Just to clear up: GEOS works only on the Cartesian plane.

The best practice to implement geometric operations on either a sphere or ellipsoid of revolution (spheroid) is to project to a Cartesian projection, perform operations in Cartesian space, then transform the results back to a geographic projection.

If the data are in a small region, use a UTM zone. If it is larger, try a LAEA projection. (This is what PostGIS currently does with the geography type.)

And if you really need to find the intersection point of two lines to the closest micrometre, use a dynamic gnomonic projection. See section 8 of Algorithms for geodesics (Karney 2013) for details on the procedure.

Great Circle arc intersections can also be found on a sphere, interactively with a web browser:

Great Circle arc intersections

  • This link geo.javawa.nl/coordcalc/index_en.html solves various problems (line intersections, etc.) using geodesics. The calculations are all done in Javascript and I believe that it calls my Javascript implementation of the geodesic routines in GeographicLib – cffk Oct 16 '14 at 21:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.