## Top 5 Recent Articles

##### ARTICLES CATEGORIES

- Algorithms (22)
- All (399)
- Biography (1)
- Blog (44)
- Business Requirements (1)
- Commentary (1)
- Conversion (2)
- Customers (2)
- Data Models (1)
- Education (2)
- GeoRaptor (13)
- GPS (1)
- Image Processing (2)
- Import Export (8)
- Licensing (2)
- LiDAR (1)
- Linear Referencing (4)
- Manifold GIS (3)
- Mapping (1)
- MySQL Spatial (7)
- Networking and Routing (including Optimization) (5)
- Open Source (18)
- Oracle Spatial and Locator (194)
- Partitioning (1)
- PostGIS (36)
- Projections (1)
- Published Articles (1)
- qGIS (1)
- Recommendations (1)
- Services (1)
- Software Change Log (1)
- Source Code (37)
- Space Curves (9)
- Spatial Database Functions (109)
- Spatial DB comparison (1)
- Spatial XML Processing (11)
- SQL Server Spatial (92)
- Standards (3)
- Stored Procedure (17)
- Tessellation or Gridding (10)
- Tools (2)
- Topological Relationships (1)
- Training (2)
- Triangulation (2)

# Calculating Distance in the Lambert Conformal Conic projection vs WGS84/GDA94

## Lambert Conformal Conic 2 Standard Parallels

This projection is commonly used around the world. An example is the NSW Lambert projection.

The definition of the projection is described here.

Note that “[the] two standard parallels […] maintain exact scale, while the scale varies along the meridians” being reduced between the parallels and increased beyond them.

### Use Case

I worked on a national (Australia) scale database which stored its data in a LCC projection. What was not understood by those who chose the projection was the distance/scale issue.

When accurate distances were required the application had to project the data into a geographic SRID (4283), compute the distance/length, and then throw away the projected data (a run-time penalty).

If the database had been defined to use a geographic SRID in the first place this additional processing could have been avoided.

## Examples

The question of scale difference can be easily demonstrated using PostGIS.

### Lines along parallels

Firstly we calculate distance along parallels including the two standard parallels for the NSW Lambert projection.

-- NSW Lambert -- -30.75 is standard_parallel_1 (latitude) -- -35.75 is standard_parallel_2 (latitude) -- Length along parallel should be same. select round(latitude,2) as latitude, round(ST_Length(line,true)::numeric,3) as llLength, round(ST_Length(ST_Transform(line,3308))::numeric,3) as lamLength, round(ABS(ST_Length(line,true)::numeric - ST_Length(ST_Transform(line,3308))::numeric),3) as diff from (select gs::decimal/100.0 as latitude, ST_GeomFromEWKT('SRID=4283;LINESTRING(139.0 '||gs::decimal/100.0||',141.0 '||gs::decimal/100.0||')') as line from generate_series(-4075,-2575,100) as gs ) as f;

latitude | lllength | lamlength | diff |
---|---|---|---|

-40.75 | 168900.910 | 170231.909 | 1330.999 |

-39.75 | 171405.356 | 172372.050 | 966.694 |

-38.75 | 173857.373 | 174507.424 | 650.051 |

-37.75 | 176256.234 | 176638.748 | 382.514 |

-36.75 | 178601.231 | 178766.725 | 165.494 |

-35.75 | 180891.670 | 180892.043 | 0.372 |

-34.75 | 183126.877 | 183015.379 | 111.498 |

-33.75 | 185306.192 | 185137.399 | 168.794 |

-32.75 | 187428.976 | 187258.759 | 170.217 |

-31.75 | 189494.604 | 189380.109 | 114.496 |

-30.75 | 191502.471 | 191502.088 | 0.383 |

-29.75 | 193451.989 | 193625.335 | 173.347 |

-28.75 | 195342.586 | 195750.480 | 407.894 |

-27.75 | 197173.711 | 197878.152 | 704.441 |

-26.75 | 198944.828 | 200008.977 | 1064.148 |

