|
POST
|
Sorry you were completely right about that, and to boot its faster since you aren't setting a variable each time.
... View more
03-18-2015
10:15 AM
|
0
|
0
|
1465
|
|
POST
|
actually FID is a numeric field, so a str(i) there would crash the query clause, since its comparing a number to a string. I made some sample data and tested the following that works. import arcpy
arcpy.env.workspace = "c:/Wing/Sk"
for i in range(0, 50):
where_clause = "FID = {}".format(i)
arcpy.FeatureClassToFeatureClass_conversion("spatially50", "c:/Wing/Sk", "pnt" + str(i), where_clause) Formatting queries in python can be annoying, string formatting makes this much easier. I usually refer back to this thread for properly creating SQL queries Python - Select by attributes query issue
... View more
03-18-2015
09:56 AM
|
2
|
2
|
1465
|
|
POST
|
If you are needing to make a new shapefile, then you are using the wrong geoprocessing tool. Make Feature Layer creates a layer in memory for use in a map document, not a new shapefile. Try using Feature Class to Feature Class tool, this can create new shapefiles on your hard drive. Also if you are having an error in your code, please post the error so it helps us understand what is going wrong.
... View more
03-18-2015
08:37 AM
|
1
|
1
|
4118
|
|
POST
|
In Data Frame options, there is an option to clip a data frame to a features extent. Check this old thread about some limitations of this(like no raster data in non-rectangular data frames)
... View more
03-18-2015
07:59 AM
|
1
|
0
|
802
|
|
POST
|
I figured this was part of a larger project, but I only had what you mentioned to work with so I responded based on that. Since you are probably working on this for a paper, you couldn't post everything so its understandable. I am by no means an expert on anything Africa, so I'm sure you have a much greater understanding of the factors that are driving this than I. Best of luck on your research, and I would love to see your finished paper/project once its completed.
... View more
03-16-2015
02:01 PM
|
0
|
1
|
4471
|
|
POST
|
Hi Theo, I think that if you could obtain water quality data from different points along the river systems, then it would support the correlation between clean water vs affluency, rather than stream length. While you might assume that water quality is reduced as stream length increases, its not always evident and not always true, a confluence of a "dirtier" branch with a "clean" branch of a stream can result in better water quality downstream of the "dirtier branch" even if its stream length is lower. Also, while there might be correlation between affluency and water quality, that does not mean that water quality is a cause of affluent areas developing in these regions. A cursory look at the Nairobi area shows that slums generally look to be in flatter terrain areas, which are easier to widespread cheap development and are closer to the city center, while affluent areas tend to have rougher terrain, indicating an increased cost of development that only wealthier people could afford. It also follows trends in urbanization where in many cases a cities elite will move to the outskirts of a city to undeveloped areas, or areas that are not as cheap to develop in order to avoid the incursion of lower income in their communities. What criteria are you using for defining slums and wealthy areas that you used to digitize out features?
... View more
03-16-2015
12:33 PM
|
2
|
3
|
4471
|
|
POST
|
The other important thing to notice about UpdateCursors is that when you want to update the value of field, you actually need to set its value, using the rows index value from the cursor. Once you set all the values, you then use cursor.updateRow(row) to update all the values in that row, not individually like I believe you were trying in your code. You could have used two cursors, but that makes it fairly slower. If this was a first attempt at using cursors, it was a good try. Darren Wiens, since it returns SHAPE@XY as a tuple in his original code, he shouldn't have been able to adjust the features centroid since tuples are immutable correct, or does an update cursor allow you to update SHAPE@XY? Curious if you know, if not I might investigate some.
... View more
03-13-2015
08:57 AM
|
1
|
1
|
3432
|
|
POST
|
You shouldn't need to combine cursors. You can use the update cursor to check the value of your direction field, then depending on the value of the direction field. import arcpy
mxd = arcpy.mapping.MapDocument("CURRENT")
arcpy.env.overwriteOutput = True
fc = arcpy.GetParameterAsText(0)
NWxOffset = 200
NWyOffset = 200
NExOffset = -220
NEyOffset = -200
fields = ["direction" , "SHAPE@X", "SHAPE@Y"]
with arcpy.da.UpdateCursor(fc, fields) as cursor:
for row in cursor:
if row[0] == "NW":
row[1] += NWxOffset
row[2] += NWyOffset
elif row[0] == "NE":
row[1] += NExOffset
row[2] += NEyOffset
cursor.updateRow(row)
arcpy.RefreshActiveView
... View more
03-13-2015
08:39 AM
|
1
|
0
|
3432
|
|
POST
|
It technically still is missing some spatial information, it does not have have a spatial reference, so it can't be projected, but it can work in a geographic coordinate system. I made a new map document and selected a Geographic Coordinate System (WGS 1984) and it came in just fine. I have a screenshot comparing it to a world boundaries shapefile with thats in WGS 1984 and they line up fine. Note: I used the values Vince posted for the worldfile.
... View more
03-11-2015
09:47 AM
|
0
|
0
|
7357
|
|
POST
|
I could make one just fine. Are you trying to add this to an existing map, or to a new map?
... View more
03-11-2015
09:29 AM
|
0
|
2
|
7357
|
|
POST
|
Are you trying to just bring in the world file, because you can't just bring in a world file into ArcGIS. Try removing the .gif from your map, and then bringing it back in again now that you have a world file for your image. ArcGIS should recognize that the .gif has a .gfw with it in the same directory include the spatial reference information. Kinda how when you bring in a shapefile, you only see the .shp in catalog but it knows to bring the .shx, .sbx, .dbf, etc. as well for the complete file. If you try to bring in one of the other components from say windows explorer, it doesn't count as a valid file type.
... View more
03-11-2015
08:24 AM
|
0
|
0
|
7357
|
|
POST
|
To access your map document and be able to export it out, you would need to use the arcpy.mapping module. It is fairly easy to export out your data view and set a scale for the dataframe, I guess my question would be do you have a kml for each tile, or are they one large dataset? If they are a large dataset, you would need to probably make an index(grid) shapefile and you could have the script loop over each box in the grid zoom to it then export out the data view. If you are still needing help with this, if you could give a little more info, and the workflow you are needing, that would be great. I have a similar script for something like this where some of my co-workers need georeferenced imagery for autocad with arcgis layers saved to the dataview and they select the polygon they need by the ID number, I could give you a good starter script to work off of.
... View more
03-06-2015
12:45 PM
|
1
|
1
|
1213
|
|
POST
|
Your initial question was somewhat vague. Are you needing to mosaic multiple images together? run image analysis on images? Are they already Georeferenced or do they need georeferencing? If you could be a bit more specific about the project you are needing to do, it would help us find an answer.
... View more
03-06-2015
10:22 AM
|
0
|
9
|
2237
|
|
POST
|
Here is an older topic for you to take a look at about the problems with Dissolve with medium to large datasets. It could be useful. Solution to: Dissolve tool does not fully dissolve medium-size dataset
... View more
03-04-2015
11:24 AM
|
0
|
0
|
2674
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 02-22-2017 08:58 AM | |
| 1 | 10-05-2015 05:43 AM | |
| 1 | 05-08-2015 07:03 AM | |
| 1 | 10-20-2015 02:20 PM | |
| 1 | 10-05-2015 05:46 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:23 AM
|