[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"blog-\u002Fblog\u002Fbatch-api-government-gis-pipeline-legal-land-descriptions":3},{"id":4,"title":5,"author":6,"body":7,"category":1436,"cover":1437,"date":1438,"description":1439,"extension":1440,"meta":1441,"navigation":451,"path":1442,"seo":1443,"stem":1444,"tags":1445,"__hash__":1451},"blog\u002Fblog\u002Fbatch-api-government-gis-pipeline-legal-land-descriptions.md","Geocode Legal Land Descriptions in a Government GIS Pipeline with the Batch API","Township Canada",{"type":8,"value":9,"toc":1429},"minimark",[10,23,26,31,42,126,129,144,392,403,416,420,423,1119,1133,1144,1148,1151,1219,1226,1230,1233,1384,1413,1417,1422,1425],[11,12,13,14,18,19,22],"p",{},"Many public land records are keyed by legal land description, not by coordinates. A permit register, a disposition table, or a list of inspected sites can hold ",[15,16,17],"code",{},"NW-14-32-21-W4"," or ",[15,20,21],{},"10-36-42-3-W5"," in a text column and nothing else about location. That works for the people who read the records. However, it does not work for the dashboard, the map service, or the spatial join that the GIS team runs every night, because those tools need geometry.",[11,24,25],{},"Teams usually close that gap in one of two ways. Someone exports the records, converts them in a separate tool, and imports the coordinates again, which breaks the link between the source table and the map on every refresh. Or someone writes a parser, which works until it meets a different meridian, an LSD written with a prefix, a BC NTS reference, or a river lot. The Township Canada Batch API takes a third route: the pipeline sends the descriptions it already has and gets GeoJSON back as one step of the normal job.",[27,28,30],"h2",{"id":29},"what-the-batch-api-takes-and-returns","What the Batch API takes and returns",[11,32,33,34,37,38,41],{},"The endpoint is ",[15,35,36],{},"POST https:\u002F\u002Fdeveloper.townshipcanada.com\u002Fbatch\u002Flegal-location",". The request body is a JSON array of legal land descriptions, up to 100 per request, and the API key goes in the ",[15,39,40],{},"X-API-Key"," header:",[43,44,49],"pre",{"className":45,"code":46,"language":47,"meta":48,"style":48},"language-bash shiki shiki-themes material-theme-lighter vitesse-light vitesse-dark","curl -X POST https:\u002F\u002Fdeveloper.townshipcanada.com\u002Fbatch\u002Flegal-location \\\n  -H \"X-API-Key: $TOWNSHIP_CANADA_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '[\"NW-14-32-21-W4\", \"10-36-42-3-W5\", \"SE-22-40-14-W3\"]'\n","bash","",[15,50,51,75,97,111],{"__ignoreMap":48},[52,53,56,60,64,68,71],"span",{"class":54,"line":55},"line",1,[52,57,59],{"class":58},"sYn-s","curl",[52,61,63],{"class":62},"sz9Cv"," -X",[52,65,67],{"class":66},"sTbE_"," POST",[52,69,70],{"class":66}," https:\u002F\u002Fdeveloper.townshipcanada.com\u002Fbatch\u002Flegal-location",[52,72,74],{"class":73},"se3Ec"," \\\n",[52,76,78,81,85,88,92,95],{"class":54,"line":77},2,[52,79,80],{"class":62},"  -H",[52,82,84],{"class":83},"sbYkP"," \"",[52,86,87],{"class":66},"X-API-Key: ",[52,89,91],{"class":90},"su_V2","$TOWNSHIP_CANADA_API_KEY",[52,93,94],{"class":83},"\"",[52,96,74],{"class":73},[52,98,100,102,104,107,109],{"class":54,"line":99},3,[52,101,80],{"class":62},[52,103,84],{"class":83},[52,105,106],{"class":66},"Content-Type: application\u002Fjson",[52,108,94],{"class":83},[52,110,74],{"class":73},[52,112,114,117,120,123],{"class":54,"line":113},4,[52,115,116],{"class":62},"  -d",[52,118,119],{"class":83}," '",[52,121,122],{"class":66},"[\"NW-14-32-21-W4\", \"10-36-42-3-W5\", \"SE-22-40-14-W3\"]",[52,124,125],{"class":83},"'\n",[11,127,128],{},"The same array can mix DLS townships, sections, quarter sections, and LSDs with NTS references, river lots, and Ontario lots and concessions. You don't need to sort records by survey system before you send them.",[11,130,131,132,135,136,139,140,143],{},"The response is a JSON array with one GeoJSON ",[15,133,134],{},"FeatureCollection"," for each description that matched. Each collection holds two features: the parcel boundary (",[15,137,138],{},"\"shape\": \"grid\"",") and its centre point (",[15,141,142],{},"\"shape\": \"centroid\"","). Both carry the same properties:",[43,145,149],{"className":146,"code":147,"language":148,"meta":48,"style":48},"language-json shiki shiki-themes material-theme-lighter vitesse-light vitesse-dark","{\n  \"type\": \"Feature\",\n  \"geometry\": { \"type\": \"Point\", \"coordinates\": [-112.880937, 51.747298] },\n  \"properties\": {\n    \"shape\": \"centroid\",\n    \"search_term\": \"NW-14-32-21-W4\",\n    \"legal_location\": \"NW-14-32-21-W4\",\n    \"unit\": \"Quarter Section\",\n    \"survey_system\": \"DLS\",\n    \"province\": \"Alberta\"\n  }\n}\n","json",[15,150,151,157,182,242,256,278,298,318,339,360,380,386],{"__ignoreMap":48},[52,152,153],{"class":54,"line":55},[52,154,156],{"class":155},"soVBu","{\n",[52,158,159,163,167,169,172,174,177,179],{"class":54,"line":77},[52,160,162],{"class":161},"s4Jsk","  \"",[52,164,166],{"class":165},"sLorS","type",[52,168,94],{"class":161},[52,170,171],{"class":155},":",[52,173,84],{"class":83},[52,175,176],{"class":66},"Feature",[52,178,94],{"class":83},[52,180,181],{"class":155},",\n",[52,183,184,186,189,191,193,196,198,201,203,205,207,210,212,215,217,220,222,224,227,231,233,236,239],{"class":54,"line":99},[52,185,162],{"class":161},[52,187,188],{"class":165},"geometry",[52,190,94],{"class":161},[52,192,171],{"class":155},[52,194,195],{"class":155}," {",[52,197,84],{"class":161},[52,199,166],{"class":200},"sa2tF",[52,202,94],{"class":161},[52,204,171],{"class":155},[52,206,84],{"class":83},[52,208,209],{"class":66},"Point",[52,211,94],{"class":83},[52,213,214],{"class":155},",",[52,216,84],{"class":161},[52,218,219],{"class":200},"coordinates",[52,221,94],{"class":161},[52,223,171],{"class":155},[52,225,226],{"class":155}," [",[52,228,230],{"class":229},"s7CZa","-112.880937",[52,232,214],{"class":155},[52,234,235],{"class":229}," 51.747298",[52,237,238],{"class":155},"]",[52,240,241],{"class":155}," },\n",[52,243,244,246,249,251,253],{"class":54,"line":113},[52,245,162],{"class":161},[52,247,248],{"class":165},"properties",[52,250,94],{"class":161},[52,252,171],{"class":155},[52,254,255],{"class":155}," {\n",[52,257,259,262,265,267,269,271,274,276],{"class":54,"line":258},5,[52,260,261],{"class":161},"    \"",[52,263,264],{"class":200},"shape",[52,266,94],{"class":161},[52,268,171],{"class":155},[52,270,84],{"class":83},[52,272,273],{"class":66},"centroid",[52,275,94],{"class":83},[52,277,181],{"class":155},[52,279,281,283,286,288,290,292,294,296],{"class":54,"line":280},6,[52,282,261],{"class":161},[52,284,285],{"class":200},"search_term",[52,287,94],{"class":161},[52,289,171],{"class":155},[52,291,84],{"class":83},[52,293,17],{"class":66},[52,295,94],{"class":83},[52,297,181],{"class":155},[52,299,301,303,306,308,310,312,314,316],{"class":54,"line":300},7,[52,302,261],{"class":161},[52,304,305],{"class":200},"legal_location",[52,307,94],{"class":161},[52,309,171],{"class":155},[52,311,84],{"class":83},[52,313,17],{"class":66},[52,315,94],{"class":83},[52,317,181],{"class":155},[52,319,321,323,326,328,330,332,335,337],{"class":54,"line":320},8,[52,322,261],{"class":161},[52,324,325],{"class":200},"unit",[52,327,94],{"class":161},[52,329,171],{"class":155},[52,331,84],{"class":83},[52,333,334],{"class":66},"Quarter Section",[52,336,94],{"class":83},[52,338,181],{"class":155},[52,340,342,344,347,349,351,353,356,358],{"class":54,"line":341},9,[52,343,261],{"class":161},[52,345,346],{"class":200},"survey_system",[52,348,94],{"class":161},[52,350,171],{"class":155},[52,352,84],{"class":83},[52,354,355],{"class":66},"DLS",[52,357,94],{"class":83},[52,359,181],{"class":155},[52,361,363,365,368,370,372,374,377],{"class":54,"line":362},10,[52,364,261],{"class":161},[52,366,367],{"class":200},"province",[52,369,94],{"class":161},[52,371,171],{"class":155},[52,373,84],{"class":83},[52,375,376],{"class":66},"Alberta",[52,378,379],{"class":83},"\"\n",[52,381,383],{"class":54,"line":382},11,[52,384,385],{"class":155},"  }\n",[52,387,389],{"class":54,"line":388},12,[52,390,391],{"class":155},"}\n",[11,393,394,396,397,399,400,402],{},[15,395,285],{}," is the description you sent, and ",[15,398,305],{}," is the parcel it resolved to. Coordinates are WGS84 longitude and latitude, the GeoJSON default. A description that does not match a parcel gets no collection in the response. Therefore, join results back to your records on ",[15,401,285],{},", and treat any input without a match as a row to review.",[11,404,405,406,409,410,415],{},"There is a reverse endpoint, ",[15,407,408],{},"POST \u002Fbatch\u002Fcoordinates",", for the opposite direction. The ",[411,412,414],"a",{"href":413},"\u002Fguides\u002Fbatch-api-guide","Batch API guide"," covers both endpoints and their status codes.",[27,417,419],{"id":418},"drop-the-call-into-an-existing-etl-job","Drop the call into an existing ETL job",[11,421,422],{},"The API does not page results or split large inputs for you. Instead, your job sends the records in chunks of 100. The Python sketch below reads a list of descriptions, cleans it, sends it in chunks, and keeps every returned feature:",[43,424,428],{"className":425,"code":426,"language":427,"meta":48,"style":48},"language-python shiki shiki-themes material-theme-lighter vitesse-light vitesse-dark","import os\nimport time\n\nimport requests\n\nAPI_URL = \"https:\u002F\u002Fdeveloper.townshipcanada.com\u002Fbatch\u002Flegal-location\"\nHEADERS = {\"X-API-Key\": os.environ[\"TOWNSHIP_CANADA_API_KEY\"]}\nCHUNK_SIZE = 100\n\n\ndef geocode(descriptions):\n    # One empty or non-text value rejects the whole request, so drop them first.\n    clean = sorted({d.strip() for d in descriptions if isinstance(d, str) and d.strip()})\n    features = []\n    for start in range(0, len(clean), CHUNK_SIZE):\n        chunk = clean[start : start + CHUNK_SIZE]\n        for attempt in range(3):\n            resp = requests.post(API_URL, json=chunk, headers=HEADERS, timeout=60)\n            if resp.status_code != 429:\n                break\n            time.sleep(2 ** attempt)\n        resp.raise_for_status()\n        for collection in resp.json():\n            features.extend(collection[\"features\"])\n        time.sleep(1)  # Build tier: one request per second\n    return clean, features\n\n\ndescriptions = [\"NW-14-32-21-W4\", \"10-36-42-3-W5\", \"SE-22-40-14-W3\"]\nsent, features = geocode(descriptions)\n\ncentroids = {f[\"properties\"][\"search_term\"]: f for f in features if f[\"properties\"][\"shape\"] == \"centroid\"}\nunmatched = [d for d in sent if d not in centroids]\n","python",[15,429,430,440,447,453,460,464,479,519,529,533,537,557,563,635,646,684,712,732,785,808,814,838,852,871,899,919,932,937,942,977,998,1003,1082],{"__ignoreMap":48},[52,431,432,436],{"class":54,"line":55},[52,433,435],{"class":434},"siDh9","import",[52,437,439],{"class":438},"sftqT"," os\n",[52,441,442,444],{"class":54,"line":77},[52,443,435],{"class":434},[52,445,446],{"class":438}," time\n",[52,448,449],{"class":54,"line":99},[52,450,452],{"emptyLinePlaceholder":451},true,"\n",[52,454,455,457],{"class":54,"line":113},[52,456,435],{"class":434},[52,458,459],{"class":438}," requests\n",[52,461,462],{"class":54,"line":258},[52,463,452],{"emptyLinePlaceholder":451},[52,465,466,469,472,474,477],{"class":54,"line":280},[52,467,468],{"class":73},"API_URL",[52,470,471],{"class":155}," =",[52,473,84],{"class":83},[52,475,476],{"class":66},"https:\u002F\u002Fdeveloper.townshipcanada.com\u002Fbatch\u002Flegal-location",[52,478,379],{"class":83},[52,480,481,484,486,488,490,492,494,496,499,502,506,509,511,514,516],{"class":54,"line":300},[52,482,483],{"class":73},"HEADERS",[52,485,471],{"class":155},[52,487,195],{"class":155},[52,489,94],{"class":83},[52,491,40],{"class":66},[52,493,94],{"class":83},[52,495,171],{"class":155},[52,497,498],{"class":438}," os",[52,500,501],{"class":155},".",[52,503,505],{"class":504},"sBPpx","environ",[52,507,508],{"class":155},"[",[52,510,94],{"class":83},[52,512,513],{"class":66},"TOWNSHIP_CANADA_API_KEY",[52,515,94],{"class":83},[52,517,518],{"class":155},"]}\n",[52,520,521,524,526],{"class":54,"line":320},[52,522,523],{"class":73},"CHUNK_SIZE",[52,525,471],{"class":155},[52,527,528],{"class":229}," 100\n",[52,530,531],{"class":54,"line":341},[52,532,452],{"emptyLinePlaceholder":451},[52,534,535],{"class":54,"line":362},[52,536,452],{"emptyLinePlaceholder":451},[52,538,539,543,547,550,554],{"class":54,"line":382},[52,540,542],{"class":541},"s5Kfy","def",[52,544,546],{"class":545},"sljsM"," geocode",[52,548,549],{"class":155},"(",[52,551,553],{"class":552},"sCyAa","descriptions",[52,555,556],{"class":155},"):\n",[52,558,559],{"class":54,"line":388},[52,560,562],{"class":561},"s9Tkl","    # One empty or non-text value rejects the whole request, so drop them first.\n",[52,564,566,569,572,576,579,583,585,588,591,594,597,600,603,606,609,611,613,615,618,621,625,628,630,632],{"class":54,"line":565},13,[52,567,568],{"class":438},"    clean ",[52,570,571],{"class":155},"=",[52,573,575],{"class":574},"sJdAF"," sorted",[52,577,578],{"class":155},"({",[52,580,582],{"class":581},"siWMO","d",[52,584,501],{"class":155},[52,586,587],{"class":581},"strip",[52,589,590],{"class":155},"()",[52,592,593],{"class":434}," for",[52,595,596],{"class":581}," d ",[52,598,599],{"class":434},"in",[52,601,602],{"class":581}," descriptions ",[52,604,605],{"class":434},"if",[52,607,608],{"class":574}," isinstance",[52,610,549],{"class":155},[52,612,582],{"class":581},[52,614,214],{"class":155},[52,616,617],{"class":200}," str",[52,619,620],{"class":155},")",[52,622,624],{"class":623},"sVsLi"," and",[52,626,627],{"class":581}," d",[52,629,501],{"class":155},[52,631,587],{"class":581},[52,633,634],{"class":155},"()})\n",[52,636,638,641,643],{"class":54,"line":637},14,[52,639,640],{"class":438},"    features ",[52,642,571],{"class":155},[52,644,645],{"class":155}," []\n",[52,647,649,652,655,657,660,662,665,667,670,672,675,678,682],{"class":54,"line":648},15,[52,650,651],{"class":434},"    for",[52,653,654],{"class":438}," start ",[52,656,599],{"class":434},[52,658,659],{"class":574}," range",[52,661,549],{"class":155},[52,663,664],{"class":229},"0",[52,666,214],{"class":155},[52,668,669],{"class":574}," len",[52,671,549],{"class":155},[52,673,674],{"class":581},"clean",[52,676,677],{"class":155},"),",[52,679,681],{"class":680},"s6DHA"," CHUNK_SIZE",[52,683,556],{"class":155},[52,685,687,690,692,695,697,700,702,704,707,709],{"class":54,"line":686},16,[52,688,689],{"class":438},"        chunk ",[52,691,571],{"class":155},[52,693,694],{"class":438}," clean",[52,696,508],{"class":155},[52,698,699],{"class":438},"start ",[52,701,171],{"class":155},[52,703,654],{"class":438},[52,705,706],{"class":623},"+",[52,708,681],{"class":73},[52,710,711],{"class":155},"]\n",[52,713,715,718,721,723,725,727,730],{"class":54,"line":714},17,[52,716,717],{"class":434},"        for",[52,719,720],{"class":438}," attempt ",[52,722,599],{"class":434},[52,724,659],{"class":574},[52,726,549],{"class":155},[52,728,729],{"class":229},"3",[52,731,556],{"class":155},[52,733,735,738,740,743,745,748,750,752,754,758,760,763,765,768,770,772,774,777,779,782],{"class":54,"line":734},18,[52,736,737],{"class":438},"            resp ",[52,739,571],{"class":155},[52,741,742],{"class":438}," requests",[52,744,501],{"class":155},[52,746,747],{"class":581},"post",[52,749,549],{"class":155},[52,751,468],{"class":680},[52,753,214],{"class":155},[52,755,757],{"class":756},"sqOPj"," json",[52,759,571],{"class":155},[52,761,762],{"class":581},"chunk",[52,764,214],{"class":155},[52,766,767],{"class":756}," headers",[52,769,571],{"class":155},[52,771,483],{"class":680},[52,773,214],{"class":155},[52,775,776],{"class":756}," timeout",[52,778,571],{"class":155},[52,780,781],{"class":229},"60",[52,783,784],{"class":155},")\n",[52,786,788,791,794,796,799,802,805],{"class":54,"line":787},19,[52,789,790],{"class":434},"            if",[52,792,793],{"class":438}," resp",[52,795,501],{"class":155},[52,797,798],{"class":504},"status_code",[52,800,801],{"class":623}," !=",[52,803,804],{"class":229}," 429",[52,806,807],{"class":155},":\n",[52,809,811],{"class":54,"line":810},20,[52,812,813],{"class":434},"                break\n",[52,815,817,820,822,825,827,830,833,836],{"class":54,"line":816},21,[52,818,819],{"class":438},"            time",[52,821,501],{"class":155},[52,823,824],{"class":581},"sleep",[52,826,549],{"class":155},[52,828,829],{"class":229},"2",[52,831,832],{"class":623}," **",[52,834,835],{"class":581}," attempt",[52,837,784],{"class":155},[52,839,841,844,846,849],{"class":54,"line":840},22,[52,842,843],{"class":438},"        resp",[52,845,501],{"class":155},[52,847,848],{"class":581},"raise_for_status",[52,850,851],{"class":155},"()\n",[52,853,855,857,860,862,864,866,868],{"class":54,"line":854},23,[52,856,717],{"class":434},[52,858,859],{"class":438}," collection ",[52,861,599],{"class":434},[52,863,793],{"class":438},[52,865,501],{"class":155},[52,867,148],{"class":581},[52,869,870],{"class":155},"():\n",[52,872,874,877,879,882,884,887,889,891,894,896],{"class":54,"line":873},24,[52,875,876],{"class":438},"            features",[52,878,501],{"class":155},[52,880,881],{"class":581},"extend",[52,883,549],{"class":155},[52,885,886],{"class":581},"collection",[52,888,508],{"class":155},[52,890,94],{"class":83},[52,892,893],{"class":66},"features",[52,895,94],{"class":83},[52,897,898],{"class":155},"])\n",[52,900,902,905,907,909,911,914,916],{"class":54,"line":901},25,[52,903,904],{"class":438},"        time",[52,906,501],{"class":155},[52,908,824],{"class":581},[52,910,549],{"class":155},[52,912,913],{"class":229},"1",[52,915,620],{"class":155},[52,917,918],{"class":561},"  # Build tier: one request per second\n",[52,920,922,925,927,929],{"class":54,"line":921},26,[52,923,924],{"class":434},"    return",[52,926,694],{"class":438},[52,928,214],{"class":155},[52,930,931],{"class":438}," features\n",[52,933,935],{"class":54,"line":934},27,[52,936,452],{"emptyLinePlaceholder":451},[52,938,940],{"class":54,"line":939},28,[52,941,452],{"emptyLinePlaceholder":451},[52,943,945,948,950,952,954,956,958,960,962,964,966,968,970,973,975],{"class":54,"line":944},29,[52,946,947],{"class":438},"descriptions ",[52,949,571],{"class":155},[52,951,226],{"class":155},[52,953,94],{"class":83},[52,955,17],{"class":66},[52,957,94],{"class":83},[52,959,214],{"class":155},[52,961,84],{"class":83},[52,963,21],{"class":66},[52,965,94],{"class":83},[52,967,214],{"class":155},[52,969,84],{"class":83},[52,971,972],{"class":66},"SE-22-40-14-W3",[52,974,94],{"class":83},[52,976,711],{"class":155},[52,978,980,983,985,988,990,992,994,996],{"class":54,"line":979},30,[52,981,982],{"class":438},"sent",[52,984,214],{"class":155},[52,986,987],{"class":438}," features ",[52,989,571],{"class":155},[52,991,546],{"class":581},[52,993,549],{"class":155},[52,995,553],{"class":581},[52,997,784],{"class":155},[52,999,1001],{"class":54,"line":1000},31,[52,1002,452],{"emptyLinePlaceholder":451},[52,1004,1006,1009,1011,1013,1016,1018,1020,1022,1024,1027,1029,1031,1033,1036,1039,1042,1044,1046,1048,1050,1053,1055,1057,1059,1061,1063,1065,1067,1069,1071,1074,1076,1078,1080],{"class":54,"line":1005},32,[52,1007,1008],{"class":438},"centroids ",[52,1010,571],{"class":155},[52,1012,195],{"class":155},[52,1014,1015],{"class":438},"f",[52,1017,508],{"class":155},[52,1019,94],{"class":83},[52,1021,248],{"class":66},[52,1023,94],{"class":83},[52,1025,1026],{"class":155},"][",[52,1028,94],{"class":83},[52,1030,285],{"class":66},[52,1032,94],{"class":83},[52,1034,1035],{"class":155},"]:",[52,1037,1038],{"class":438}," f ",[52,1040,1041],{"class":434},"for",[52,1043,1038],{"class":438},[52,1045,599],{"class":434},[52,1047,987],{"class":438},[52,1049,605],{"class":434},[52,1051,1052],{"class":438}," f",[52,1054,508],{"class":155},[52,1056,94],{"class":83},[52,1058,248],{"class":66},[52,1060,94],{"class":83},[52,1062,1026],{"class":155},[52,1064,94],{"class":83},[52,1066,264],{"class":66},[52,1068,94],{"class":83},[52,1070,238],{"class":155},[52,1072,1073],{"class":623}," ==",[52,1075,84],{"class":83},[52,1077,273],{"class":66},[52,1079,94],{"class":83},[52,1081,391],{"class":155},[52,1083,1085,1088,1090,1092,1095,1097,1099,1101,1104,1106,1108,1111,1114,1117],{"class":54,"line":1084},33,[52,1086,1087],{"class":438},"unmatched ",[52,1089,571],{"class":155},[52,1091,226],{"class":155},[52,1093,1094],{"class":438},"d ",[52,1096,1041],{"class":434},[52,1098,596],{"class":438},[52,1100,599],{"class":434},[52,1102,1103],{"class":438}," sent ",[52,1105,605],{"class":434},[52,1107,596],{"class":438},[52,1109,1110],{"class":623},"not",[52,1112,1113],{"class":623}," in",[52,1115,1116],{"class":438}," centroids",[52,1118,711],{"class":155},[11,1120,1121,1122,1125,1126,1128,1129,1132],{},"Three details in this sketch matter in production. First, duplicates are removed before sending, because a register often lists the same quarter section many times and each record counts against your quota. Second, the job waits between requests and retries when the API returns ",[15,1123,1124],{},"429",". A ",[15,1127,1124],{}," can also mean the monthly quota is used up, and retrying will not fix that. Third, ",[15,1130,1131],{},"unmatched"," is kept as its own list, so a wrong meridian or a transposed township shows up in a report instead of disappearing from the map.",[11,1134,1135,1136,1139,1140,1143],{},"If your pipeline is in Python, the ",[15,1137,1138],{},"townshipcanada"," package on PyPI wraps the same endpoint. Its ",[15,1141,1142],{},"batch_search"," method splits lists longer than 100 into chunks for you.",[27,1145,1147],{"id":1146},"plan-the-volume","Plan the volume",[11,1149,1150],{},"The Batch API is its own subscription, separate from the Search API. Quotas count requests, and each request can carry up to 100 descriptions:",[1152,1153,1154,1173],"table",{},[1155,1156,1157],"thead",{},[1158,1159,1160,1164,1167,1170],"tr",{},[1161,1162,1163],"th",{},"Tier",[1161,1165,1166],{},"Price",[1161,1168,1169],{},"Requests per month",[1161,1171,1172],{},"Rate limit",[1174,1175,1176,1191,1205],"tbody",{},[1158,1177,1178,1182,1185,1188],{},[1179,1180,1181],"td",{},"Build",[1179,1183,1184],{},"$40\u002Fmonth",[1179,1186,1187],{},"1,000",[1179,1189,1190],{},"1 request\u002Fsecond",[1158,1192,1193,1196,1199,1202],{},[1179,1194,1195],{},"Scale",[1179,1197,1198],{},"$200\u002Fmonth",[1179,1200,1201],{},"10,000",[1179,1203,1204],{},"5 requests\u002Fsecond",[1158,1206,1207,1210,1213,1216],{},[1179,1208,1209],{},"Enterprise",[1179,1211,1212],{},"$1,000\u002Fmonth",[1179,1214,1215],{},"100,000",[1179,1217,1218],{},"Higher",[11,1220,1221,1222,501],{},"With full chunks, a Build key covers up to 100,000 descriptions a month. A nightly job that sends only new or changed records uses far less than that. A one-time backfill of a large register finishes faster on Scale, which allows five requests a second. Current prices and tiers are on the ",[411,1223,1225],{"href":1224},"\u002Fapi","API page",[27,1227,1229],{"id":1228},"use-the-geojson-where-you-already-work","Use the GeoJSON where you already work",[11,1231,1232],{},"Write the boundary features to a GeoJSON file, which QGIS, ArcGIS Pro, and PostGIS can all read:",[43,1234,1236],{"className":425,"code":1235,"language":427,"meta":48,"style":48},"import json\n\nboundaries = [f for f in features if f[\"properties\"][\"shape\"] == \"grid\"]\nwith open(\"records.geojson\", \"w\") as fh:\n    json.dump({\"type\": \"FeatureCollection\", \"features\": boundaries}, fh)\n",[15,1237,1238,1245,1249,1302,1338],{"__ignoreMap":48},[52,1239,1240,1242],{"class":54,"line":55},[52,1241,435],{"class":434},[52,1243,1244],{"class":438}," json\n",[52,1246,1247],{"class":54,"line":77},[52,1248,452],{"emptyLinePlaceholder":451},[52,1250,1251,1254,1256,1258,1261,1263,1265,1267,1269,1271,1273,1275,1277,1279,1281,1283,1285,1287,1289,1291,1293,1295,1298,1300],{"class":54,"line":99},[52,1252,1253],{"class":438},"boundaries ",[52,1255,571],{"class":155},[52,1257,226],{"class":155},[52,1259,1260],{"class":438},"f ",[52,1262,1041],{"class":434},[52,1264,1038],{"class":438},[52,1266,599],{"class":434},[52,1268,987],{"class":438},[52,1270,605],{"class":434},[52,1272,1052],{"class":438},[52,1274,508],{"class":155},[52,1276,94],{"class":83},[52,1278,248],{"class":66},[52,1280,94],{"class":83},[52,1282,1026],{"class":155},[52,1284,94],{"class":83},[52,1286,264],{"class":66},[52,1288,94],{"class":83},[52,1290,238],{"class":155},[52,1292,1073],{"class":623},[52,1294,84],{"class":83},[52,1296,1297],{"class":66},"grid",[52,1299,94],{"class":83},[52,1301,711],{"class":155},[52,1303,1304,1307,1310,1312,1314,1317,1319,1321,1323,1326,1328,1330,1333,1336],{"class":54,"line":113},[52,1305,1306],{"class":434},"with",[52,1308,1309],{"class":574}," open",[52,1311,549],{"class":155},[52,1313,94],{"class":83},[52,1315,1316],{"class":66},"records.geojson",[52,1318,94],{"class":83},[52,1320,214],{"class":155},[52,1322,84],{"class":83},[52,1324,1325],{"class":66},"w",[52,1327,94],{"class":83},[52,1329,620],{"class":155},[52,1331,1332],{"class":434}," as",[52,1334,1335],{"class":438}," fh",[52,1337,807],{"class":155},[52,1339,1340,1343,1345,1348,1350,1352,1354,1356,1358,1360,1362,1364,1366,1368,1370,1372,1374,1377,1380,1382],{"class":54,"line":258},[52,1341,1342],{"class":438},"    json",[52,1344,501],{"class":155},[52,1346,1347],{"class":581},"dump",[52,1349,578],{"class":155},[52,1351,94],{"class":83},[52,1353,166],{"class":66},[52,1355,94],{"class":83},[52,1357,171],{"class":155},[52,1359,84],{"class":83},[52,1361,134],{"class":66},[52,1363,94],{"class":83},[52,1365,214],{"class":155},[52,1367,84],{"class":83},[52,1369,893],{"class":66},[52,1371,94],{"class":83},[52,1373,171],{"class":155},[52,1375,1376],{"class":581}," boundaries",[52,1378,1379],{"class":155},"},",[52,1381,1335],{"class":581},[52,1383,784],{"class":155},[11,1385,1386,1387,1390,1391,1395,1396,1400,1401,1404,1405,1407,1408,1412],{},"QGIS opens a ",[15,1388,1389],{},".geojson"," file directly as a vector layer. In ArcGIS Pro, the ",[1392,1393,1394],"strong",{},"JSON To Features"," tool converts it to a feature class. For desk lookups inside ArcGIS Pro, the ",[411,1397,1399],{"href":1398},"\u002Flearn\u002Fhow-to\u002Farcgis-pro-legal-land-description-locator","ArcGIS Pro locator"," runs on the Township Canada API too. In a database, PostGIS reads each geometry with ",[15,1402,1403],{},"ST_GeomFromGeoJSON",", so you can load the centroids and boundaries next to the source table and join them on ",[15,1406,285],{},". If the records already live in Snowflake, the ",[411,1409,1411],{"href":1410},"\u002Fguides\u002Fsnowflake-external-function","Snowflake external function guide"," shows how to call the Batch API from SQL without leaving the warehouse.",[27,1414,1416],{"id":1415},"keys-and-environments","Keys and environments",[11,1418,1419,1420,501],{},"Keep the API key in an environment variable or your platform's secret store, not in the job's source code. The sketch above reads it from ",[15,1421,513],{},[11,1423,1424],{},"Each Township Canada API key is its own subscription, with its own tier and monthly quota. This means a test run in a staging pipeline cannot use up the production job's requests if each environment has its own key. It also means you can size each key to its job: a Build key for nightly updates, and a Scale key for the backfill that runs once.",[1426,1427,1428],"style",{},"html pre.shiki code .sYn-s, html code.shiki .sYn-s{--shiki-light:#E2931D;--shiki-default:#59873A;--shiki-dark:#80A665}html pre.shiki code .sz9Cv, html code.shiki .sz9Cv{--shiki-light:#91B859;--shiki-default:#A65E2B;--shiki-dark:#C99076}html pre.shiki code .sTbE_, html code.shiki .sTbE_{--shiki-light:#91B859;--shiki-default:#B56959;--shiki-dark:#C98A7D}html pre.shiki code .se3Ec, html code.shiki .se3Ec{--shiki-light:#90A4AE;--shiki-default:#A65E2B;--shiki-dark:#C99076}html pre.shiki code .sbYkP, html code.shiki .sbYkP{--shiki-light:#39ADB5;--shiki-default:#B5695977;--shiki-dark:#C98A7D77}html pre.shiki code .su_V2, html code.shiki .su_V2{--shiki-light:#90A4AE;--shiki-default:#B56959;--shiki-dark:#C98A7D}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .soVBu, html code.shiki .soVBu{--shiki-light:#39ADB5;--shiki-default:#999999;--shiki-dark:#666666}html pre.shiki code .s4Jsk, html code.shiki .s4Jsk{--shiki-light:#39ADB5;--shiki-default:#99841877;--shiki-dark:#B8A96577}html pre.shiki code .sLorS, html code.shiki .sLorS{--shiki-light:#9C3EDA;--shiki-default:#998418;--shiki-dark:#B8A965}html pre.shiki code .sa2tF, html code.shiki .sa2tF{--shiki-light:#E2931D;--shiki-default:#998418;--shiki-dark:#B8A965}html pre.shiki code .s7CZa, html code.shiki .s7CZa{--shiki-light:#F76D47;--shiki-default:#2F798A;--shiki-dark:#4C9A91}html pre.shiki code .siDh9, html code.shiki .siDh9{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#1E754F;--shiki-default-font-style:inherit;--shiki-dark:#4D9375;--shiki-dark-font-style:inherit}html pre.shiki code .sftqT, html code.shiki .sftqT{--shiki-light:#90A4AE;--shiki-default:#393A34;--shiki-dark:#DBD7CAEE}html pre.shiki code .sBPpx, html code.shiki .sBPpx{--shiki-light:#E53935;--shiki-default:#393A34;--shiki-dark:#DBD7CAEE}html pre.shiki code .s5Kfy, html code.shiki .s5Kfy{--shiki-light:#9C3EDA;--shiki-default:#AB5959;--shiki-dark:#CB7676}html pre.shiki code .sljsM, html code.shiki .sljsM{--shiki-light:#6182B8;--shiki-default:#59873A;--shiki-dark:#80A665}html pre.shiki code .sCyAa, html code.shiki .sCyAa{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#393A34;--shiki-default-font-style:inherit;--shiki-dark:#DBD7CAEE;--shiki-dark-font-style:inherit}html pre.shiki code .s9Tkl, html code.shiki .s9Tkl{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#A0ADA0;--shiki-default-font-style:inherit;--shiki-dark:#758575DD;--shiki-dark-font-style:inherit}html pre.shiki code .sJdAF, html code.shiki .sJdAF{--shiki-light:#6182B8;--shiki-default:#998418;--shiki-dark:#B8A965}html pre.shiki code .siWMO, html code.shiki .siWMO{--shiki-light:#6182B8;--shiki-default:#393A34;--shiki-dark:#DBD7CAEE}html pre.shiki code .sVsLi, html code.shiki .sVsLi{--shiki-light:#39ADB5;--shiki-default:#AB5959;--shiki-dark:#CB7676}html pre.shiki code .s6DHA, html code.shiki .s6DHA{--shiki-light:#6182B8;--shiki-default:#A65E2B;--shiki-dark:#C99076}html pre.shiki code .sqOPj, html code.shiki .sqOPj{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#B07D48;--shiki-default-font-style:inherit;--shiki-dark:#BD976A;--shiki-dark-font-style:inherit}",{"title":48,"searchDepth":77,"depth":77,"links":1430},[1431,1432,1433,1434,1435],{"id":29,"depth":77,"text":30},{"id":418,"depth":77,"text":419},{"id":1146,"depth":77,"text":1147},{"id":1228,"depth":77,"text":1229},{"id":1415,"depth":77,"text":1416},"guides",null,"2026-11-16","Send DLS, LSD, and NTS descriptions from an ETL job to the Township Canada Batch API and get GeoJSON parcel boundaries and centroids back.","md",{},"\u002Fblog\u002Fbatch-api-government-gis-pipeline-legal-land-descriptions",{"title":5,"description":1439},"blog\u002Fbatch-api-government-gis-pipeline-legal-land-descriptions",[1446,1447,1448,1449,1450],"Batch API","GIS","Government","Developer","GeoJSON","b5aZ9sduewhUWMhBgkJwpbj4Suh9Hj_pHnAaSSswFNM"]