@@ -349,6 +349,105 @@ describe('#GeometryCollection', function () {
349
349
expect ( selection . getGeometries ( ) ) . to . have . length ( points . length ) ;
350
350
} ) ;
351
351
} ) ;
352
+
353
+ it ( '#2146 _toJSON(null) from feature-filter' , function ( ) {
354
+ const geojson = {
355
+ "type" : "FeatureCollection" ,
356
+ "name" : "aa" ,
357
+ "crs" : {
358
+ "type" : "name" ,
359
+ "properties" : {
360
+ "name" : "EPSG:4490"
361
+ }
362
+ } ,
363
+ "features" : [
364
+ {
365
+ "type" : "Feature" ,
366
+ "geometry" : {
367
+ "type" : "GeometryCollection" ,
368
+ "geometries" : [
369
+ {
370
+ "type" : "Polygon" ,
371
+ "coordinates" : [
372
+ [
373
+ [ 113.7991529327 , 23.0121665284 ] ,
374
+ [ 113.7605656502 , 22.9686311814 ] ,
375
+ [ 113.8260686078 , 22.9546199745 ] ,
376
+ [ 113.8198107317 , 23.0045461461 ] ,
377
+ [ 113.7991529327 , 23.0121665284 ]
378
+ ]
379
+ ]
380
+ } ,
381
+ {
382
+ "type" : "Polygon" ,
383
+ "coordinates" : [
384
+ [
385
+ [ 113.8688589262 , 22.9914540607 ] ,
386
+ [ 113.8333100818 , 22.9400538911 ] ,
387
+ [ 113.8869830716 , 22.9190765221 ] ,
388
+ [ 113.8939079988 , 22.9690147904 ] ,
389
+ [ 113.8688589262 , 22.9914540607 ]
390
+ ]
391
+ ]
392
+ } ,
393
+ {
394
+ "type" : "Polygon" ,
395
+ "coordinates" : [
396
+ [
397
+ [ 113.7786088849 , 22.9485879648 ] ,
398
+ [ 113.7591122414 , 22.8866803638 ] ,
399
+ [ 113.8297744355 , 22.8793652689 ] ,
400
+ [ 113.8198854714 , 22.9481623574 ] ,
401
+ [ 113.7786088849 , 22.9485879648 ]
402
+ ]
403
+ ]
404
+ } ,
405
+ {
406
+ "type" : "MultiPolygon" ,
407
+ "coordinates" : [
408
+ [
409
+ [
410
+ [ 113.8654530057 , 23.0430565973 ] ,
411
+ [ 113.8432406194 , 23.0525926525 ] ,
412
+ [ 113.8218502836 , 23.0236615414 ] ,
413
+ [ 113.870137785 , 23.0034008379 ] ,
414
+ [ 113.8654530057 , 23.0430565973 ]
415
+ ]
416
+ ] ,
417
+ [
418
+ [
419
+ [ 113.8561406429 , 23.0607279435 ] ,
420
+ [ 113.8339123801 , 23.0802969357 ] ,
421
+ [ 113.8189838691 , 23.0439658919 ] ,
422
+ [ 113.8561406429 , 23.0607279435 ]
423
+ ]
424
+ ]
425
+ ]
426
+ }
427
+ ]
428
+ } ,
429
+ "properties" : {
430
+ "OBJECTID" : 1 ,
431
+ "SHAPE_Length" : 20977.022743581954 ,
432
+ "SHAPE_Area" : 24845610.21174327
433
+ }
434
+ }
435
+ ]
436
+ }
437
+ const polygons = maptalks . GeoJSON . toGeometry ( geojson ) ;
438
+ layer = new maptalks . VectorLayer ( "v" ) . addTo ( map ) ;
439
+ layer . setStyle ( {
440
+ symbol : {
441
+ polygonFill : '#FFFFFF' ,
442
+ polygonOpacity : 1 ,
443
+ lineColor : 'blue' ,
444
+ lineWidth : 2 ,
445
+ lineDasharray : [ 10 , 10 ] ,
446
+ }
447
+ } )
448
+ layer . addGeometry ( polygons )
449
+ } ) ;
450
+
352
451
} ) ;
353
452
354
453
function genPoints ( ) {
0 commit comments