|
POST
|
Oh, you'll have to adjust the index number for self.params[] to match your interface. In my example, I specified self.params[2] to mean the third parameter. The counting starts at zero.
... View more
02-16-2016
04:06 PM
|
1
|
1
|
2806
|
|
POST
|
Do you get the same results saving to a feature class rather than geometry objects?
... View more
02-16-2016
09:02 AM
|
0
|
1
|
2531
|
|
POST
|
As a starting point, please post your Python script.
... View more
02-15-2016
01:38 PM
|
0
|
1
|
6646
|
|
POST
|
See if you get better results using forward slashes in your paths. '\t' means tab in Python.
... View more
02-15-2016
12:16 PM
|
1
|
2
|
2902
|
|
POST
|
Basically, yes. You can't (I don't think) change the parameter to a more appropriate type like Feature Class or Feature Layer because there will only be a Feature Class filter available, not Value List. Once you're more familiar with Python, you can clean up the exported code to change the inline variable substitution to more readable variables, but for now it should be fine.
... View more
02-15-2016
09:59 AM
|
0
|
3
|
2806
|
|
POST
|
This will probably take some digesting: >>> import csv
... fc = "myLines"
... with open('C:/junk/points.csv', 'rb') as csvFile:
... reader = csv.reader(csvFile)
... dict = {}
... for row in reader:
... dict.setdefault(row[0],arcpy.Array()).add(arcpy.Point(row[1],row[2]))
... print dict
... cursor = arcpy.da.InsertCursor(fc, ["Name","SHAPE@"])
... for k,v in dict.iteritems():
... cursor.insertRow([k,arcpy.Polyline(v)])
...
{'Line_1': <Array [<Point (529018.125025, 4108038.05548, #, #)>, <Point (529005.718792, 4108028.20659, #, #)>, <Point (528993.340503, 4108018.73931, #, #)>, <Point (528980.990158, 4108009.65364, #, #)>, <Point (528968.667757, 4108000.94958, #, #)>]>, 'Line_3': <Array [<Point (528919.657595, 4107969.94943, #, #)>, <Point (528907.474915, 4107963.15341, #, #)>, <Point (528895.320179, 4107956.739, #, #)>, <Point (528883.193387, 4107950.7062, #, #)>]>, 'Line_2': <Array [<Point (528956.373301, 4107992.62713, #, #)>, <Point (528944.106788, 4107984.68629, #, #)>, <Point (528931.86822, 4107977.12705, #, #)>]>, 'Line_4': <Array [<Point (528871.09454, 4107945.055, #, #)>, <Point (528859.023636, 4107939.78542, #, #)>, <Point (528846.980676, 4107934.89744, #, #)>, <Point (528834.965661, 4107930.39107, #, #)>]>} I saved your sample data to a csv file. Then, for each row in the csv, add the coordinates (point objects within an array object) to a dictionary, according to the line ID. Once the dictionary is created, for each line ID in the dictionary, insert a feature into the feature class, passing name and shape.
... View more
02-12-2016
02:11 PM
|
1
|
5
|
7196
|
|
POST
|
pointList is getting wiped out for each line in your input file. Within each iteration, you need to add the contents of pointList to an overarching list to persist the coordinates until you are ready to create the lines.
... View more
02-12-2016
01:00 PM
|
1
|
0
|
2517
|
|
POST
|
Check out the example on the Polyline help page, paying particular attention to fact that multiple lines require multiple lists, or rather, a list of lists.
... View more
02-12-2016
12:54 PM
|
1
|
1
|
4679
|
|
POST
|
Please post your entire script with code formatting. Posting Code blocks in the new GeoNet edit: you reference ln[0] before creating the ln variable. edit 2: not sure what this line means: Pointillist = occupies. Array () # initial Array Should probably be: pointList = arcpy.Array() edit 3: your variable names need to match exactly. Pointllist <> pointList
... View more
02-12-2016
11:50 AM
|
1
|
2
|
4679
|
|
POST
|
I'm not sure how you can achieve this in Model Builder, but once you're model is completely finished, you can export it to a Python script, create a script tool, and use validation to customize the filter. def initializeParameters(self):
"""Refine the properties of a tool's parameters. This method is
called when the tool is opened."""
mxd = arcpy.mapping.MapDocument("CURRENT")
lyrs = arcpy.mapping.ListLayers(mxd)
compare_list = ['points','buff','something_else'] # the full list of layers you want to consider
param_list = []
for lyr in lyrs:
if lyr.name in compare_list:
param_list.append(lyr.name) # add to internal list
self.params[2].filter.list = param_list # overwrite filter list
return
... View more
02-12-2016
11:32 AM
|
0
|
5
|
2806
|
|
POST
|
Do you know the names in the layer list beforehand? If so, you can populate a string parameter value list with the names of your layers, and reference them in your model through inline variable substitution.
... View more
02-12-2016
10:43 AM
|
0
|
7
|
2806
|
|
POST
|
The script makes points on each buffer in isolation, so there is no influence from any other buffer. I agree that the buffer size should be as low as reasonable. You would run into problems if the buffer overlapped other intersections or parallel streets. Good: Bad:
... View more
02-12-2016
09:29 AM
|
2
|
3
|
5500
|
|
POST
|
It may be trying to write a 4-band jpeg, which isn't supported according to the raster file formats document (1 or 3-band only). You can drop the 4th band by running Make Raster Layer, then try Copy Raster again.
... View more
02-11-2016
03:52 PM
|
2
|
1
|
9186
|
|
POST
|
I see you've found your answer, but in the tif raster layer properties, what are values for Number of Bands and Colormap (on the Source tab)?
... View more
02-11-2016
03:39 PM
|
1
|
3
|
9186
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 11-25-2015 01:51 PM | |
| 1 | 08-30-2013 02:22 PM | |
| 1 | 04-12-2011 11:19 AM | |
| 1 | 09-17-2021 09:43 AM | |
| 1 | 04-04-2012 12:05 PM |
| Online Status |
Offline
|
| Date Last Visited |
07-15-2023
12:11 AM
|