-25.75 | 200655.423 | 202143.579 | 1488.156 |

Note here that lines along the two standard parallels are, effectively, equal (as predicted) with parallels between and beyond the parallels being unequal.

### Lines of random direction

-- Random linestrings -- Projected Bounds: 8709235.6860, 4009911.3943, 9951732.0554, 5048642.3129 with data as ( select 8709235.6860 as llx, 4009911.3943 as lly, 9951732.0554 as urx, 5048642.3129 as ury ) select round(g.lamLength::numeric,3) as LamLength, round(g.llLength::numeric,3) as LLLength, round(ABS(g.lamLength-g.llLength)::numeric,3) as diff, ST_Transform(g.line,4283)::geography as line from (select ST_Length(f.line) as lamLength, ST_Length(ST_Transform(f.line,4283)::geography,true) as llLength, line from (select gs as id, ST_SetSrid( ST_MakeLine(ST_MakePoint(spdba.random_between(llx,urx), spdba.random_between(lly,ury)), ST_MakePoint(spdba.random_between(llx,urx), spdba.random_between(lly,ury)) ),3308) as line from data, generate_series(1,10,1) as gs ) as f ) as g;

lamlength | lllength | diff | line |
---|---|---|---|

754406.739 | 754650.329 | 243.590 | 0102000020BB10000002000000CA37AE7EDB4B62404759EA5666303DC0CC214EA682EF614037E5A12907C541C0 |

452723.767 | 452998.890 | 275.123 | 0102000020BB1000000200000047C72184CCC86240B5A1741546493EC0388E8E2750C46240E5AD811D4C2F41C0 |

813066.112 | 813314.156 | 248.044 | 0102000020BB1000000200000089C49BCE7D066240B35FA31A9B6B3DC0BB00C06E6E5162403049B20AEE3D42C0 |

198902.064 | 199084.156 | 182.092 | 0102000020BB10000002000000E980B75EE44E6240B53CF4FC267340C0ADE39F8EE81E6240C3693545561741C0 |

422357.726 | 422315.200 | 42.527 | 0102000020BB10000002000000900A38FC5380624039CCE9995DB641C0B8394B5F20126340E3E91A74CE2342C0 |

378277.782 | 378208.826 | 68.957 | 0102000020BB10000002000000CCA7874B82C06140035D1C839D2B40C07A67832B9DA16140BCFC5C6768083DC0 |

190953.478 | 190745.757 | 207.722 | 0102000020BB10000002000000111E0546815A6240F3259CDF7C733EC058949CAA3A4F624034FD083911C23CC0 |

689064.040 | 689173.297 | 109.258 | 0102000020BB1000000200000060B093BC73FB61402A5BCBCD8B4B41C02EAA11C5E24E6240E09742A5A0C93CC0 |

564407.729 | 564731.142 | 323.413 | 0102000020BB10000002000000C72C74F2D7BE61401BB989373D7B3FC06C0A5FD2ED7C6240DD81E1E110D93FC0 |

380615.258 | 380768.053 | 152.795 | 0102000020BB100000020000004F2D3DEA7FC262401273D7CF3EBF40C0EF1690860E096340599213471F3442C0 |

Note that the difference in distance between random linestrings is pronounced. Whether this issue affects your use of a Lambert Conformal Conic projection in your application depends on your needs. If, for example, accurate distance is important Lambert Conformation Conic may not be suitable.

If I have misrepresented the distance/scale issue for Lambert Conformal Conic projections please contact me.

## Documentation

- MySQL Spatial General Functions
- Oracle LRS Objects
- Oracle Spatial Exporter (Java + pl/SQL)
- Oracle Spatial Object Functions
- Oracle Spatial Object Functions (Multi Page)
- PostGIS pl/pgSQL Functions
- SC4O Oracle Java Topology Suite (Java + pl/SQL)
- SQL Server Spatial General TSQL Functions
- SQL Server Spatial LRS TSQL Functions