Skip to content

Muratthekus/kml2geojson

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kml to GeoJson Converter -In Progress-

Basic Kml to GeoJson convert app. It reads all the Kml file under the inputs directory, converts each to GeoJson and write in outputs directory.

package main
func main() {
	files, err := ioutil.ReadDir(DIR)
	if err != nil {
		panic(err)
	}

	for _, f := range files {
		filePath := DIR + f.Name()
		fileName := OUTPUT_DIR + strings.TrimSuffix(f.Name(), ".kml") + ".geojson"
		var kml = parser.UnMarshallKml(filePath)
		var geoJson = parser.ToGeoJson(kml)
		file, _ := json.MarshalIndent(geoJson, "", " ")
		
		_ = ioutil.WriteFile(fileName, file, 0644)
	}
}

About

Read Kml file and convert to Geojson

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages