Search packages, repositories and app categories

Package detailsv2.0.0

wkt_parser

Wkt-parser is a Dart version of proj4js/wkt-parser. With wkt-parser you can parse a WKT projection string (OGC, ESRI) into json that proj4dart can consume.

AndroidiOSWebmacOSWindowsLinux
30-day downloads
1.2M
Likes
4
Pub points
135

Install package

flutter pub add wkt_parser

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

Wkt-parser is a Dart package that converts Well-Known Text (WKT) projection strings—used in OGC and ESRI standards—into JSON format compatible with proj4dart. It enables seamless integration of geographic coordinate system definitions into Flutter applications, supporting cross-platform geolocation workflows on Android, iOS, Web, macOS, Windows, and Linux. The parser simplifies the handling of spatial reference systems by transforming complex WKT syntax into structured data for further processing.

Use cases

  • Parsing OGC WKT strings
  • Converting ESRI WKT to JSON
  • Integrating with proj4dart
  • Geospatial data transformation
  • Cross-platform map projections
  • Coordinate system configuration

Key features

  • Supports OGC and ESRI WKT formats
  • Outputs JSON for proj4dart
  • Cross-platform compatibility
  • Lightweight and focused
  • Accurate parsing of projection metadata
  • Simple API for WKT conversion

Suitable for

  • Developers using proj4dart
  • GIS application builders
  • Map-based Flutter apps
  • Spatial data integrators
  • Projects requiring coordinate system translation

Considerations

  • Requires proj4dart for full functionality
  • Limited to WKT parsing only
  • No validation of WKT syntax
  • Not intended for rendering or visualization
  • Dependent on external proj4dart library

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

WKT-PARSER-DART

Wkt-parser-dart is the Dart version of proj4js/wkt-parser to convert a WKT CRS string into a Map<String, dynamic> object.

Installing

Add wkt_parser to pubspec.yml (dependencies section), then run pub get to download the new dependencies.

dependencies:
  wkt_parser: any # or the latest version on Pub

Using

You can convert any OGC WKT / ESRI WKT definition string copied from epsg.io into a Map<String,dynamic> format which then can be further converted into JSON to be fully interoperable with any programming languages. This example uses the OGC WKT of EPSG:23700.

import 'package:wkt_parser/wkt_parser.dart' as wkt_parser;

void main() {
  // WKT CRS string
  var wktText =
      'PROJCS["HD72 / EOV",GEOGCS["HD72",DATUM["Hungarian_Datum_1972",SPHEROID["GRS 1967",6378160,298.247167427,AUTHORITY["EPSG","7036"]],TOWGS84[52.17,-71.82,-14.9,0,0,0,0],AUTHORITY["EPSG","6237"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4237"]],PROJECTION["Hotine_Oblique_Mercator_Azimuth_Center"],PARAMETER["latitude_of_center",47.14439372222222],PARAMETER["longitude_of_center",19.04857177777778],PARAMETER["azimuth",90],PARAMETER["rectified_grid_angle",90],PARAMETER["scale_factor",0.99993],PARAMETER["false_easting",650000],PARAMETER["false_northing",200000],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["Y",EAST],AXIS["X",NORTH],AUTHORITY["EPSG","23700"]]';
  // Parsed object of type ProjWKT
  var output = wkt_parser.parseWKT(wktText);
  // This returns a JSON encoded string of the WKT
  print(output.toString());
}

The result should be (with JSON encode):

{
  "type": "PROJCS",
  "name": "HD72 / EOV",
  "GEOGCS": {
    "name": "HD72",
    "DATUM": {
      "name": "Hungarian_Datum_1972",
      "SPHEROID": {
        "name": "GRS 1967",
        "a": 6378160.0,
        "rf": 298.247167427,
        "AUTHORITY": {
          "EPSG": "7036"
        }
      },
      "TOWGS84": [52.17, -71.82, -14.9, 0.0, 0.0, 0.0, 0.0],
      "AUTHORITY": {
        "EPSG": "6237"
      }
    },
    "PRIMEM": {
      "name": "greenwich",
      "convert": 0.0,
      "AUTHORITY": {
        "EPSG": "8901"
      }
    },
    "UNIT": {
      "name": "degree",
      "convert": 0.0174532925199433,
      "AUTHORITY": {
        "EPSG": "9122"
      }
    },
    "AUTHORITY": {
      "EPSG": "4237"
    }
  },
  "PROJECTION": "Hotine_Oblique_Mercator_Azimuth_Center",
  "latitude_of_center": 47.14439372222222,
  "longitude_of_center": 19.04857177777778,
  "azimuth": 90.0,
  "rectified_grid_angle": 90.0,
  "scale_factor": 0.99993,
  "false_easting": 650000.0,
  "false_northing": 200000.0,
  "UNIT": {
    "name": "metre",
    "convert": 1.0,
    "AUTHORITY": {
      "EPSG": "9001"
    }
  },
  "AXIS": [
    ["Y", "EAST"],
    ["X", "NORTH"]
  ],
  "AUTHORITY": {
    "EPSG": "23700"
  },
  "projName": "Hotine_Oblique_Mercator_Azimuth_Center",
  "units": "meter",
  "to_meter": 1.0,
  "datumCode": "hungarian_datum_1972",
  "ellps": "GRS 1967",
  "a": 6378160.0,
  "rf": 298.247167427,
  "datum_params": [52.17, -71.82, -14.9, 0.0, 0.0, 0.0, 0.0],
  "k0": 0.99993,
  "lat0": 0.8228248943093227,
  "longc": 0.3324602953246919,
  "x0": 650000.0,
  "y0": 200000.0,
  "alpha": 1.5707963267948966,
  "srsCode": "HD72 / EOV"
}

Author

Wkt-parser-dart was ported from proj4js/wkt-parser by Gergely Padányi-Gulyás (@fegyi001) at Ulyssys Ltd, Budapest, Hungary.

Categories

Source repository

Projects using this package