span8

span4

span8

span4

- Area Measurements with the AreaCalculator
- Buffering features for Spatial Relationship Analysis
- Calculating Stream Network Numbers with the StreamOrderCalculator
- Circularity Calculations with the CircularityCalculator
- Coordinate Systems and Measurements with the Reprojector
- Creating Time and Distance Isolines using the NetworkCostCalculator
- Determining Nearest Neighbors
- Determining Spatial Relationships
- Distance Measurements with the LengthCalculator
- Extracting Polygon Intersections with the AreaOnAreaOverlayer
- Generating Polygon Differences with the Clipper Transformer
- Merging Polygons with the Dissolver Transformer
- Point in Polygon Calculations with the PointOnAreaOverlayer
- Raster Slope Calculations
- Shortest Route Calculations with the ShortestPathFinder
- Volume Measurements with the VolumeCalculator

Article created with
FME Desktop 2018.1

Measuring distances is very simple in FME. However, much data is stored with Latitude and Longitude coordinates, and that complicates measure distances. Distances are rarely required to be measured as decimal degrees, but instead units such as feet or meters.

For this purpose, there are two transformers that provide a solution: the ReprojectLengthCalculator and the GeographicLengthCalculator.

The ReprojectLengthCalculator transformer accepts line lengths in one coordinate system and calculates what that length would be in a second coordinate system:

The transformer does not measure the geometry of the incoming features, but instead calculates the result based on incoming values/attributes. Also, it is accurate only to within 0.2% or so, depending on the coordinate system selected and the length of the line. This may be fine for smaller lines, but for large lengths, this can add up to a significant inaccuracy. For an example about using the ReprojectLengthCalculator, please see the article Distance Measurements with the LengthCalculator.

The GeographicLengthCalculator calculates the length of linear features (or the perimeter of polygon features) and returns the result as an attribute, using one of a selection of units:

The transformer *does* measure the geometry of the incoming features. The units returned - regardless of the incoming coordinate system - can be Feet, Kilometers, Meters, or Miles.

The GeographicLengthCalculator transformer is not installed as part of FME. Instead, it must be downloaded from the FME Hub.

Follow these steps as an example of how to take features in lat/long, and calculate their length in metres...

1. Start FME Workbench and generate a workspace to translate the attached source data from Google KML to OGC GeoPackage format. Choose a file name for the output, and - when prompted - select only the Neighborhood reader feature type:

2. Using Quick Add, add a GeographicLengthCalculator transformer between the reader and writer feature types:

If the transformer has not already been downloaded from the FME Hub, it will be downloaded and installed automatically.

3. Open the parameters dialog for the GeographicLengthCalculator transformer. Ensure the Distance Unit is set to Meters, and that the Length Attribute parameter is set to write an attribute called NeighborhoodPerimeter:

4. Open the parameters dialog for the writer feature type. Click the User Attributes tab and change the Attribute Definition type to Automatic:

This will ensure all attributes that are read or created will be written in the output.

5. Save and run the workspace. Notice that, even though the source and destination datasets use Latitude and Longitude coordinates, the NeighborhoodPerimeter attribute is measured in metres:

The data used here originates from open data made available by the City of Vancouver, British Columbia (data.vancouver.ca). It contains information licensed under the Open Government License - Vancouver.

thub.nodes.view.add-new-comment

geographiclength1.png
(23.4 kB)

geographiclength2.png
(9.8 kB)

geographiclength3.png
(21.2 kB)

geographiclength4.png
(19.3 kB)

geographiclength5.png
(20.3 kB)

geographiclength6.png
(17.6 kB)

geographiclength7.png
(17.9 kB)

geographiclengths.fmwt
(125.4 kB)

vancouverneighborhoods.zip
(104.6 kB)

I don't know why people use a truncated series, when the exact formula isn't that complicated. (I don't have

a reference for these--I derived them myself).

meters per degree latitude:

= pi/180 * a^2 * b^2 / (a^2 * cos(rlat)^2 + b^2 * sin(rlat)^2)^(3/2)

meters per degree longitude:

= pi/180 * a^2 * cos(rlat) / (a^2 * cos(rlat)^2 + b^2 * sin(rlat)^2)^(1/2)

we can get rid of the sines by substituting sin(x)^2 -> (1-cos(x)^2):

meters per degree latitude:

= pi/180 * (a^2/b) / (1 + (a^2-b^2)/b^2 cos(rlat)^2)^(3/2)

meters per degree longitude:

= pi/180 * (a^2/b) * cos(rlat) / (1 + (a^2-b^2)/b^2 cos(rlat)^2)^(1/2)

instead, we could make the substitution (cos(x)^2-sin(x)^2) -> cos(2x):

meters per degree latitude:

= pi/180 * (a^2*b^2/((a^2+b^2)/2)^(3/2)) / (1 + ((a^2-b^2)/(a^2+b^2))*cos(2*rlat))^(3/2)

meters per degree longitude:

= pi/180 * (a^2/((a^2+b^2)/2)^(1/2)) * cos(rlat) / (1 + ((a^2-b^2)/(a^2+b^2))*cos(2*rlat))^(1/2)

Of course, when you substitute in the parameters for the WGS84 ellipsoid (a->6378137, b->6356752.3142)

the formulas simplify quite a bit.

a reference for these--I derived them myself).

meters per degree latitude:

= pi/180 * a^2 * b^2 / (a^2 * cos(rlat)^2 + b^2 * sin(rlat)^2)^(3/2)

meters per degree longitude:

= pi/180 * a^2 * cos(rlat) / (a^2 * cos(rlat)^2 + b^2 * sin(rlat)^2)^(1/2)

