473,406 Members | 2,378 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

GIS + Python: Lists and Sublists (?)

I am a Python newbie! I'm trying to list the feature classes in a dataset (Access .MDB) and then list the fields in each feature class.

I'm able to list the feature classes and I'm able to list the fields in a particular feature class if I name it specifically. For example, PARCEL is one of the feature classes listed in the dataset return. If I put "PARCEL" in the list fields criteria I get the field information for parcels. I would like to make it so that for each feature class returned it then lists the field information after it. I envisioned doing this with the list function, a loop (listing feature classes), and a sub-loop (listing fields from the feature classes. I feel like I'm close but that there is a small tweak that can be done or a more efficient way of going about this. I have listed the code below. Any help would be appreciated!
-Ty

## Import modules
import win32com.client, os.path, sys
gp = win32com.client.Dispatch("esriGeoprocessing.GpDisp atch.1")

## Set workspace
gp.workspace = "C:\\Temp\\Zoning_Update_Final_060908.mdb"

#### List Datasets
dsList = gp.ListDatasets ("*", "all")
ds = dsList.Next()
while ds <> "":
print "DATASET:",ds
ds = dsList.Next()

## Set New workspace
gp.workspace = "C:\\Temp\\Zoning_Update_Final_060908.mdb\\Lay ers"

## List Featureclasses
fcList = gp.ListFeatureClasses ("*", "all")
fc = fcList.Next()
while fc <> "":
print fc
fc = fcList.Next()

fList = gp.ListFields ("Parcel", "*", "all")
f = fList.Next()
while f <> None:
print "NAME:",f.Name
print "TYPE:",f.Type
print "LENGTH:",f.Length
print "PRECISION:",f.Precision
print "SCALE:",f.Scale
print "NULL:",f.IsNullable
print "DOMAIN:",f.Domain
f = fList.Next()
Aug 22 '08 #1
0 993

Sign in to post your reply or Sign up for a free account.

Similar topics

21
by: Hilde Roth | last post by:
This may have been asked before but I can't find it. If I have a rectangular list of lists, say, l = ,,], is there a handy syntax for retrieving the ith item of every sublist? I know about for i...
0
by: saoirse_79 | last post by:
I have a list of lists as follows: , , ] I want to be able to read each character and compare it with all characters at the same positon in all sublists. Is this possible. I have tried a few...
41
by: Xah Lee | last post by:
here's another interesting algorithmic exercise, again from part of a larger program in the previous series. Here's the original Perl documentation: =pod merge($pairings) takes a list of...
7
by: Kay Schluehr | last post by:
I want to manipulate a deeply nested list in a generic way at a determined place. Given a sequence of constant objects a1, a2, ..., aN and a variable x. Now construct a list from them recursively:...
8
by: jerry.levan | last post by:
Hi, I have a file that contains a "tcl" list stored as a string. The list members are sql commands ex: { begin { select * from foo where baz='whatever'} {select * from gooble } end { insert...
51
by: Joerg Schoen | last post by:
Hi folks! Everyone knows how to sort arrays (e. g. quicksort, heapsort etc.) For linked lists, mergesort is the typical choice. While I was looking for a optimized implementation of mergesort...
6
by: Tekkaman | last post by:
I have a list of lists and I want to define an iterator (let's call that uniter) over all unique elements, in any order. For example, calling: sorted(uniter(, , ])) must return . I tried the...
122
by: C.L. | last post by:
I was looking for a function or method that would return the index to the first matching element in a list. Coming from a C++ STL background, I thought it might be called "find". My first stop was...
19
by: Dr Mephesto | last post by:
Hi! I would like to create a pretty big list of lists; a list 3,000,000 long, each entry containing 5 empty lists. My application will append data each of the 5 sublists, so they will be of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.