{"size": 935, "ext": "xsjs", "max_stars_repo_path": "odatapublic/geospacial.xsjs", "max_stars_repo_name": "ash2star/authLevelPoC", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "odatapublic/geospacial.xsjs", "max_issues_repo_name": "ash2star/authLevelPoC", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "odatapublic/geospacial.xsjs", "max_forks_repo_name": "ash2star/authLevelPoC", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 30.1612903226, "max_line_length": 84, "alphanum_fraction": 0.5914438503}
var conn = $.db.getConnection();
var wks = "";
// Line
// wks = "LineString (0 0, 3 4, 0 4, 0 0, 2 2, 6 3)";
// Circle with a gap
// wks = "CircularString (0 0, 3 4, 0 4)";
// Two Circles closed
// wks = "CircularString (0 0, 3 4, 0 4, -3 4, 0 0)";
//
// wks = "LineString (0 0, 1 1, 0 1, 1 0)";
// Circle
// wks = "CircularString (0 0, 3 4, 0 0)";
// Polygon
wks = 'Polygon ((0 0, 4 0, 0 3, 0 0), (0.5 0.5, 0.5 1.5, 1.5 1.5, 1 0.5, 0.5 0.5))';

var select = "SELECT ST_GeomFromText('" + wks + "').ST_asSVG() as SVG FROM dummy;";

var pstmt = conn.prepareStatement( select );
var rs = pstmt.executeQuery();
if (!rs.next()) {
    $.response.contentType = "text/plain";
	$.response.setBody( "Failed to retrieve data" );
	$.response.status = $.net.http.INTERNAL_SERVER_ERROR;
}
else { 
	var svg =  rs.getString(1);
	svg.replace('fill="none"', 'fill="yellow"');
    $.response.contentType = "image/svg+xml";
    $.response.setBody(svg);
}
