Thursday, June 3, 2010

Nothing is Impossible - Not Even Converting State Plane Coordinates to Geodetic

Who on earth would use the State Plane Coordinate System (SPCS)? Someone who wants speed and accuracy as it turns out. Recently having been waiting in the wings while a new Computer Aided Dispatch (CAD) software was deployed at my agency, I finally got to get into the muck up to my elbows, and this coordinate system unfamiliar to myself was the first tree I tripped over. I recalled several weeks ago overhearing a conversation in the next cube regarding something about a state based system being used and I remember becoming a little uneasy. The original data conversion from the old CAD was just some simple SQL parsing (figure 1) , but this one sounded as if it would involve some more elaborate calculations, possibly lookups, projections, zones, maybe even algorithms...arg, definitely over my head.

First thing I was brought up to speed on was that I needed to simply divide the integer by 100 to obtain a usable coordinate. Thinking back to my initial impression of the sample data I had seen, had it been that simple I was sure I would have recognized it. I did not spot the familiar leading 45/-122 of lat/long or the leading 10 of UTM's in the Pacific Northwest or more specifically Southwest Washington and Northwest Oregon. I tried it anyway and suspected I might be just losing precision.

Next I called the county GIS guy. He certainly had the answers, but it seemed they would take longer to convey to me than there was time in the work week. What I did get out of it was that the new CAD system and the county used the very standard State Plane Coordinate System and it was possible that we could batch convert the data somehow to salvage my many Google Earth clinical and operational Emergency Medical Services mapping applications. He would look into it further and get back with me.

But I couldn't wait. If it was doable, I surmised that I could surely do it. Just knowing it was possible was enough to send me searching for solutions. The first few Google Searches yielded surprisingly little information, but one link lead to another and next thing I knew I found myself at the National Oceanic and Atmospheric Administration (NOAA) web site in their highly secret or at least certainly hidden Geodetic Toolkit where I saw exactly what I was looking for - a utility to convert between Geodetic Positions and State Plane Coordinates. Actually I was really hoping for a simple little formula I could employ in a SQL Stored Procedure, but this was certainly the next best thing.

Upon launching the download link I saw that the executable was in FORTRAN and I had no clue if Windows even runs what I assume to be a FORTRAN executables. Was FORTRAN even still in circulation?! Turns out, FORTRAN is a scientific and engineering community staple and particularly suited to weather, and geocode modeling applications and other numeric and scientific computation heavy programs.

Still wondering if I needed some big UNIX mainframe or some equally imposing and archaic piece of hardware but I downloaded the application, extracted it onto my Windows Professional and launched it from the command line. Seriously it was that easy! It came with a handy-dandy user guide albeit written in major Geek Speak (of which I am only vaguely coherent).

I started experimenting with the non-delimited (fixed length?) inputs and within the hour had some outputs that almost started resembling bona fide decimal lat/longs. Grant you, some versions landed me in Idaho, and some in the Pacific Ocean where I would get an error telling me I was not using the correct state and zone code...duh. I am still not certain I am feeding the SPCS values in correctly with the implied decimals in the correct location, but I am certainly feeling optimistic and with a little more GIS help I think I can schedule a job and make this thing happen. All in a days work.

You can play with NOAA's interactive web version here. If you have any questions about my project or how it is used for our Emergency Medical Services program, or better yet, if you have any suggestions on how I can do this better/easier please do get in touch.

Figure 1 - Figure 1 - Google Earth ready from varchar (- + '-' + LEFT (m.Longitude, 3) + '.' + RIGHT (m.Longitude, 6) + ',' + LEFT (m.Latitude, 2) + '.' + RIGHT (m.Latitude, 6))

No comments:

Post a Comment