we can get rid of the sines by substituting sin(x)^2 -> (1-cos(x)^2):

meters per degree latitude:

= pi/180 * (a^2/b) / (1 + (a^2-b^2)/b^2 cos(rlat)^2)^(3/2)

meters per degree longitude:

= pi/180 * (a^2/b) * cos(rlat) / (1 + (a^2-b^2)/b^2 cos(rlat)^2)^(1/2)

instead, we could make the substitution (cos(x)^2-sin(x)^2) -> cos(2x):

meters per degree latitude:

= pi/180 * (a^2*b^2/((a^2+b^2)/2)^(3/2)) / (1 + ((a^2-b^2)/(a^2+b^2))*cos(2*rlat))^(3/2)

meters per degree longitude:

= pi/180 * (a^2/((a^2+b^2)/2)^(1/2)) * cos(rlat) / (1 + ((a^2-b^2)/(a^2+b^2))*cos(2*rlat))^(1/2)

Of course, when you substitute in the parameters for the WGS84 ellipsoid (a->6378137, b->6356752.3142)

the formulas simplify quite a bit.

Well, I guess the truncated cosine series in nice and integrable, whereas the exact solution turns into

elliptic integrals. Anyway, the above formulas for the WGS84 ellipsoid turn into:

meters per degree latitude:

= 111693.97955992134774 / (1 + 0.0067394967565868823004*cos(rlat)^2)^(3/2)

meters per degree longitude:

= 111693.97955992134774 * cos(rlat)/(1 + 0.0067394967565868823004*cos(rlat)^2)^(1/2)

or, for the one with cos(2*rlat) instead of cos(rlat)^2:

meters per degree latitude:

= 111131.77741377673104 / (1 + 0.0033584313098335197297*cos(2*rlat))^(3/2)

meters per degree longitude:

= 111506.26354049367285 * cos(rlat) / (1 + 0.0033584313098335197297*cos(2*rlat))^(1/2)

elliptic integrals. Anyway, the above formulas for the WGS84 ellipsoid turn into:

meters per degree latitude:

= 111693.97955992134774 / (1 + 0.0067394967565868823004*cos(rlat)^2)^(3/2)

meters per degree longitude:

= 111693.97955992134774 * cos(rlat)/(1 + 0.0067394967565868823004*cos(rlat)^2)^(1/2)

or, for the one with cos(2*rlat) instead of cos(rlat)^2:

meters per degree latitude:

= 111131.77741377673104 / (1 + 0.0033584313098335197297*cos(2*rlat))^(3/2)

meters per degree longitude:

= 111506.26354049367285 * cos(rlat) / (1 + 0.0033584313098335197297*cos(2*rlat))^(1/2)

Tutorial: Common GIS Operations

- Area Measurements with the AreaCalculator
- Distance Measurements with the LengthCalculator
- Distance Measurements with the GeographicLengthCalculator
- Volume Measurements with the VolumeCalculator
- Raster Slope Calculations
- Circularity Calculations with the CircularityCalculator
- Coordinate Systems and Measurements with the Reprojector
- Determining Spatial Relationships
- Point in Polygon Calculations with the PointOnAreaOverlayer
- Extracting Polygon Intersections with the AreaOnAreaOverlayer
- Merging Polygons with the Dissolver Transformer
- Generating Polygon Differences with the Clipper Transformer
- Determining Nearest Neighbors
- Buffering features for Spatial Relationship Analysis
- Shortest Route Calculations with the ShortestPathFinder
- Creating Time and Distance Isolines using the NetworkCostCalculator
- Calculating Stream Network Numbers with the StreamOrderCalculator

Point in Polygon Calculations with the PointOnAreaOverlayer

Coordinate Systems and Measurements with the Reprojector

Distance Measurements with the LengthCalculator

Buffering features for Spatial Relationship Analysis

Shortest Route Calculations with the ShortestPathFinder

Determining Spatial Relationships

Volume Measurements with the VolumeCalculator

© 2019 Safe Software Inc | Legal

- Anonymous
- Sign in
- Create
- New Question
- New Article
- New Idea
- Spaces
- 3D (and BIM)
- Attribute Handling
- Automations (FME Server)
- CAD
- Cloud
- Coordinate Systems
- Custom Transformers
- Database
- Dynamic Workspaces
- FME Cloud API
- FME Cloud Administration
- FME Cloud Getting Started
- FME Desktop 3rd Party Integrations
- FME Desktop Administration
- FME Desktop Administration & Configuration
- FME Desktop Development
- FME Desktop Getting Started
- FME Desktop Installation
- FME Desktop Licensing
- FME Desktop Plug-In SDK
- FME Desktop Workbench Scripting
- FME Server 3rd Party Integrations
- FME Server Administration
- FME Server Administration & Configuration
- FME Server Development
- FME Server Getting Started
- FME Server Installation
- FME Server Licensing
- Fanouts
- Ideas FME Cloud
- Ideas FME Desktop: Data Inspector
- Ideas FME Desktop: Formats & Systems
- Ideas FME Desktop: Transformers
- Ideas FME Desktop: Workbench
- Ideas FME Server
- Indoor Mapping
- KML
- Lists
- Performance Tuning
- Point Cloud
- Published Parameters
- Raster
- Real-Time
- Running Multiple Workspaces
- Tabular
- Troubleshooting Techniques
- Vector / GIS
- Web
- Workflow Design
- XML / GML
- Zip Files
- *FME Desktop
- *FME Server
- *FME Cloud
- *Other
- Explore
- Topics
- Questions
- Articles
- Ideas
- Users
- Badges