Introduction to Programming for Spatial Analysts: CASA0013 Final Assessment: Guidelines and Adjustments
Hi all! We wanted to give a few tips and pointers, and also to suggest a few MINOR ADJUSTMENTS to Task 5 which we think will make the assessment a bit more straightforward. Weve been working through the examples ourselves again, so these are based on our own experiences.
EXAMPLE OUTPUT
Weve attached a series of sample input files, which should produce the following output.
superSimpleCases.tsvshould produce the output shown below in Figure 1. This is the basic kind of file the work will be assessed against for a passing mark.
Figure 1 Output associated with superSimpleCases.tsv
sampleCases.tsvshould produce the output shown below in Figure 2. This is the kind of file the work will be assessed against for merit and distinction.
Figure 2 Output associated with sampleCases.tsv
sampleCases3.tsvno output, the file is empty; user should know to halt at Task 1. Handling these kinds of files successfully will contribute toward merit or distinction.
MINOR ADJUSTMENTS TO TASK 5
Below are a few minor modifications to Task 5 which makes it a bit easier and prettier. In the real world, sometimes you are forced to handle really weird and ugly workflows, but for now lets focus on the important stuff!
it can be a pain to make sure that you dont export a single, final empty line on your output file sampleoutput.txt. So weve added a line to omit any empty lines in sampleoutput.txt.
ifline.length1 continue;
because of the way were building the Array of latitude and longitude values, its much better to make sure youre adding the elements as numbers from the beginning. Cast them in the readin portion.
cs.lat.pushNumberline0;
cs.lon.pushNumberline1;
cs.count.pushNumberline2;
Weve made the bars a bit wider so you can see them more easily. div.style.widthx10px;
Weve styled the bars a little more, just because they were SO UGLY.
.mybar height: 30px; margin: 2px; padding: 3px; background
color: 0000FF; color: FFFFFF; fontsize: 8pt; whitespace:
nowrap;
The adjusted version of code that should go in the final Task is as on the following page the edited sections are highlighted in yellow font. If for any reason you need this information in a different format, please contact us and well make it accessible to you immediately!.
html
head
style
.mybar height: 0000FF; color: FFFFFF;
; margin: ; padding:
; backgroundcolor:
30px
style
script srcfinalAssessmentCASA0O13.jsscript script
2px
ADD JS HERE
script
head
body
h3Barchart of Resultsh3pdiv idbarchartdiv h3Summary Statisticsh3pdiv idsummaryStatsdiv
script
var myBarfunctionx, title
var elementdocument.getElementByIdbarchart; var divdocument.createElementDIV; div.setAttributeclass, mybar; div.style.widthx10px;
div.innerHTMLtitle;
element.appenddiv;
;
var myStatsfunctioncs
var elementdocument.getElementByIdsummaryStats; element.innerHTMLThe summary statistics for Case Study b
cs.nameb are:br;
element.innerHTMLbrbGEOGRAPHIC EXTENT:b cs.getExtent; element.innerHTMLpbCENTROID:b cs.getCentroid;
;
var summariseCaseStudiesfunctiondata, filename
var csnew CaseStudyfilename, , , ;
var i;
var rawDatadata.splitn; fori0; irawData.length; i
var linerawDatai.splitt;
3px
fontsize: 8pt; whitespace: nowrap;
ifline.length1 continue;
cs.lat.push
cs.lon.push
cs.count.push line2; myBarline2, line0, line1;
myStatscs;
;
var filenamesampleoutput.txt;
readInFilefilename.thenresponsesummariseCaseStudiesresponse, filename;
script
body
Number
Number
line0;
line1;
Number
Reviews
There are no reviews yet.