POST
|
Thanks for hanging in there with this Xander. I am far from expert with arcpy. What confuses me about from random import uniform lst_areas = [] for i in range(0, 100😞 lst_areas.append(uniform(4.5, 110)) lst_areas += [133, 155] for area in sorted(lst_areas): print area, int(area // 10) + 3 . . . is I don't see how the acreage field in my input file is evaluated. That's what the whole chin of logic is based on. Look at the acreage value determine acreage range it falls within assign the acreage ranges number of random points to the numPts variable run the CreateRandomPoints tool. Sorry for being a arcpy newbie. Thanks for the help. Jim
... View more
03-01-2016
02:36 PM
|
0
|
1
|
742
|
POST
|
Hi Dan, My input feature class of forest stands has an acreage field that is being read; it's value measured against a range which in turn assigns the numPts variable a value. numPts is the parameter plugged into CreateRandomPoints. SearchCursor does seem to be cycling through every Acre field value and then executing the MakeFeatureLayer tool, but that tool - after opening up for every polygon in the fc - does not seem to see any values in any of the fields? Executing: MakeFeatureLayer C:\GIS\BrettWalker\PointsByAcreage.gdb\TimberInventoryStands fLayer "OBJECTID = 84" # "OBJECTID OBJECTID VISIBLE NONE;Shape Shape VISIBLE NONE;AREA_SIZE AREA_SIZE VISIBLE NONE;INV_PA_AC_ INV_PA_AC_ VISIBLE NONE;STD_AC STD_AC VISIBLE NONE;FEAT_ID_ FEAT_ID_ VISIBLE NONE;standID standID VISIBLE NONE;treatment_ treatment_ VISIBLE NONE;remarks remarks VISIBLE NONE;siteindex siteindex VISIBLE NONE;sispecies sispecies VISIBLE NONE;total_basa total_basa VISIBLE NONE;AGS_ba AGS_ba VISIBLE NONE;medial_dia medial_dia VISIBLE NONE;eff_age eff_age VISIBLE NONE;gross_bdft gross_bdft VISIBLE NONE;net_bdft_v net_bdft_v VISIBLE NONE;value value VISIBLE NONE;Shape_Length Shape_Length VISIBLE NONE;Shape_Area Shape_Area VISIBLE NONE;Acres Acres VISIBLE NONE" So CreateRandomPoints never gets executed. To be clear, there is no compromising on the input fc - it is a layer of polygons at different acreages. The number of random points to be generated depends on what 10 acre range a particular polygon's acreage falls into. I don't follow how Xander's simplified code takes into account the acreages of the input fc's polygons Thanks for the help, Jim
... View more
03-01-2016
02:28 PM
|
0
|
0
|
742
|
POST
|
Kind of like the tail wagging the dog then isn't it - if the number of points parameter doesn't drive the placement of the first point. Still I'm not getting any points placed after the first polygon
... View more
03-01-2016
01:58 PM
|
0
|
0
|
742
|
POST
|
Xander, 1) Doesn't the SearchCursor keep looping through the 3 lines of shorthand operator minAcres += 10 maxAcres += 10 numPts += 1 until the acreage value for a specified polygon falls within on of the ten acre ranges? For example, OBJECTID # 33 in my feature class has an acreage value of 106 acres. Shouldn't the SearchCursor keep looping through the 3 lines of code above until the tenth time through where the range the acreage value being tested against has reached 100 - 110 acres? Then, having found the proper range match which through the shorthand operator should now assign 13 points - can continue on to MakeFeatureLayer and then CreateRandomPoints. Is the issue here that the 3 lines of shorthand operator Do Not have a cumulative effect? In other words, every time it loops through is it just testing for the 10 - 20 acre range. Even if that was the case, there are 37 polygons that fall in the 10 - 20 acre range so shouldn't those 37 at lease - along with the polys that fall within the 0 - 10 range have points generated? 2) If I can manually place 3 points at a minimum distance of 100 meters in a 4.59 acre polygon - why can't the CreateRandomPoints tool do it? I don't follow that. To test, I placed a point in the NW section of the 4.59 acre poly and then measure 100 meters SE and then 100 meters SW - 3 points at a minimum distance of 100 meters fit in that polygon - the tool doesn't seem to find the proper starting place for the first point's placement. 3) The second elif has subsequently been edited to check for 155acres. I'll also add this bit of the RESULT output. MakeFeatureLayer does execute for every polygon in the fc but nothing seems to be "visible" to it - see below one example - 157 others similar Executing: MakeFeatureLayer C:\GIS\BrettWalker\PointsByAcreage.gdb\TimberInventoryStands fLayer "OBJECTID = 84" # "OBJECTID OBJECTID VISIBLE NONE;Shape Shape VISIBLE NONE;AREA_SIZE AREA_SIZE VISIBLE NONE;INV_PA_AC_ INV_PA_AC_ VISIBLE NONE;STD_AC STD_AC VISIBLE NONE;FEAT_ID_ FEAT_ID_ VISIBLE NONE;standID standID VISIBLE NONE;treatment_ treatment_ VISIBLE NONE;remarks remarks VISIBLE NONE;siteindex siteindex VISIBLE NONE;sispecies sispecies VISIBLE NONE;total_basa total_basa VISIBLE NONE;AGS_ba AGS_ba VISIBLE NONE;medial_dia medial_dia VISIBLE NONE;eff_age eff_age VISIBLE NONE;gross_bdft gross_bdft VISIBLE NONE;net_bdft_v net_bdft_v VISIBLE NONE;value value VISIBLE NONE;Shape_Length Shape_Length VISIBLE NONE;Shape_Area Shape_Area VISIBLE NONE;Acres Acres VISIBLE NONE" Start Time: Fri Feb 26 16:19:16 2016 Succeeded at Fri Feb 26 16:19:16 2016 (Elapsed Time: 0.00 seconds) Is the tool not temporarily creating the polygon? Thanks for all the help Xander, Jim
... View more
02-29-2016
07:33 AM
|
0
|
7
|
1647
|
POST
|
Jake, Hope you saw my first response and also what I wrote to Xander. I'll also add this bit of the result output. MakeFeatureLayer does execute for every polygon in the fc but nothing seems to be "visible" to it - see below one example - 157 others similar Executing: MakeFeatureLayer C:\GIS\BrettWalker\PointsByAcreage.gdb\TimberInventoryStands fLayer "OBJECTID = 84" # "OBJECTID OBJECTID VISIBLE NONE;Shape Shape VISIBLE NONE;AREA_SIZE AREA_SIZE VISIBLE NONE;INV_PA_AC_ INV_PA_AC_ VISIBLE NONE;STD_AC STD_AC VISIBLE NONE;FEAT_ID_ FEAT_ID_ VISIBLE NONE;standID standID VISIBLE NONE;treatment_ treatment_ VISIBLE NONE;remarks remarks VISIBLE NONE;siteindex siteindex VISIBLE NONE;sispecies sispecies VISIBLE NONE;total_basa total_basa VISIBLE NONE;AGS_ba AGS_ba VISIBLE NONE;medial_dia medial_dia VISIBLE NONE;eff_age eff_age VISIBLE NONE;gross_bdft gross_bdft VISIBLE NONE;net_bdft_v net_bdft_v VISIBLE NONE;value value VISIBLE NONE;Shape_Length Shape_Length VISIBLE NONE;Shape_Area Shape_Area VISIBLE NONE;Acres Acres VISIBLE NONE" Start Time: Fri Feb 26 16:19:16 2016 Succeeded at Fri Feb 26 16:19:16 2016 (Elapsed Time: 0.00 seconds) Is the tool not temporarily creating the polygon? Thanks, Jim
... View more
02-26-2016
01:46 PM
|
0
|
0
|
742
|
POST
|
Hi Xander, Thanks for response. The code does test for all the other ranges e.g. 10 - 20; 20- 30 etc. via the 3 lines using the shorthand operator "+=" - Is it that the SearchCursor is not looping through those lines? Also, when the script has generated a single point output file - for the smallest polygon (4.59 acres) it did not generate 3 points as the variable "numPts" should have instructed it to do.(plenty of room for a min distance of 100 meters) Below is the status of how the script is operating: Script runs through without erroring out SearchCursor – appears to iterate through the rows of the “Acres” field being tested to see if that record’s value falls in between minAcres & maxAcres range as the original range is defined i.e. 0 – 10 acres. Then two elif statements check for the two specific non-range values – 133 & 155. If none of the above values is found I Hope the next 3 lines of code with the shorthand operator “+=” is implemented and the SearchCursor runs through the next 10 acre range 10-20 acres. minAcres += 10 maxAcres += 10 numPts += 1 So it appears that all the required steps are accounted for in the code in order for it to assess a value in one field against a range and create the assigned number of points for that range via the CreateRandomPoints tool. MakeFeatureLayer does run for every polygon. So is the problem: That the shorthand operator ranges are not successfully being cycled through? That a parameter for SearchCursor is slightly off? - That a parameter for MakeFeatureLayer is slightly off? That a parameter for CreateRandomPoints is slightly off? Again, it appears to be close to accomplishing the task. Do you see where it's going wrong? Any ideas Jake Skinner - are you still out there? Thanks to all for assistance, Jim
... View more
02-26-2016
11:04 AM
|
0
|
9
|
1647
|
POST
|
Jake (and all other respondents in this thread) - Thanks very much for your input. My apologies for disappearing - I was in the middle of an extended project when I posted the question and have had no opportunity to pick this back up until today. That said - your script is very impressive - direct and efficient. I must be leaving a slight edit out because the code runs to the end successfully, but so far the best output I've gotten is just a single point - the first point generated from the first polygon in the fc. You can see the MakeFeatureLayer tool chugging away on every polygon in the input fc - but no temp fLayer (output) is generated - there should be one for every polygon correct? - that in turn is merged into the final "RandomPoints" fc. A RandomPoints fc is created and the script does not error out - but as earlier stated, the out put is either empty or just contains the first point generated only. So it's very close to working. There was an empty output warning early on in the results - when the CreateRandomPoints tool first kicked off Here is the script as I ran it import arcpy ... from arcpy import env ... #Specify workspace ... env.workspace = r"C:\GIS\BrettWalker\PointsByAcreage.gdb" ... env.overwriteOutput = 1 ... ... #Specify Feature Class ... fc = r"C:\GIS\BrettWalker\PointsByAcreage.gdb\TimberInventoryStands" ... ... minAcres = 0 ... maxAcres = 10 ... numPts = 3 ... ... #Iterate through feature class by Ascending order for the field Acres ... with arcpy.da.SearchCursor(fc, ["OBJECTID", "Acres"], sql_clause=("ASC", "ORDER BY Acres")) as cursor: ... for row in cursor: ... arcpy.MakeFeatureLayer_management(fc, "fLayer", "OBJECTID = {0}".format(row[0])) ... if row[1] > minAcres and row[1] < maxAcres: ... arcpy.CreateRandomPoints_management(env.workspace, "pts{0}".format(row[0]), "fLayer", "", numPts, "100 Meter") ... elif row[1] == 133: ... numPts = 16 ... arcpy.CreateRandomPoints_management(env.workspace, "pts{0}".format(row[0]), "fLayer", "", numPts, "100 Meter") ... elif row[1] == 133: ... numPts = 18 ... arcpy.CreateRandomPoints_management(env.workspace, "pts{0}".format(row[0]), "fLayer", "", numPts, "100 Meter") ... ... minAcres += 10 ... maxAcres += 10 ... numPts += 1 ... ... del cursor ... ... list = [] ... ... for fc in arcpy.ListFeatureClasses("Pts*"): ... list.append(fc) ... ... #Merge all point feature classes ... arcpy.Merge_management(list, "RandomPoints") ... ... #Delete individual point feature classes ... for fc in arcpy.ListFeatureClasses("Pts*"): ... arcpy.Delete_management(fc) Does Darren Wiens suggestion about getting the need to be incorporated? Thanks again for all your help. Jim Labate
... View more
02-25-2016
01:30 PM
|
0
|
13
|
1647
|
POST
|
Hello, Can someone tell me how to generate a specific number of random points based on the acreage of a polygon falling within a specified range? Is there a way to make the Create Random Points tool generate a specific number of points based on the comparison of an area field to an area range? is there another tool or combination of whic I can use? This is what I'm talking about: So, I have 158 polygons in my timber stand layer. I am trying to assign random points to each individual polygon based on their acreage. So the breakdown is as follows: Size of polygon in acres----number of random points required----number of polygons of this size on the layer. 0-10acres---3points---4polygons 10-20acres---4---37 20-30acres---5---39 30-40acres---6---20 40-50acres---7---11 50-60acres---8---17 60-70acres---9---13 70-80acres---10---6 80-90acres---11---2 90-100acres---12---3 100-110acres---13---3 133acres---16---1 155acres---18---1 I would like to have the points evenly distributed if possible, if not, they need to be a minimum of 100meters apart. Thanks in Advance, Jim Labate
... View more
02-01-2016
09:33 AM
|
0
|
19
|
4981
|
POST
|
Thanks for elaborating Robert. And again, thanks for taking the time. Best Regards, Jim
... View more
12-13-2015
06:25 AM
|
0
|
0
|
1641
|
POST
|
Robert, When you say "You can establish a virtual directory using the UNC path you already have" I'm still not quite sure where the virtual and literal directories "meet" Say my image files reside on machineA in multiple sub-directories (my operational point layer was generated by the Create Point File from Geotagged Images tool) So those images are located: \\machineA\gis\images\MainSt From what I see in the link I have to name the virtual directoryon the server - machineB - with an alias. Suppose I name it "Images" - How is that virtual directory standing in for - or as I heard it described, like a shortcut to - \\machineA\gis\images\MainSt? I'm not seeing how that UNC is connected to the alias virtual directory. Sorry to belabor this - hopefully it's apparent when I attempt it - if I'm granted the permissions to try. OK - thanks again Robert. Now, if IT will be half as cooperative as you hopefully I'll get this there. Much Obliged. Jim
... View more
12-12-2015
04:34 PM
|
0
|
11
|
1641
|
POST
|
Robert, Thanks very much for your advice. Although I have not created a Virtual Directory on our MS Server 2008 R2 before I'm game to try. Unfortunately, I don't have permissions to do so and out IT staff (who've always looked askance at our humble little one box ArGIS for Server Site) - and after a recent dressing down from network overlords are not looking to do any GIS favors for anyone soon. That said, would simply copying the images to a location on the server eliminate the need for a virtual directory? If the path field in my photo location point file is pointing to a local directory on the server would that be stable and reliable - and display an image in the pop-up? Or is there no choice but to request a virtual directory be created? If so, i don't quite follow this step in an MS explanation I see online referring to the Physical Path in the Add Virtual Directory Dialogue box: "Type or browse to the physical directory that contains the virtual directory." Is this valid? How to: Create and Configure Virtual Directories in IIS 7.0 In other words, if the images are on machine A and the virtual directory is on the IIS Server Machine B - how does the virtual directory point to the images on machine A if you're inputting the physical directory that contains the virtual directory in the Add Directory Dialogue box? I don't see where the connection between the virtual directory and the actual physical location of the images is established. Finally, the link above discusses Configuring a Virtual Directory. Is configuring a tuning exercise or something that if not done will result in the link simply not working? Thanks in advance for all your help, Jim
... View more
12-12-2015
12:03 PM
|
0
|
14
|
1641
|
POST
|
The test link seems active - when I hover over the image icon in the pop up I get icon indicating a live link but if I click I get nothing. I've tried customizing the pop up (Custom Button in 3.7 Pop Up Configuration Tool) by adding the image tag and also the medias option. We're using Flex Viewer 3.7. We have a lot of security here - do the images need to be local on the server where ArcGIS foor Server resides? Again, I also tried to set height , and width attributes in the pop up custom tab html code. I read somewhere the "type" attribute needs to = "Image" I thought the medias tool was taking care of that.. Has anyone had this issue? Thanks, Jim
... View more
12-10-2015
02:30 PM
|
1
|
16
|
8637
|
POST
|
Aravind, Thanks for your response. Isn't Web Adaptor an extension that needs to be installed along with Portal. I thought both of those items are a part of ArcGIS for Server 10.3.1 - which is what my administrator is currently running. I'm hoping that means we in fact do have possession of both Web Adaptor and Portal and that means I can try and install them to function alongside of ArcGIS for Server. From there wouldn't I be able to view a service through an application built in Web AppBuilder? From what I've read about Portal's web viewer I think I can view the published service and hopefully, the html image pop-up point file - created through the geo-tag image to points tool - will maintain its functionality in the viewer. Is there any chance of that at all? James
... View more
09-21-2015
12:16 PM
|
0
|
0
|
642
|
POST
|
Hi Adriana, Thank you for your response. 1. When you say make them available at the rest/services directory do you mean a directory available through ArcGIS for Server or through AGOL? Basic queries includes simple identifies? 2. I'm looking to have Web AppBuilder installed on my machine. Where on arcGIS for Server does the finished app actually reside on Server? 3. Can you confirm for me that I am thinking of Portal correctly for what I'm trying to do? Can i create a simple app in Web AppBuilder, Post itosmwhere in ArcGIS for Server, and then make it viewable in an internet browser via the Portal extension of ArcGIS for Server? Thank You, Jim
... View more
09-21-2015
11:09 AM
|
0
|
2
|
642
|
POST
|
Hi Leo, No, as written above, I can not load any data onto AGOL. This is strictly an intranet solution. So, is the ArcGIS for Server extension" Portal" my only option? Again, we have Server up and running. My objective is to allow my work colleagues who do not have desktop the ability to view geodata. I can publish a service. Can that service be viewed through a web browser or is an app (built in Web AppBuilder) required? Thanks, Jim
... View more
09-21-2015
09:37 AM
|
0
|
0
|
642
|
Title | Kudos | Posted |
---|---|---|
1 | 12-10-2015 02:30 PM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|