Upload data file - GeoSmartCity-CIP/gsc-client GitHub Wiki

Upload Data File

The module provides components to upload SHP (as ZIP file containing SHP, SHX and DBF), GML, KML and CityGML files, and pass them to the HUB in order to calculate the building solar potential. It needs server side to process uploaded file.

The HUB address must be set up by mod.uploadUrl variable. Maximum file size can be limited by value of variable gsc.upload.fileSize (the value is checked before upload starts).

API

API is available at GitHub src/upload/upload.js.

Dependencies

This library depends on jQuery.

Examples

The following example shows form inside given div. When selected, user is prompted to pick a file to upload. When the user selects a file, it is uploaded to the HUB.

// Setup URL to the HUB
gsc.upload.uploadUrl = 'https://';

// Div selector for upload form
var upload = = $('uploadDiv');

// Creation of the upload form in the div
gsc.upload.uploadForm(upload);

The above code produces a form, which may look like the one in the following figure.

Full code of the example can be found here.