cad4web brings to any site superfast webgl map rendering and interaction. You can publish your work by adding cad support to your web site in three steps.

  • include script
    <script type= "text/javascript" src= "cad4web.js" ></script>
  • add canvas element
    <div id= "divId" height= "380" width= "380" ></div>
  • load object
    var cad = new cad4web.ContextClass( 'divId'); cad. addGeoJson( 'http://.../sample.geojson',[ 127, 255, 255]);
cad4web source
Examples Gallery
load shapefileexample-simple-load.htmlsimple load of shapefile
load multiple filesexample-multiple-files.htmlload multiple files and overlay their geometries
wms overlayexample-wms.htmloverlay wms tiles
ol custom map overlayexample-wms-custom.htmloverlay wms tiles and use OpenLayers to customize your map
progress barexample-progress-bar.htmldisplay loading progress bar
load .dxfexample-dxf.html
Documentation

cad4web (exposed library context)
var cad = new cad4web.ContextClass( divId, [options] );

Name
Type
Description
divId
string
the HTMLDivElement id

options

- background
[number[]]
rgb | rgba value array


Methods

addDxf (url, color, options, [layer])
add dxf file to map

Name
Type
Description
url
string
the url of requested dataset

color
number[]
rgb number array

layer
CadLayer
CadLayer object

options

- progressCallback
[(length) => void]
the callback to loading progress update

- polygonAsLineString
[boolean]
instruct loader to load polygons as lines

- pointSize
[number]
size of point render in pixel


addGeoJson (url, color, options, [layer])
add geoJson file to map.

Name
Type
Description
url
string
the url of requested dataset

color
number[]
rgb number array

layer
CadLayer
CadLayer object

options

- progressCallback
[(length) => void]
the callback to loading progress update

- polygonAsLineString
[boolean]
instruct loader to load polygons as lines

- pointSize
[number]
size of point render in pixel


addKml (url, color, options, [layer])
add kml file to map.

Name
Type
Description
url
string
the url of requested dataset

color
number[]
rgb number array

layer
CadLayer
CadLayer object

options

- progressCallback
[(length) => void]
the callback to loading progress update

- polygonAsLineString
[boolean]
instruct loader to load polygons as lines

- pointSize
[number]
size of point render in pixel


addShp (url, color, url)
add shapefile file to map

Name
Type
Description
url
string
the url of requested dataset

color
number[]
rgb number array

layer
CadLayer
CadLayer object

options

- progressCallback
[(length) => void]
the callback to loading progress update

- polygonAsLineString
[boolean]
instruct loader to load polygons as lines

- pointSize
[number]
size of point render in pixel


clear()

clear existing items (eg. logo on startup)

extent()

zoom map window to full data extent

getMeta () : ContextMeta

get metadata of context current state

ContextMeta


Name
Type
Description
center
number[]
center of current view


extent
number[]
extent of current view


render
number of rendered items

lines
number

points
number

triangles
number

vertices
number



zoomTo (extent, [animate]) : Promise<ContextClass>

zoom map window to provided extent

Name
Type
Description
extent
number[]
the extent to zoom

animate
[boolean]
request animation

cad4web. CadLayer

Name
Type
Description
-
-
-



Methods

clear()

clear existing items of layer
Changelog
1.0.0 refactor (2017-09-22)
  • refactor to use div container
  • add kml support
  • refactor shapefile
0.6.3 mousemove (2017-03-23)

add mousemove event register
0.6.2 shp (2017-03-22)

add polygon support for shp
0.6.1 metadata (2017-03-21)

Add get metadata function
0.6.0 selection features (2017-03-20)
  • hover, click support
  • highlight
  • select
  • attach events
  • zoomTo with animation
0.5.3 on load transformation (2017-03-14)

Add support for transformation function on file load
0.5.2 selection feature initiate (2017-03-13)

Add point support for shapefile
0.5.1 shp points (2017-03-12)

Add point support for shapefile
0.5.0 Refactor (2017-03-12)
  • add polygon support
  • add render polygon as line option
  • refactor option params
  • add point size option
0.4.2 CadLayer (2017-03-09)

Add CadLayer object description
0.4.1 zoom options (2017-03-05)

Add max/min view zoom options
0.4.0 options (2017-03-01)

Refactor cad4web options
0.3.1 dxf points (2017-02-26)

Add dxf point entity support
0.3.0 shp (2017-02-17)

Add shapefile read feature (lines)
0.2.1 shaders (2017-02-14)

Add shaders by script
0.2.0 dxf (2017-02-11)

Add dxf read feature (LWPolyline)
0.1.4 background (2017-02-03)

Add background color option
0.1.3 multipolygon (2017-02-03)

Fix multipolygon bug
0.1.2 multiple layers (2017-01-27)

Add multiple layer support
0.1.1 zoom to extent (2017-01-21)

Add extent method
0.1.0 layer color (2017-01-27)

Add color support for geoJson
0.0.3 zoom bug (2017-01-21)

Fix zoom center bug
0.0.2 geojson (2017-01-15)

Add GeoJson support
  • Point
  • LineString
  • Polygon
0.0.1 project launch (2017-01-12)

Project launch

Features
  • mouse pan
  • mouse zoom