Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 1 Use a feature class of your own and write a Python program ( using arcpy ) to print out the following information for

Question 1
Use a feature class of your own and write a Python program (using arcpy) to print out the following information for all the fields: name,
type, length, and, if the field is float (Single or Double), scale and precision. Hint: we used the name of each field in the tutorial already.
You must use
for this exercise. There are more properties in the field, and you can use the help function, such
as help(fields[0]), to see how to use them, or you can see more information about field here G. Submit your code in .py and include the
result of the printout as comments.
Question 2
In QGIS, if we load the same shapefile twice, the two layers will share exactly the same name in the Layers panel. Write a Python
program to first test if there are duplicated layer names in the panel. If there are duplicated layer names, the program should post a log
message (something like "There are duplicated layer names and I will fix this!") and then systematically change the duplicated names so
they are unique. One simple way to do this is to add a number to the end of an existing name. For example, if we have two appearances
of
, we will change them to
and public_library_shp 2. But you can come up with your own ways to
address this issue. There might be multiple cases of duplicated names and the program should be able to change their names accordingly.
For example, if we have two layers called
and three layers called
, we should change them
to
, public_library_shp 2, county_boundary 1,
, and
county_boundary 3, respectively. After you are
done, push a message (like "I am done!") to the message bar. Make sure the message bar lasts for 6 seconds.
Submit your code in a .py file and then a screenshot of QGIS showing the result of running your program with the log message. The
following shows how the code works. If we have layers listed like something on the left, our code should change it to something like the
one on the right.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Relational Database And SQL

Authors: Lucy Scott

3rd Edition

1087899699, 978-1087899695

More Books

Students also viewed these Databases questions

Question

Provide examples of Dimensional Tables.

Answered: 1 week ago