I am trying to get the script below to create x y coordinates from a field with UK national six figure grid refrence's e.g. NH935163 to 293500 816300 so I can use the add event theme to plot the points, but it isn't putting them in the right place- any idea where I'm going wrong? Or does anyone just have a script that works?
'Script to split national grid references into their x and y coordinates '***********************************************************************
thetable = av.FindDoc("kinveachy estate crow kills march-june 02.dbf")
theVtab = thetable.GetVtab xcoord = theVtab.FindField("xcoord") ycoord = theVtab.FindField("ycoord") gridref = theVtab.FindField("Gridref")
rec = 1
for each rec in theVtab gridref1 = theVtab.ReturnValue (gridref, rec)
csqr = gridref1.Left(2) sqlist = {"na","nb","nc","nd","nf","ng","nh","nj","nk","nl","nm","nn","no","nr","ns", "nt","nu","nw","nx","ny","nz"} xlist = {0,1,2,3,0,1,2,3,4,0,1,2,3,1,2,3,4,1,2,3,4} ylist = {9,9,9,9,8,8,8,8,8,7,7,7,7,6,6,6,6,5,5,5,5} sqri = sqlist.FindByValue(csqr) x = (xlist.Get(sqri)*100000) y = (ylist.Get(sqri)*100000)
valuex = gridref1.Left(6)
valuex = valuex.Right(3) valuex = valuex.AsNumber
valuey = gridref1.Right(3) valuey = valuey.AsNumber
valx = (valuex*100)+x valy = (valuey*100)+y
theVtab.SetValue (ycoord, rec, valy) theVtab.SetValue (xcoord, rec, valx)
rec = rec + 1
end
To unsubscribe, write to gislist-unsubscribe@geocomm.com ________________________________________________________________________ GeoCommunity GeoBids - less than $1 per day! Get Access to the latest GIS & Geospatial Industry RFPs and bids http://www.geobids.com
Setup a GeoCommunity Account and have access to the GISDataDepot DRG & DOQQ Catalog http://www.geocomm.com/login.php
|