load multiple files
You can load multiple files and overlay their geometries. Each file is assigned different color.
<html>
<body>
<div id="map" style="position:relative;left:100px;width:400px;height:400px;"><div>
</body>
<script type="text/javascript" src="http://www.spacial.io/cad4web/lib/cad4web.js"><script>
<script>
var cad = new cad4web.ContextClass( 'map', { backgroundColor: [20, 20, 20, 1] });
var file_1 = 'http://www.spacial.io/cad4web/files/places.shp;
var file_2 = 'http://www.spacial.io/cad4web/files/world_lr.shp;
cad.clear();
var promise_1 = cad.addShp( file_1, [220, 220, 170 ] );
var promise_2 = cad.addShp( file_2, [220, 220, 170 ], { polygonAsLineString: true } );
Promise.all( [promise_1, promise_2 ])
.then (function () {
cad.zoomTo( [0, 0, 18, 33 ] );
}) ;
</script>
</html>
<body>
<div id="map" style="position:relative;left:100px;width:400px;height:400px;"><div>
</body>
<script type="text/javascript" src="http://www.spacial.io/cad4web/lib/cad4web.js"><script>
<script>
var cad = new cad4web.ContextClass( 'map', { backgroundColor: [20, 20, 20, 1] });
var file_1 = 'http://www.spacial.io/cad4web/files/places.shp;
var file_2 = 'http://www.spacial.io/cad4web/files/world_lr.shp;
cad.clear();
var promise_1 = cad.addShp( file_1, [220, 220, 170 ] );
var promise_2 = cad.addShp( file_2, [220, 220, 170 ], { polygonAsLineString: true } );
Promise.all( [promise_1, promise_2 ])
.then (function () {
cad.zoomTo( [0, 0, 18, 33 ] );
}) ;
</script>
</html>
// map div must have explicitly position defined
(absolute, relative, etc).
// File on server must have header
Access-Control-Allow-Origin: *
// clear library intro image
// zoom to any extent on both files loaded