TMS FNC Maps: Small update with big improvements
Intro
With the release of TMS WEB Core v1.6 beta yesterday (https://tmssoftware.com/site/blog.asp?post=717), we bring a whole set of new and exciting compiler features such as generics, attributes and many more. Please read the blog and start exploring the new features. The beta of TMS WEB Core v1.6 is available as a download on the My Products page.
Today, we released all of our FNC products with some core improvements, ready to be used in combination with TMS WEB Core v1.6. On top of that, TMS FNC Maps has been released with 3 new features.
Tile Layers
TTMSFNCOpenLayers now supports adding tile layers in the XYZ format. To demonstrate this, we generated a free API key from the following service: https://www.thunderforest.com. This service offers a great set of high quality layers that can be used in combination with our TTMSFNCOpenLayers implementation. To add a layer we used the following code:
procedure TForm1.AddLayer; begin TMSFNCOpenLayers1.AddTileLayer('https://{a-c}.tile.thunderforest.com/cycle/{z}/{x}/{y}.png?apikey=[INSERT API KEY]'); end;
With the following result:
Save coordinate data to GPX
The update also brings a way to save your coordinate data to a GPX file. To implement this, use one of the following overloads
procedure SaveToGPXStream(ACoordinates: TTMSFNCMapsCoordinateRecArray; AStream: TStream); procedure SaveToGPXStream(ACoordinates: TTMSFNCMapsCoordinateRecArray; AStream: TStream; AMetaData: TTMSFNCMapsGPXMetaData); procedure SaveToGPXFile(ACoordinates: TTMSFNCMapsCoordinateRecArray; AFileName: string); procedure SaveToGPXFile(ACoordinates: TTMSFNCMapsCoordinateRecArray; AFileName: string; AMetaData: TTMSFNCMapsGPXMetaData); function SaveToGPXText(ACoordinates: TTMSFNCMapsCoordinateRecArray): string; function SaveToGPXText(ACoordinates: TTMSFNCMapsCoordinateRecArray; AMetaData: TTMSFNCMapsGPXMetaData): string;;
The TTMSFNCMapsGPXMetaData record currently allows specifying the following GPX attributes
- AuthorName
- AuthorLink
- TrackName
- TrackType
Plus Codes
Plus Codes are like street addresses for people or places that don’t have one. Instead of addresses with street names and numbers, Plus Codes are based on latitude and longitude, and displayed as numbers and letters. With a Plus Code, people can receive deliveries, access emergency and social services, or just help other people find them.
source: https://maps.google.com/pluscodes/
TMS FNC Maps supports Plus Codes encoding & decoding with the TTMSFNCMapsPlusCode class (available in the *.TMSFNCMapsCommonTypes unit). To get started, and convert an existing coordinate to a Plus Code, use the following code:
procedure TForm1.EncodeCoordinate; var p: string; begin p := TTMSFNCMapsPlusCode.Encode(CreateCoordinate(40.689188, -74.044562)); //p = '87G7MXQ4+M5' end;
To decode a Plus Code to a coordinate bounds, which defines the area corresponding to the code, the Decode function can be used:
procedure TForm1.DecodePlusCode; var c: TTMSFNCMapsBoundsRec; begin c := TTMSFNCMapsPlusCode.Decode('87G7MXQ4+M5'); end;
Update Now!
Update now to get all the latest and greatest FNC updates and get started exploring the new features of TMS WEB Core 1.6!