Did you know that the cursor object is not the little line that follows your typing on the screen?
It's the Cursor combo tools that really add some power to the scripting methods of obtaining information from layer files, tables and spatial data. These little search & find pac mans give you the keys to open, find, replace, add, and mix up your data from one file to another.
However, if you do not know how it's typed, you could be sunk. Then again, the cursor object can help you find it to write it correctly in the code.
It has taken me to this point to really get the combinations of our pieces learned up to now to have some of those, "I got it" moments.
Keys to remember when performing programing.
1- How it's typed matters.
2- Where it is, is important.
3- Scripts only read what I write into them.
4- Google can be my friend if I can figure out what to call it to search it.
5- Try things more than one way, with more than one result in mind.
6- As long as there is a copy of the original somewhere you can get to,... then trying new things will most likely not kill it.
In the end, the presentation of Module 8 was great. The lessons were clearly building on one another with smaller snippets of information. At the end in a shorter time block, I was able to get a running code. We pulled out a list of fields in a data layer, added to fields to a second data layer, used a prefab calculation on data from the first fields, and was a able to enter the prefab calculations into the new fields in the second data layer. These worked.
Prof Terhune provided us the calculation code. (It calculated the number of bird coveys for bobwhites). For those who are inspecting the projections, we did not intend for the map & data files to match. We were only interested in finding fields, calculating & populating the new fields. Visualizing the results as the code progressed was a confidence builder.
Ending the semester on a successful note is a smooth sound to carry forward.
Showing posts with label GIS Programming. Show all posts
Showing posts with label GIS Programming. Show all posts
Saturday, August 4, 2012
Monday, July 30, 2012
Mod7- Finally, The lights are ON. Productive things to do.
Module 7, Part A.
We created a folder structure on the computer. How cool is that. This was a connection section. We walked through the code process of creating a directory, adding file folders, and a simple tool box for scripts. It was good to see many little parts actually come together and be useful. If one needed to do this as a regular part of their job, this little code (which took several hours to do) can save days worth of time in a year for a company.
Part B. It's called the Describe Method (dsc). Really, its like pulling out parts & pieces out of a file layers properties. One can "call up" things like extent. Extent in the common world would be how wide and how deep a camera lens covers a panorama. One can ask the type of file- it is a line, polygon or dot( point) file, without having to go find it. Then again, we can ask through the code if the file we are looking for even exists- that is if you know it's name.
Part C. Do you like list? We learned to call up lists. There are list of nearly everything. Need a list of layers on a map, there's a list for that. Need to know how many data fields are in your map layer or even what they are without having to put up the file & thumb through them. Then the list thing is your thing to learn. Apparently, once mastered, it can be an enormous time saver.
Useful things were learned. Some code was written, some parts more successful than others.
Just when we start getting in the swing of the semester to learn real stuff, time is about to crunch on us with too much to learn, too little time.
We created a folder structure on the computer. How cool is that. This was a connection section. We walked through the code process of creating a directory, adding file folders, and a simple tool box for scripts. It was good to see many little parts actually come together and be useful. If one needed to do this as a regular part of their job, this little code (which took several hours to do) can save days worth of time in a year for a company.
Part B. It's called the Describe Method (dsc). Really, its like pulling out parts & pieces out of a file layers properties. One can "call up" things like extent. Extent in the common world would be how wide and how deep a camera lens covers a panorama. One can ask the type of file- it is a line, polygon or dot( point) file, without having to go find it. Then again, we can ask through the code if the file we are looking for even exists- that is if you know it's name.
Part C. Do you like list? We learned to call up lists. There are list of nearly everything. Need a list of layers on a map, there's a list for that. Need to know how many data fields are in your map layer or even what they are without having to put up the file & thumb through them. Then the list thing is your thing to learn. Apparently, once mastered, it can be an enormous time saver.
Useful things were learned. Some code was written, some parts more successful than others.
Just when we start getting in the swing of the semester to learn real stuff, time is about to crunch on us with too much to learn, too little time.
Wednesday, July 11, 2012
Debugging Python, Get a big can of RAID!
Writing a program is fairly simple, if you're writing one for a social event, planning a trip or some other pleasant occasion. Writing a computer program can be an adventure. Did anyone tell you that it had to be de=bugged if something goes wrong, and it will, you can count on it (song comes to mind here, several of them).
There are several better practices to writing a program. Think it out first, draw a picture, do a map (they call these model), ponder over it, then put it to paper. Whatever you write, save, save, save, (there's a local commericial out there for this one). Did I say save? Then run a few lines at a time, write yourself enormous notes using these little #### things. Tell yourself and others what you expect the program to give back to you for each section.
Type s l o w l y, and accurately. Looking for typing mistakes is called syntax errors. Finishing the lines of thought include punctuation ( [ " " ] } oops see there's one now. A syntax is running rampant. It should have looked like ( [ " " ] ). It's a good idea to study your file path. You need to know where you're going. Did you leave enough crumbs to follow? Draw a picture if you need to show how the flow of files, variables and pieces connect together.
A picture can show the next issue out there: no logic.
The most hidden of all things to fix are logical errors. Best said: well, I meant to say it this way but it came out the other.
Some logic errors are in the order of presentation. We need to tell the computer the definitions first before it can describe something. Others are in the methods. These are probably the hardest to find; especially for a newbie like me. I know nothing so how am I supposed to know that something was to go there when I knew nothing about it to begin with. For those of us who do not perform any math other than everyday things, verbalizing math on paper can be well .....................
Then there are the tools to help you find out your errors. Idle has a line by line thing which is good.
There's the pywin debugger which looks more window oriented. How it's applied I'm not really sure. Then there's the pdb thing. It's messy, maybe it works good, but how, I'm not able to tell you today. Maybe later when I'm more familiar with a little more practice.
There are bugs in python. Some are big, some are small. They can all be killed with RAID. But RAID will not make your program sing like a bird that a python would rather eat.
Enough for now. more later.
There are several better practices to writing a program. Think it out first, draw a picture, do a map (they call these model), ponder over it, then put it to paper. Whatever you write, save, save, save, (there's a local commericial out there for this one). Did I say save? Then run a few lines at a time, write yourself enormous notes using these little #### things. Tell yourself and others what you expect the program to give back to you for each section.
Type s l o w l y, and accurately. Looking for typing mistakes is called syntax errors. Finishing the lines of thought include punctuation ( [ " " ] } oops see there's one now. A syntax is running rampant. It should have looked like ( [ " " ] ). It's a good idea to study your file path. You need to know where you're going. Did you leave enough crumbs to follow? Draw a picture if you need to show how the flow of files, variables and pieces connect together.
A picture can show the next issue out there: no logic.
The most hidden of all things to fix are logical errors. Best said: well, I meant to say it this way but it came out the other.
Some logic errors are in the order of presentation. We need to tell the computer the definitions first before it can describe something. Others are in the methods. These are probably the hardest to find; especially for a newbie like me. I know nothing so how am I supposed to know that something was to go there when I knew nothing about it to begin with. For those of us who do not perform any math other than everyday things, verbalizing math on paper can be well .....................
Then there are the tools to help you find out your errors. Idle has a line by line thing which is good.
There's the pywin debugger which looks more window oriented. How it's applied I'm not really sure. Then there's the pdb thing. It's messy, maybe it works good, but how, I'm not able to tell you today. Maybe later when I'm more familiar with a little more practice.
There are bugs in python. Some are big, some are small. They can all be killed with RAID. But RAID will not make your program sing like a bird that a python would rather eat.
Enough for now. more later.
Saturday, June 30, 2012
Ok, so the snake isn't so slimy afterall. Mod4
First off our instructor really went the extra mile with the lecture. It was a full 156 minutes with two significant demo sessions. Our lecture slides were full of good "do able" information. If one compared the Exercises there was significant realistic get it accomplished information. Let's give Theron a hugh Thanks!
For this newbie at least some of it is beginning to make sense. Truly it is comparable to learning a new language. At least I'm not as lost as I was and can find the door better than the bear in Assignment 4c, that was a crazy insanity python loop joke, I think.
Some tips of significance.
a) Save your work if you can.
b) Print out windows of the Idle to learn how you did that cause many times, it gets lost in
translation. By doing the printout, I began to see my common typing mistakes which
result in simple time eating syntax errors. Also I began to see in print how to correct
other more significant issues.
c) Type slower, get a pair of better glasses. The . and , look the same late at night but are
not the same to the computer.
d) CaseSensitivity. Ugh this program just can not suck it up and get along, it must have its
way specifically. A diva in disguise.
e) Looking help up on the internet can be a challenge. Learning what to call it that I'm not
figuring out it a stretch.
f) Usually when I think I"m the only one, there is someone else out there who is also too
embarrassed to ask because it seems so small an issue which is eating me alive (the snake
has a big mouth).
g) I'm not a quitter, I'm determined and will eat anything alive to figure it out. So, don't take
anything personal, it's just the learning process here.
Other tips with the program.
1- Indentation, it matters.
2- Case Sensitive , said this already.
3- One tenny tiny thing will cause it not to "go" in my language.
4- Running one line at a time in a script is a good plan to catch mistakes, correct in the dual
script window and correct at the same time.
5- Naming files & scripts clearer than data to what it did or accomplished, easier to find later.
6-Using a dual screen with pywin for scripts on one side and Idle on other for running line by
line is a good combination.
7-Entering text for a long passage is a absolute pain, there must be a better way. Will find it soon.
8- If, elif else are tricky. Need indentation, can indent in the indent. Are more like the old flow charts if yes go there, if no go here, but, there is always one. They need a way out otherwise it becomes a crazy loop thing that keeps going. Like the computer at the fair that must have had a plus 1 program that was up to 205,000,000 and going.
9- One always has to tell the program what something is for it to work. Much like husbands, they are not able to read minds and the wives who think it in their head and do not get it out of their mouth to the husband who did not do it cause he did not know that he was suppose to because he did not get the memo that was not spoken by the wife who expected the husband to know what she wanted.
For this newbie at least some of it is beginning to make sense. Truly it is comparable to learning a new language. At least I'm not as lost as I was and can find the door better than the bear in Assignment 4c, that was a crazy insanity python loop joke, I think.
Some tips of significance.
a) Save your work if you can.
b) Print out windows of the Idle to learn how you did that cause many times, it gets lost in
translation. By doing the printout, I began to see my common typing mistakes which
result in simple time eating syntax errors. Also I began to see in print how to correct
other more significant issues.
c) Type slower, get a pair of better glasses. The . and , look the same late at night but are
not the same to the computer.
d) CaseSensitivity. Ugh this program just can not suck it up and get along, it must have its
way specifically. A diva in disguise.
e) Looking help up on the internet can be a challenge. Learning what to call it that I'm not
figuring out it a stretch.
f) Usually when I think I"m the only one, there is someone else out there who is also too
embarrassed to ask because it seems so small an issue which is eating me alive (the snake
has a big mouth).
g) I'm not a quitter, I'm determined and will eat anything alive to figure it out. So, don't take
anything personal, it's just the learning process here.
Other tips with the program.
1- Indentation, it matters.
2- Case Sensitive , said this already.
3- One tenny tiny thing will cause it not to "go" in my language.
4- Running one line at a time in a script is a good plan to catch mistakes, correct in the dual
script window and correct at the same time.
5- Naming files & scripts clearer than data to what it did or accomplished, easier to find later.
6-Using a dual screen with pywin for scripts on one side and Idle on other for running line by
line is a good combination.
7-Entering text for a long passage is a absolute pain, there must be a better way. Will find it soon.
8- If, elif else are tricky. Need indentation, can indent in the indent. Are more like the old flow charts if yes go there, if no go here, but, there is always one. They need a way out otherwise it becomes a crazy loop thing that keeps going. Like the computer at the fair that must have had a plus 1 program that was up to 205,000,000 and going.
9- One always has to tell the program what something is for it to work. Much like husbands, they are not able to read minds and the wives who think it in their head and do not get it out of their mouth to the husband who did not do it cause he did not know that he was suppose to because he did not get the memo that was not spoken by the wife who expected the husband to know what she wanted.
Wednesday, June 20, 2012
Learning how not to get choked by the snake
So far, I'm not doing so good with Programming. It's taking longer to learn.
I've learned Job has more patience than I do.
Typing exactly and precisely without making andy mistakes is important. (That one was on purpose
to make a point).
There are geeks who are wired to understand. I am not one.
It's now too late in the night to write or understand anything else without being rude. I did not
complete the assignment. I'm sad that I ran out of time to understand. I'll be penalized for
being incomplete. At least I was able to get one little script to run right.
Therefore, when it's hard to say anything nice, it's better to be thought wise by
closing thy mouth.
I've learned Job has more patience than I do.
Typing exactly and precisely without making andy mistakes is important. (That one was on purpose
to make a point).
There are geeks who are wired to understand. I am not one.
It's now too late in the night to write or understand anything else without being rude. I did not
complete the assignment. I'm sad that I ran out of time to understand. I'll be penalized for
being incomplete. At least I was able to get one little script to run right.
Therefore, when it's hard to say anything nice, it's better to be thought wise by
closing thy mouth.
Saturday, June 9, 2012
Here's an easy Button
The sceniero is to create an easier method for the employees to do, and do and do one of their most favorite tasks "calculate area" The solution, a python script was made into a tool on the desktop accessible toolbar. One can download this into their personal toolbar for use at anytime. Here's what it looks like. With your microscope you can see the little blue scroll appearing tool on the bottom of my tool bar sitting all by itself.

Research and development will continue to be underway for additional time saving measures.
(Source: gispro:Mod2@asgn2d).
Research and development will continue to be underway for additional time saving measures.
(Source: gispro:Mod2@asgn2d).
Subscribe to:
Posts (Atom)
