File tree Expand file tree Collapse file tree 1 file changed +17
-14
lines changed
Expand file tree Collapse file tree 1 file changed +17
-14
lines changed Original file line number Diff line number Diff line change @@ -18,25 +18,28 @@ module.exports = function (
1818 var prj = ( options && options . prj ) ? options . prj : defaultPrj ;
1919
2020 [
21- geojson . point ( gj ) ,
22- geojson . line ( gj ) ,
23- geojson . polygon ( gj ) ,
24- geojson . multipolygon ( gj ) ,
25- geojson . multiline ( gj ) ,
26- ] . forEach ( function ( l ) {
27- if ( l . geometries . length && l . geometries [ 0 ] . length ) {
28- write (
21+ [ geojson . point ( gj ) ] ,
22+ [ geojson . line ( gj ) , geojson . multiline ( gj ) ] ,
23+ [ geojson . polygon ( gj ) , geojson . multipolygon ( gj ) ] ,
24+ ] . forEach ( function ( l ) {
25+ if ( ( l [ 0 ] . geometries . length && l [ 0 ] . geometries [ 0 ] . length ) || l [ 1 ] && l [ 1 ] . geometries . length && l [ 1 ] . geometries [ 0 ] . length ) {
26+
27+ const properties = l . flatMap ( l => l . properties ) ;
28+ const geometries = l . flatMap ( l => l . geometries ) ;
29+ const type = l [ 0 ] . type ;
30+
31+ write (
2932 // field definitions
30- l . properties ,
33+ properties ,
3134 // geometry type
32- l . type ,
35+ l [ 0 ] . type ,
3336 // geometries
34- l . geometries ,
37+ geometries ,
3538 function ( err , files ) {
3639 var fileName =
37- options && options . types && options . types [ l . type . toLowerCase ( ) ]
38- ? options . types [ l . type . toLowerCase ( ) ]
39- : l . type ;
40+ options && options . types && options . types [ type . toLowerCase ( ) ]
41+ ? options . types [ type . toLowerCase ( ) ]
42+ : type ;
4043 zipTarget . file ( fileName + ".shp" , files . shp . buffer , { binary : true } ) ;
4144 zipTarget . file ( fileName + ".shx" , files . shx . buffer , { binary : true } ) ;
4245 zipTarget . file ( fileName + ".dbf" , files . dbf . buffer , { binary : true } ) ;
You can’t perform that action at this time.
0 commit comments