{"id":18890401,"url":"https://github.com/workingdog/kmltogeojson","last_synced_at":"2025-04-14T23:31:15.996Z","repository":{"id":57724073,"uuid":"45369486","full_name":"workingDog/kmlToGeojson","owner":"workingDog","description":"Converts Kml to GeoJSON format","archived":false,"fork":false,"pushed_at":"2020-03-20T03:59:08.000Z","size":54205,"stargazers_count":12,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-28T11:43:16.966Z","etag":null,"topics":["geojson","kml","scala"],"latest_commit_sha":null,"homepage":"","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/workingDog.png","metadata":{"files":{"readme":"README.md","changelog":"changes.md","contributing":null,"funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-11-02T03:09:57.000Z","updated_at":"2021-06-29T11:01:25.000Z","dependencies_parsed_at":"2022-09-02T07:02:05.762Z","dependency_job_id":null,"html_url":"https://github.com/workingDog/kmlToGeojson","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/workingDog%2FkmlToGeojson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/workingDog%2FkmlToGeojson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/workingDog%2FkmlToGeojson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/workingDog%2FkmlToGeojson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/workingDog","download_url":"https://codeload.github.com/workingDog/kmlToGeojson/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248978588,"owners_count":21192818,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["geojson","kml","scala"],"created_at":"2024-11-08T07:55:27.201Z","updated_at":"2025-04-14T23:31:10.969Z","avatar_url":"https://github.com/workingDog.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Convert Kml to GeoJSON format \n\nThis application **KmlToGeojson**, converts Kml and Kmz files into a GeoJSON representation. \n\n[Kml](https://developers.google.com/kml/documentation/kmlreference) is used in Google Earth to display \nvarious geographic elements, such as; images, place marks, polygon shapes, and so on.\n\nSimilarly [GeoJSON](http://geojson.org/) is a format for encoding a variety of geographic data structures.\n\nThis scala application uses the [scalakml library](https://github.com/workingDog/scalakml) and \nthe [play-geojson library](https://github.com/jroper/play-geojson) to convert Kml to GeoJSON format.\n \n## Kml to GeoJSON mapping\n\nCurrently the following mapping is implemented.\n\n    Kml object -\u003e list of GeoJSON object\n    Kml Folder -\u003e GeoJSON FeatureCollection\n    Kml Document -\u003e GeoJSON FeatureCollection\n    Kml MultiGeometry -\u003e GeoJSON GeometryCollection\n    Kml Placemark -\u003e GeoJSON Feature\n    Kml Point -\u003e GeoJSON Point\n    Kml LineString -\u003e GeoJSON LineString\n    Kml LinearRing -\u003e GeoJSON LineString\n    Kml Polygon -\u003e GeoJSON Polygon\n    Kml LatLonAltBox -\u003e GeoJSON bbox\n\nThe GeoJSON Feature \"properties\" are generated from the following Kml elements:\n\n    name, description, address, phoneNumber, styleUrl, visibility, open, \n    timeSpan (begin and end), timeStamp (when),\n    extendedData (displayName, name, value), altitudeMode, extrude\n \nThe Kml \"id\" attribute is converted to the GeoJSON Feature \"id\".\n\nEverything else is ignored.\n \nOnly [WGS84](https://en.wikipedia.org/wiki/World_Geodetic_System) coordinate reference system \nis supported and all longitudes and latitudes are in decimal degrees.\n\n## Installation and packaging\n\nThe easiest way to compile and package the application from source is to use [SBT](http://www.scala-sbt.org/).\nTo package the application and all its dependencies into a single jar file type:\n\n    sbt assembly\n\nThis will produce \"kmltogeojson-1.2.jar\" in the \"./target/scala-2.13\" directory.\n\n#### For convenience a **kmltogeojson-1.2.jar** file is in the \"distrib\" directory ready for use.\n\n## Usage\n\nOnce you have the jar file, simply type at the prompt:\n \n    java -jar kmltogeojson-1.2.jar kml_file.kml geojson_file.geojson\n \nwhere \"kml_file.kml\" is the Kml file you want to convert, and \"geojson_file.geojson\" is the destination file \nwith the [GeoJSON](http://geojson.org/) format results. If the \"geojson_file.geojson\" is absent, the output is directed to the console.\n \nYou can also use this library in your scala code. First add the following dependency to your build.sbt file:\n\n    libraryDependencies += \"com.github.workingDog\" %% \"kmltogeojson\" % \"1.2\"\n\nThen, for example:\n\n    object TestGeoJson {\n      def main(args: Array[String]) {\n        // read a kml document from file\n        val kml = new KmlFileReader().getKmlFromFile(\"./kml-files/Sydney.kml\")\n        // convert the kml document to geojson format\n        val geojson = KmlConverter().toGeoJson(kml)\n        // print the geojson objects\n        geojson.foreach(obj =\u003e println(Json.prettyPrint(Json.toJson(obj))))\n      }\n    }\n   \nThe **KmlConverter.scala** has one generic method **toGeoJson()** that takes any of the implemented Kml objects. \nSee also \"TestGeoJson\".\n \n## Dependencies\n\nDepends on the scala [scalakml library](https://github.com/workingDog/scalakml), \nand on the scala [play-geojson library](https://github.com/jroper/play-geojson).\n\n## References\n \n1) OGC 07-147r2 Version: 2.2.0, Category: OGC Standard, Editor: Tim Wilson, at http://www.opengeospatial.org/standards/kml\n\n2) Google developers KML Reference, at https://developers.google.com/kml/documentation/kmlreference\n\n3) GeoJSON reference document, at http://geojson.org/geojson-spec.html\n\n## Status\n\nStable.\n\nUsing Scala 2.13.1, Java 11 and SBT-1.3.8.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fworkingdog%2Fkmltogeojson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fworkingdog%2Fkmltogeojson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fworkingdog%2Fkmltogeojson/lists"}