Skip to content

Census CensusGetSubDistL.php

James Cobban edited this page Aug 25, 2023 · 3 revisions

Up: Census Implementation

Source Code

This script returns an XML document describing the census sub-districts defined for a specified census and district identifier.

Parameters (passed by method=post):

Name Description
Census 2 character country code plus 4 digit year
District District identifier, or array of identifiers, within the Census.
Sched identifier of the schedule to be searched. Default is '1'.

An example listing the sub-districts within district 47 for the 1891 census.

<select Census="CA1891" District="47">
<parms>Census=CA1891&District=47</parms>
<query>SELECT * FROM SubDistricts WHERE LOCATE('CA1891', `sd_census`) > 0 AND `sd_distid`=47 AND LOCATE(1, `sd_sched`) &gt; 0 ORDER BY SD_census,SD_distid,LPAD(SD_id,4,' '),LPAD(SD_div,4,' '),SD_sched</query>
<option value="47:A">Bothwell Town
<div dist="47" sdid="A" div="" sched="1" reel="T-6324" base="148126" frame="387" count="7" pages="36" page1="1" bypage="1"/>
</option>
<option value="47:B">Camden
<div dist="47" sdid="B" div="1" sched="1" reel="T-6324" base="148126" frame="406" count="4" pages="26" page1="1" bypage="1"/>
<div dist="47" sdid="B" div="2" sched="1" reel="T-6324" base="148126" frame="420" count="16" pages="26" page1="1" bypage="1"/>
<div dist="47" sdid="B" div="3" sched="1" reel="T-6324" base="148126" frame="434" count="12" pages="34" page1="1" bypage="1"/>
<div dist="47" sdid="B" div="4" sched="1" reel="T-6324" base="148126" frame="452" count="6" pages="36" page1="1" bypage="1"/>
</option>
...
</select>

Typical code to invoke this script from JavaScript is:

        let parms               = new Object();
        parms.Census            = censusId;
        parms.District          = dists;
        // get the subdistrict information file
        HTTP.post("CensusGetSubDistL.php",
                  parms,
                  gotSubDist,
                  noSubDist);

Next: CensusGetSubDists.php

Clone this wiki locally