# Are long lines in shapefiles to be considered geodesics or straight lines in the 2D latlong space?

Is there a definition on how lines connect vertices in the shapefile format?

In the simplest case, imagine a line with only 2 points, from 40,-118 to 40,-112 - that's somewhere random in the US - with standard WGS84 geographic coordinate system. Here is the content of the .prj file:

``````GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]
``````

Is the point say 40.1,-116 north or south of the line?

1. If we consider lines are linearly interpolated in the latlong space, it follows the 40 deg parallel (small circle) and the point is north of the line.
2. If we consider lines are shortest paths on the Earth surface, it's a geodesic (great circle) with a maximum latitude at the middle of the line, higher than 40.1 deg. Then the point is south of the line.
3. Or is it simply undefined? Since shapefile format has no notion of curves, but only straight segments connecting lines. Line needs to be densified (points added along the line) to clarify this answer.

If I create such scenario in QGIS, the line follows the 40 deg parallel, and would tell me answer is 1. But I wouldn't take this as a definite answer and would like to hear a more solid one.

-
This is a wonderful question. It seems to me that any such definition lies in the eye of the analyst: ultimately, the meaning of the segments depends on who created the shapefile and how it has been processed. This looks like a job for ... metadata. – whuber May 17 '12 at 16:45
technically speaking, the edges of a polygon are commonly called "rings" (or LinearRing), which are closed lines – Mike T Aug 6 '12 at 19:31

## 4 Answers

It seems to be a straight line in whatever projection system pertains when it is created. After that, it is recalculated in each new projection, and the software trys to make it 'stratght'. this is quite noticeable near the poles: a square drawn round the pole in a polar azimuthal projection will invariably turn into a circle (that is, the formerly stratight sides become curves concave towards the pole) when re-projected to another polar azimuthal, or even if the central meridian is changed. the software just does not know how to get from one vertex to the next, so it takes what must seem to it a logical path....

This is why one densifies the vertcies in such situations. That anchors the polygon edges to known coordinants, even though there will still be the same interpolation going on between each vertex.

-

There is no information on this in the shapefile specification. How to connect two vertices is strictly up to the software displaying or otherwise processing the shapefile. You could add information into an attribute field which could then be used by the software, but it would affect the entire feature.

Esri has been working a bit on this, so there are functions in ArcGIS 10. Here's one of the help topics about it: Creating geodetic features

Note: My views may not be that of my employer (Esri).

-

I'm not sure about KML, but in a shapefile the lines joining vertices are indeed straight line segments. From the ArcGIS help file under About editing shapefiles:

Creating features with curves in shapefiles

Shapefiles do not support true parametric curves, including circular arcs, ellipses, and Bézier curves, so these shapes are stored as straight segments....

When creating curves in a shapefile using the editing tools, the shapes initially may appear curved on-screen. When you save your edits, however, the curves are densified and the shapes are converted into a series of straight segments that approximate the shape of the original curve

If it's an option, a geodatabase featureclass can store true curves:

With a geodatabase feature class, the shapes are stored as true curves with only vertices at the endpoints of the curve.

-

In my opinion it depends on the projection. From what I know, Lat Long WGS84 projection are considered as Plate Caree (Equirectangular - enter link description here), in the majority of GIS software, so the parallels and meridians are considered strait and perpendicular lines. If you want to measure in this projection a strait lines, then you must apply the technique of great-circle lines. But this apply only if you need to compute real distances. So +40.1 lat is definitely nord from +40 in Plate Carre Lat Long projection.

Hope it helps and may be other have different opinions.

-