gpx 패키지는 Flutter 개발자가 GPX 형식의 GPS 데이터를 로드하고 조작하며 저장할 수 있도록 해줍니다. GPX는 웨이포인트, 루트 및 트랙을 교환하기 위한 가벼운 XML 기반 표준입니다. 이 패키지는 모든 주요 플랫폼에서 GPX 파일을 읽고 쓸 수 있도록 지원하여 GPS 데이터 상호 운용성이 필요한 지오로케이션 애플리케이션에 이상적입니다. 최소한의 오버헤드로 GPX 콘텐츠를 파싱하고 생성하는 깔끔한 Dart API를 제공합니다.
사용 사례
파일에서 GPS 트랙 읽기
GPX로 경로 데이터 내보내기
지도 및 내비게이션 앱과의 통합
장치 간에 GPS 데이터 동기화
야외 활동 로그 처리
주요 기능
웨이포인트, 경로 및 트랙을 지원합니다
크로스 플랫폼 호환성
간단한 XML 파싱 및 생성
경량이고 효율적
GPX 1.1 사양 완전 준수
적합한 대상
피트니스 및 야외 앱
GPS 데이터 분석 도구
지도 기반 애플리케이션
GPS 장치 간의 데이터 교환
지오스페이셜 데이터를 다루는 개발자
고려 사항
파일 I/O를 수동으로 처리해야 합니다
GPX 형식만 지원
내장된 지도 렌더링 없음
대규모 데이터 세트에 최적화되지 않음
외부 XML 파싱 로직에 의존
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
gpx
A Dart library for loading, manipulating, and saving GPS data in GPX format
(https://www.topografix.com/gpx.asp), a light-weight XML data format for the
interchange of GPS data, including waypoints, routes, and tracks.
View the official GPX 1.1 Schema at https://www.topografix.com/GPX/1/1/gpx.xsd.
It also supports exporting Gpx data into:
KML (a file format used to display geographic data in an Earth browser such as Google Earth, https://developers.google.com/kml/)
CSV (not implemented yet)
Getting Started
In your dart/flutter project add the dependency:
dependencies:...gpx:^2.5.0
Reading XML
To read XML input use the GpxReader object and function Gpx fromString(String input):
Some GPX applications expect the standard GPX 1.1 namespace and schema declarations on the root <gpx> element. Use
GpxCompatibilityMode.gpx11 when writing files for applications such as EasyGPS, JPX, Garmin BaseCamp, and other strict
GPX parsers:
final xml = GpxWriter().asString(
gpx,
pretty: true,
compatibility: GpxCompatibilityMode.gpx11,
);
This writes a root element with the standard GPX 1.1 declarations:
For Garmin BaseCamp files that also need the Garmin GpxExtensions/v3
namespace, combine the GPX 1.1 compatibility mode with GpxNamespaces.garmin:
final xml = GpxWriter().asString(
gpx,
pretty: true,
compatibility: GpxCompatibilityMode.gpx11,
namespaces: GpxNamespaces.garmin,
);
Custom namespaces and attributes are applied after the compatibility mode,
so they can extend or override the default GPX 1.1 declarations when needed.
Garmin GpxExtensions v3
The package includes typed models for the Garmin GpxExtensions/v3, TrackPointExtension/v1, and
WaypointExtension/v1 schemas: