![]() # define a spatial reference, edit this !!! List_fields = (fld_oid_in, sp_name, com_name, grid_ref, loc, date, abund, comment) # add/remove according to sourceįc_out = r"G:\Active contract work\P22-01 NWD AONB heathland project\2022\Maps\NWDspecies.gdb\squares" Tbl = r'G:\Active contract work\P22-01 NWD AONB heathland project\2022\Maps\NWDspecies.gdb\TVrecords20220818_XYTableToPoint' Square = arcpy.Polygon(arcpy.Array(corners),SR) Tet_E = (tet_num//5) # calculates column 0:4 of letterĮast, North, Precision = GR_convert(gridref)Ĭorners.append(arcpy.Point(East+Precision, North))Ĭorners.append(arcpy.Point(East+Precision, North+Precision))Ĭorners.append(arcpy.Point(East, North+Precision)) Tet_N = (tet_num) % 5 # calculates row 0:4 of letter If tet_num >= 14: # No O so subtracts 1 from P to Z Tet_num = ord(tet_lett) - ord('A') # position of 2nd letter in alphabet -1 (A=0, Z=25) Northing = (N1*100000) + (North_Num * PGR) # calculates Northing. North_Num = int(GR) #takes northing numberĮasting = (E1*100000) + (East_Num * PGR) # calculates Easting N1 = 4 - (GRnum2//5) # calculates row 0:4 of letterĮast_Num = int(GR) # takes easting number If GRnum2 >= 8: # No I so subtracts 1 from J to ZĮ1 = GRnum2 % 5 # calculates column 0:4 of letter GRnum2 = ord(GR) - ord('A') # position of 2nd letter in alphabet -1 (A=0, Z=25) PGR = 10**(5-FGR) # precision - 100 for dummy ![]() Uses a point layer and creates a polygon layer with squares of different siz def GR_convert(GR): # dummy value SP123456įGR = int(LGR/2) -1 # figures in easting/northing, e.g 3 for dummy From an ARCGIS Pro Notebook, with 3 functions, one to convert the grid reference value into easting, northing and size one for the special case of 2km tetrads one to create the polygon and the main block to create the layer using cursors, which was largely based on the example provided in the link in the first line. Could probably be more elegant but seems to work. I needed an answer to this but couldn't find one, so put this together. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |