POST
|
Hi Sol, Good point that a center of gravity of population may well be placed on a location where no population exists (+1 for that)... Key question remains; what is the purpose of the analysis? Kind regards, Xander
... View more
01-02-2014
10:50 AM
|
0
|
0
|
1948
|
POST
|
Hi Mary, The DEM is integer and as an integer does not have the detail te create a decent slope map. I tried to approximate what it should be; a float with decimal values by applying a Focal Statistics Mean with a Circle radius of 25 cells. If you calculate the slope on this dataset, you will find something more similar to what it should be. See the image attached (left slope on the original DEM and right slope on smoothed DEM displayed in 3D). [ATTACH=CONFIG]30190[/ATTACH] The important thing to do is, to see if you can get the data that was used to create the DEM yourself or ask the provider if they have a better (floating) version of the data. The data at this point is not useful to derive Slopes. Kind regards, Xander
... View more
01-02-2014
10:44 AM
|
0
|
0
|
1788
|
POST
|
Hi Sol, First of all thanks for the +1, and for the additional ideas you have on the matter. If I look at the original question, to me it clearly states that the density of the points is asked. The polygons are merely used to define which points should be combined to 1 center. On the other hand, we should ask Palermo what he wishes to achieve with the analysis, to be able to define what analysis suits his needs. If I look close at the picture and the name of it ("Urban_density.jpg") it sounds to me that the polygons are counties and the points are urbanizations. To get the "center of gravity" it might be more realistic to use a certain characteristic as weight; say population per point. This would result in the center of gravity of population per county. One more thought on using the outline of the polygon to determining the center; if you use for instance each vertex or equally separated points on the outline, a polygon with a lot of detail on one side (like the one center right in the picture) would pull the center of gravity towards the detailed part of the outline. I don't think this is what we want... Kind regards, Xander
... View more
01-02-2014
08:16 AM
|
0
|
0
|
1948
|
POST
|
Hi Mary, It sounds to me that the DEM may be a rather flat area and perhaps the DEM is an Integer (rounding all values). If this is the case, only when the DEM "jumps" to the next value a slope will be detected. Did you use a "Z factor"? Is it possible to post a small part of a DEM you have to see if I can detect the problem? Kind regards, Xander
... View more
01-02-2014
05:30 AM
|
0
|
0
|
1788
|
POST
|
Hi Palermo, There are several ways of doing this. For instance by following these manual steps: Make sure the point layer has X and Y as fields added to the attribute table. If you don't have them use the "Add XY Coordinates (Data Management)" tool Next use the "Spatial Join (Analysis)" tool to obtain the ID (Feature ID or any other unique ID) of the polygons for each point. Open the attribute table to the points with the joined polygons. Now do a summarize on the field that contains the polygon ID. (see more explanation in the Help topic on "Summarizing data in a table") In this summarize you will calculate the average of the POINT_X and POINT_Y fields. The output is a table that holds the field you summarize on (ID of the polygons) and the average X and Y per polygon. These are the center point coordinates based on the points per polygon. The make this spatial, use the "Make XY Event Layer (Data Management)" tool. Kind regards, Xander
... View more
01-02-2014
05:19 AM
|
0
|
0
|
1948
|
POST
|
Hi Phil, The string.isdigit() can be used to test if it is numeric. Looping through the split list (from back) will result in the first number. lstRoads = ['US Hwy 1', 'State Hwy 33 W','State Hwy 29 Bus', 'some 1 other string text with a number','yet another test with a 6 number']
for r in lstRoads:
lstr = r.split(' ')
for i in range(len(lstr)-1,-1,-1):
if lstr.isdigit():
print " - part {0} - in string '{1}' is '{2}' and this is numeric {3}".format(i,r,lstr,float(lstr))
break returns: - part 2 - in string 'US Hwy 1' is '1' and this is numeric 1.0 - part 2 - in string 'State Hwy 33 W' is '33' and this is numeric 33.0 - part 2 - in string 'State Hwy 29 Bus' is '29' and this is numeric 29.0 - part 1 - in string 'some 1 other string text with a number' is '1' and this is numeric 1.0 - part 5 - in string 'yet another test with a 6 number' is '6' and this is numeric 6.0 Please note that if a part contains a number and a character this will not be seen as numeric... Kind regards, Xander
... View more
12-23-2013
01:15 AM
|
0
|
0
|
5928
|
POST
|
Hi Matt, Sorry for the delay, but I think the expression is OK, if you change the import statement from: import arcpy,os,arcpy.sa to: import arcpy,os
from arcpy.sa import * This way the Exp function should be recognized. The alternative could be changing the line to: result = arcpy.sa.Exp(inRas * value_from_row) Kind regards, Xander
... View more
12-09-2013
09:44 PM
|
0
|
0
|
892
|
POST
|
Hi Mark, Personally I don't like models, but if you are willing to export the model to a Python script (Model\Export\To Python script) and post this using the "#" button to wrap "CODE" tags arround the code, I can have a look what may be going wrong. And when you say that the last year produces a negative number, this may have to do with Null values. For that I would need to see (part of) the data. Kind regards, Xander
... View more
12-06-2013
03:34 AM
|
0
|
0
|
1979
|
POST
|
Hi Matt, I have seen issues with Esri grids that have a name starting with a number. Could you add a character at the beginning of the name (like: "R200905_001")? I also see that the fields are named "Name", "AP" and "Q" when in the code you provided you address them as "A", "B" and "C". A, B and C and used in Excel but aren't the field names in ArcMap. Open the table in ArcMap and see what they are called. Change: fldName1 = 'A'
fldName2 = 'B'
fldName3 = 'C' To: fldName1 = 'Name'
fldName2 = 'AP'
fldName3 = 'Q' If that doesn't work run the code below and post the text that is printed to the thread (it prints out a few rows of your data and what input and output will be used). import arcpy,os
inWS = r'C:\A\B\C\EucDistRasters' # input rasters are stored here
outWS = r'C:\A\B\Test' # output rasters will be stored here
tbl = 'LOOKUP$'
fldName1 = 'Name' # field with output raster name (no path included)
fldName2 = 'AP' # field with input raster name (no path included)
fldName3 = 'Q' # multiply value field
fields = [fldName1,fldName2,fldName3]
cnt=0
with arcpy.da.SearchCursor(tbl, fields) as cursor:
for row in cursor:
cnt+=1
value_from_row = row[2]
inName = row[1]
outName = row[0]
inRasLoc = os.path.join(inWS,inName)
outRasLoc = os.path.join(outWS,outName)
print "Name={0}\tAP={1}\tQ={2}\t".format(outName,inName,value_from_row)
print " - inRasLoc ={0}".format(inRasLoc)
print " - outRasLoc={0}".format(outRasLoc)
if cnt > 5:
break
del row, tbl Kind regards, Xander
... View more
12-05-2013
11:33 PM
|
0
|
0
|
892
|
POST
|
Hi Martin, I'm glad I could be of any assistance. If you think it was helpful you can use the "arrow" button in order to help other members find useful information: More info here: http://resources.arcgis.com/en/help/forums-mvp/ Kind regards, Xander
... View more
12-05-2013
08:37 PM
|
0
|
0
|
1154
|
POST
|
Hi Matt, There is another line in your code that will create errors: outWS = r'C:\A\B\Test\' The folder should not end with a slash. It should be like this: outWS = r'C:\A\B\Test' When writing to a folder the format will be an Esri grid (raster). This format has some limitations in naming. The most important are: The maximum number of characters is 13. It cannot have spaces. It cannot use special characters other than underscore ( "_" ). The total length of the name for a Grid and its path cannot be more than 128 characters. You can read more about this in the Help topic on "Output raster formats and names" Could you attach a screen shot of the Excel file you're using? I would like to see what output names are assigned. Kind regards, Xander
... View more
12-05-2013
08:33 PM
|
0
|
0
|
892
|
POST
|
Hi Matt, When you define a path in a Python script there are 3 ways to do this (maybe more, but these are the most common ones):
# use "r" before path
myFGDB = r"C:\A\B\Test\TIMESLOOKUP.gdb"
# use forward slashes
myFGDB = "C:/A/B/Test/TIMESLOOKUP.gdb"
# use double slashes
myFGDB = "C:\\A\\B\\Test\\TIMESLOOKUP.gdb"
So in your code, change this: arcpy.env.workspace = r"C:\A\B\Test\TIMESLOOKUP.gdb"
arcpy.env.scratchWorkspace = r"C:\A\B\Test\TIMESLOOKUP.gdb" to this: arcpy.env.workspace = r"C:\A\B\Test\TIMESLOOKUP.gdb"
arcpy.env.scratchWorkspace = r"C:\A\B\Test\TIMESLOOKUP.gdb" The other thing will probably be the table "LOOKUP$". Is this by any chance an Excel worksheet? If so, you will have to reference it with its complete path, since it is not in your current workspace (which is a fgdb). If you run this in the Python window of ArcMap and the table is named like that and in your TOC, it might just work. Kind regards, Xander BTW: good catch with the outWS
... View more
12-05-2013
02:13 AM
|
0
|
0
|
892
|
POST
|
Hi Matthew, Can you post your code using the "#" button? It is probably the way the workspace is defined. Kind regards, Xander
... View more
12-05-2013
01:50 AM
|
0
|
0
|
2084
|
POST
|
Hi Matthew, If I understand this correctly it could look like the code below. I assumed the following things: you have an input folder or fgdb (inWS) where your input rasters are stored fldName1 holds the name of the output raster (no path to folder of fgdb included) fldName2 holds the name of the input raster (stored in inWS) fldName3 is numeric output rasters will be written to the output folder of fgdb outWS The code will need some small changes in case your fields include locations too. import arcpy,os
inWS = r'c:\path\to\input\folder\or\filegdb.gdb' # input rasters are stored here
outWS = r'c:\path\to\output\folder\or\filegdb.gdb' # output rasters will be stored here
tbl = 'YourTableName'
fldName1 = 'YourFieldName1' # field with output raster name (no path included)
fldName2 = 'YourFieldName2' # field with input raster name (no path included)
fldName3 = 'YourFieldName3' # multiply value field
fields = [fldName1,fldName2,fldName3]
with arcpy.da.SearchCursor(tbl, fields) as cursor:
for row in cursor:
value_from_row = row[2]
inName = row[1]
outName = row[0]
inRasLoc = os.path.join(inWS,inName)
inRas = arcpy.Raster(inRasLoc)
result = inRas * value_from_row
outRasLoc = os.path.join(outFolder,outName)
result.save(outName)
del row, inRas, tbl Kind regards, Xander
... View more
12-05-2013
12:44 AM
|
0
|
0
|
2084
|
POST
|
CAD data can be added to ArcMap directly without the use DataInterop. CAD data can also be used as input for the "Buffer (Analysis)" tool. Selections are honored. Results will be written to ArcGIS native formats (featureclass in geodatabase, shapefile, etc) not to CAD. Kind regards, Xander
... View more
12-04-2013
12:49 PM
|
0
|
0
|
392
|
Title | Kudos | Posted |
---|---|---|
1 | 01-21-2020 07:21 AM | |
2 | 01-30-2020 12:46 PM | |
1 | 05-30-2019 08:24 AM | |
1 | 05-29-2019 02:45 PM | |
1 | 10-18-2024 12:14 PM |
Online Status |
Offline
|
Date Last Visited |
3 weeks ago
|