GeoGMLer

GeoGMLer is a JavaScript library for converting GML data into GeoJSON. It translates FeatureMembers with Points, LineStrings, and Polygons, handling coordinates via gml:coordinates and gml:posList. Supports multi-geometries to ensure conversion to GeoJSON's FeatureCollection.

Bu script direkt olarak kurulamaz. Başka scriptler için bir kütüphanedir ve meta yönergeleri içerir // @require https://update.greatest.deepsurf.us/scripts/526229/1537672/GeoGMLer.js

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği yüklemek için Tampermonkey gibi bir uzantı yüklemeniz gerekir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği indirebilmeniz için ayrıca Tampermonkey gibi bir eklenti kurmanız gerekmektedir.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

Bu stili yüklemek için Stylus gibi bir uzantı yüklemeniz gerekir.

Bu stili yüklemek için Stylus gibi bir uzantı kurmanız gerekir.

Bu stili yükleyebilmek için Stylus gibi bir uzantı yüklemeniz gerekir.

Bu stili yüklemek için bir kullanıcı stili yöneticisi uzantısı yüklemeniz gerekir.

Bu stili yüklemek için bir kullanıcı stili yöneticisi uzantısı kurmanız gerekir.

Bu stili yükleyebilmek için bir kullanıcı stili yöneticisi uzantısı yüklemeniz gerekir.

(Zateb bir user-style yöneticim var, yükleyeyim!)

Yazar
JS55CT
Versiyon
2.1.0
Oluşturulma
08.02.2025
Güncellenme
15.02.2025
Boyut
24,9 KB
Lisans
MIT

GeoGMLer

GeoGMLer is a JavaScript library designed to efficiently convert GML (Geography Markup Language) data into GeoJSON format. It supports a wide range of GML geometries, making it ideal for integrating GML spatial data into web mapping applications and geographic data visualization tools.

License

This project is licensed under the MIT License. See the LICENSE file for more details.

Overview

GeoGMLer offers a comprehensive API to parse GML files and convert them into a GeoJSON FeatureCollection. It is suitable for use in geographic data visualization and web mapping applications, providing support for various geometry types and coordinate reference systems.

Features

  • Convert GML to GeoJSON: Supports conversion of Points, LineStrings, Polygons, and complex structures like gml:MultiCurve and gml:MultiSurface into GeoJSON.
  • CRS Support: Handles coordinate reference systems by extracting CRS information from GML and utilizing it during conversion.
  • Robust XML Parsing: Utilizes DOMParser for efficient parsing and handling of XML data, ensuring accurate extraction of geographical features and attributes.
  • Geometry Processing: Parses and processes both simple and complex geometries, including multi-geometries.
  • No External Dependencies: Lightweight and easy to integrate into various projects without requiring additional libraries.

Usage

To use GeoGMLer, create an instance of GeoGMLer and utilize its methods to perform conversions from GML strings to GeoJSON objects.

Example

// @require             https://update.greatest.deepsurf.us/scripts/526229/1537672/GeoGMLer.js

var geoGMLer = new GeoGMLer(); // Create a new instance of GeoGMLer

// Sample GML data input
const gmlData = `...GML data string...`;

// Parse the GML data
const { xmlDoc, crsName } = geoGMLer.read(gmlData);

// Convert to GeoJSON
const geoJson = geoGMLer.toGeoJSON({ xmlDoc, crsName });

console.log(geoJson);

Key Methods

  • read(gmlText): Parses a GML string into an XML Document and extracts the CRS using DOMParser.
  • toGeoJSON({ xmlDoc, crsName }): Converts a parsed XML Document along with CRS information into a GeoJSON FeatureCollection.
  • getFeatureEleProperties(featureEle): Extracts properties from a GML feature element.
  • processMultiSurface(multiSurfaceElement, crsName): Processes gml:MultiSurface elements to extract polygon data.
  • processMultiCurve(multiCurveElement, crsName): Processes gml:MultiCurve elements to extract line string data.

Acknowledgments

The structure and logic for this project are based on established methods for converting XML to GeoJSON, utilizing modern JavaScript practices for handling geographic data.
Project was inspired by the work of gml2geojson (MIT licensed) and builds upon the concepts and implementations found there.

Project Home

https://github.com/YourUsername/GeoGMLer