Skip to content

kobesin/GeoConvert

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GeoConvert

Converting between Geojson and GIS file formats

KML(KMZ), GPX, Shapefile, DXF(unfinished), WKT(unfinished)

Rreference the JavaScript file manually:

<script src="dist/GeoConvert.min.js"></script>

Note that coordinate transformations depend on proj4.js (this means proj4.js must be included before including the file).

<script src="lib/proj4.js"></script>

Usage

kml to geojson

GeoConvert.kml2Geojson(kml);

geojson to kml

GeoConvert.geojson2Kml(geojson);

gpx to geojson

GeoConvert.gpx2Geojson(kml);

geojson to gpx

GeoConvert.geojson2Gpx(geojson);

shapefile to geojson

//shapefile is a object that contain shp, dbf [arrayBuffer], prj? [string]
var shapefile = {};
shapefile.shp = arrayBuffer_shp;
shapefile.dbf = arrayBuffer_dbf;

//optional
shapefile.prj = string_prj;

GeoConvert.shapefile2Geojson(shapefile);

wkt to geojson

GeoConvert.wkt2Geojson(wkt);