|
POST
|
Hi, I have a line feature class representing a gas distribution network. It's just a simple line feature class, no linear referencing or geometric networks involved. Pipes are somewhat arbitrarily split into sections ranging from 1m or less in length up to around 1km. Each section has a Pipe ID and a field containing the number of repairs to that section over the last seven years, along with attributes such as material, diameter, pressure range etc. What I want to do is merge contiguous sections that share the same material, diameter and pressure range and get a sum of the number of repairs on all of the pipe sections that make up that 'superstring'. Dissolve seemed to be the tool for the job, but looking at the results, it's not doing what I need. First of all, it's not merging contiguous features that share the attributes specified in all cases, for example, in the image below the green lines all share the same material, diameter and pressure, but they remain as four separate features (the long horizontal at the top, the two vertical and the shorter horizontal at the bottom). It doesn't seem to make a difference if I select 'unsplit lines' or not. The other issue is that the sum of repairs I get is for ALL features sharing those attributes, and is the same on each dissolved feature! E.g. each of the four features in the image below has the same sum, and I suspect even if I could get them to merge properly with the Dissolve tool then the single feature would also have that same total - which applies to the whole network and not just to the contiguous section. Is there a way to do what I want, that is, combine contiguous features that share certain attributes, and summarise another attribute but JUST for each contiguous set of features? Dan
... View more
08-28-2014
03:07 AM
|
0
|
2
|
1821
|
|
POST
|
Hi, Don't know if this helps at all? http://gis.stackexchange.com/questions/53414/creating-thiessen-voronoi-polygons-using-lines-rather-than-points-as-the-inp Thiessen or Voronoi polygons allow you to create polygons from point features where every point within each polygon is nearer to a certain point than any of the others. You want to do this with lines (or are your road features polygons?) I'm not sure exactly how you'd do it, but the link above has some hints. It suggests that it may be easier using a raster representation... Hope that helps Dan
... View more
06-02-2014
05:58 AM
|
0
|
0
|
699
|
|
POST
|
Thanks for the answers. Unfortunately we don't have a 10.2 advanced license, although we're supposedly moving to an enterprise license agreement later this year, which I think would cover it, providing we move to 10.2.
... View more
03-26-2014
01:10 AM
|
0
|
0
|
913
|
|
POST
|
Hi Emily, I think what you need to do is populate the combo box from the underlying SITES feature class, rather than the layer. You can get the path for the data source of the layer like this: layer_path = layer.dataSource then pass the layer_path to the code that finds the unique values, like this: values = [row[0] for row in arcpy.da.SearchCursor(layer_path, ["SITE_NUM"])] That should allow you to remove the clear selection from onFocus() I think that should work, let me know if it doesn't! Dan
... View more
03-25-2014
08:25 AM
|
1
|
0
|
1219
|
|
POST
|
Hi, I'm fairly new to this as well, and have been working on a very similar add-in recently. I think what might be happening is that you're getting the reference to the mxd and dataframe globally, outside the classes, so that code is only being executed once, so when you load a new mxd, your script doesn't have a reference to it. Try moving this code into the onFocus() function, that way whenever the user clicks the combo box, it will update the reference to the mxd and the dataframe, as well as refreshing the list of SITE_NUMs. If the layer you are selecting from already exists in the mxd, you can do something like: layer = arcpy.mapping.ListLayers(mxd, "Name of Layer", df)[0] to create a reference to the first layer in the mxd called "Name of Layer", and then pass the layer variable to the arcpy.SelectLayerByAttribute_management() function to avoid creating a new selection layer. Note also that the zoomToSelectedFeatures() function will zoom to the extent of all selected features on ALL layers, which may not be what you want; you can also do:
df.extent = layer.getSelectedExtent()
arcpy.RefreshActiveView()
Hope that helps! Dan
... View more
03-25-2014
06:40 AM
|
0
|
0
|
1219
|
|
POST
|
I have two line feature classes representing gas distribution pipes - one from our main GIS, split into pipe units each with a unique pipe ID; the other from our network analysis software SynerGEE, which breaks the individual units down even further into smaller units, that have their own unique IDs. I need to get the unique pipe IDs from the main GIS layer onto the smaller units from SynerGEE. I've experimented with doing spatial joins based on 'shares a line segment with', 'closest' and 'have their centre in', which seems to work okay most of the time, but sometimes it'll match more than one pipe ID, or pick up the wrong one. Intersect works quite well too, but around 5% of the SynerGEE pipes are not fully aligned with the original layer. This is because the network analysts sometimes draw new or replacement pipes in manually (the exact route of the pipes does not affect the hydraulic model). I was wondering if there's a way I could do this based on connectivity by setting the pipes up as a geometric network, or if anyone has any other ideas of how to approach this? It may be that, as the problem is only with a small percentage of the pipes, these can just be matched manually... I also need to be 100% sure that any I match using a spatial join or intersect are correct... Any help appreciated! Dan
... View more
03-25-2014
02:01 AM
|
0
|
5
|
1241
|
|
POST
|
Thanks for the reply Mathew. I made some changes to (seemingly) unrelated parts of the script today and somewhere along the line the pan and zoom buttons started working again! The only (minor) issue now is that zooming to selected features, especially from a small scale, doesn't zoom all the way in on the first click, and if you then click zoom again it'll zoom properly. Sometimes you have to click three times to zoom right in... It's weird, but not a massive problem at the moment. Thanks Dan
... View more
03-12-2014
07:29 AM
|
0
|
0
|
1081
|
|
POST
|
Hi, I am trying to write a simple Python add-in that provides a combo box allowing the user to enter a project number. They can then click buttons to 'draw' (i.e. select all the pipe features in that project), pan to (select the pipes in the project, then pan to them, keeping the current scale) or zoom to (select the pipes in the project, then zoom to their extent). If the user enters a project number and presses enter, the default behaviour is to just 'draw'/select the pipes in the project. The 'draw'/select functionality works fine, either by pressing enter or clicking the button. The pan and zoom to buttons don't pan or zoom though! They do the selection okay, but the view stays in the same extent and scale. My code is below. Any help would be greatly appreciated! Dan import arcpy
import pythonaddins
class DrawProject(object):
"""Implementation for MRPAssistant_addin.panbutton (Button)"""
def __init__(self):
self.enabled = True
self.checked = False
def onClick(self):
mxd = arcpy.mapping.MapDocument('CURRENT')
df = arcpy.mapping.ListDataFrames(mxd)[0]
layer = arcpy.mapping.ListLayers(mxd, "DistributionMain", df)[0]
arcpy.SelectLayerByAttribute_management(layer, "NEW_SELECTION", "[MRP_EZRESULTS.PROJECTID] = " + projectsearchcombobox.value)
arcpy.RefreshActiveView()
class PanToProject(object):
"""Implementation for MRPAssistant_addin.panbutton (Button)"""
def __init__(self):
self.enabled = True
self.checked = False
def onClick(self):
mxd = arcpy.mapping.MapDocument('CURRENT')
df = arcpy.mapping.ListDataFrames(mxd)[0]
layer = arcpy.mapping.ListLayers(mxd, "DistributionMain", df)[0]
arcpy.SelectLayerByAttribute_management(layer, "NEW_SELECTION", "[MRP_EZRESULTS.PROJECTID] = " + projectsearchcombobox.value)
df.panToExtent(layer.getSelectedExtent())
arcpy.RefreshActiveView()
class ProjectSearchComboBox(object):
"""Implementation for MRPAssistant_addin.projectsearchcombobox (ComboBox)"""
def __init__(self):
self.items = [""]
self.editable = True
self.enabled = True
self.dropdownWidth = 'WWWWWW'
self.width = 'WWWWWW'
def onSelChange(self, selection):
pass
def onEditChange(self, text):
global project
project = text
def onFocus(self, focused):
pass
def onEnter(self):
mxd = arcpy.mapping.MapDocument('CURRENT')
df = arcpy.mapping.ListDataFrames(mxd)[0]
layer = arcpy.mapping.ListLayers(mxd, "DistributionMain", df)[0]
arcpy.SelectLayerByAttribute_management(layer, "NEW_SELECTION", "[MRP_EZRESULTS.PROJECTID] = " + project)
arcpy.RefreshActiveView()
def refresh(self):
pass
class ZoomToProject(object):
"""Implementation for MRPAssistant_addin.zoombutton (Button)"""
def __init__(self):
self.enabled = True
self.checked = False
def onClick(self):
mxd = arcpy.mapping.MapDocument('CURRENT')
df = arcpy.mapping.ListDataFrames(mxd)[0]
layer = arcpy.mapping.ListLayers(mxd, "DistributionMain", df)[0]
arcpy.SelectLayerByAttribute_management(layer, "NEW_SELECTION", "[MRP_EZRESULTS.PROJECTID] = " + projectsearchcombobox.value)
df.extent = layer.getSelectedExtent()
arcpy.RefreshActiveView()
... View more
03-11-2014
09:39 AM
|
0
|
2
|
4839
|
|
POST
|
I think the Create Random Points tool does just that: creates new points randomly, rather than selecting existing points randomly. You could try adding a new field to your existing points, then calculating a random 1 or 0 for each point, then just select out the 1s. I think it could still be a bit random how many 1s you get though, it might not reduce the points by much. If there was a certain factor you wanted to reduce the data by, and as long as the OBJECT_IDs aren't sorted in any way, you could calculate a modulo in your field, e.g. to just pick out every 10th point, you'd calculate OBJECT_ID % 10 (which would give you the remainder left if you divided the OBJECT_ID by 10) and select all the 0s in that field. Hope that makes sense, if not let me know and I will try to explain better! Dan
... View more
01-31-2014
02:29 AM
|
0
|
0
|
7971
|
|
POST
|
In the properties for your Marker Line Symbol, go to the Marker Line tab, click the Symbol button, double-click the symbol preview in the top-right of the Symbol Selector window. You can then select any font you like and pick the appropriate letter. Hope that helps Dan
... View more
01-08-2014
03:29 AM
|
0
|
0
|
3555
|
|
POST
|
Hmm... It seems like the two feature classes align properly if I add them both at once to a new empty map, but if I add them one at a time they are misaligned. They're both in the same FGDB... Dan
... View more
07-02-2013
06:55 AM
|
0
|
0
|
360
|
|
POST
|
Hi, I am trying to follow the instructions here (http://support.esri.com/fr/knowledgebase/techarticles/detail/34585) to align some patch boundaries to the coastline of the UK (buffered by 250m) but it is VERY slow and I can't get it to work right. I suspect this might be because the coastline feature class is in WGS_1984 projection (datum?) and my patch polygons are in OSGB_1936 (British National Grid projection?). So I've tried using the Project tool to create a copy of the coastline feature class in the same projection as the patches, but it comes out misaligned. I don't understand how it is being projected correctly 'on the fly' but not when I use the project tool! Any ideas? I'm using ArcGIS 9.3. Thanks Dan
... View more
07-02-2013
04:19 AM
|
0
|
2
|
611
|
|
POST
|
Hi, It sounds like what you want to do could be done using the Make Query Table tool. That would give you multiple copies of each boundary depending on how many survey results you have. Alternatively if that's not exactly what you meant, it is possible to publish relationships in ArcReader if they are set up as part of a geodatabase rather than as simple map relates... Hope that helps... Dan
... View more
04-22-2013
07:24 AM
|
0
|
0
|
551
|
|
POST
|
Hi, Can anyone help with this? There is another thread with some on (http://forums.arcgis.com/threads/22799-Customize-address-locators-in-ArcGIS-10) but they are for version 10 and I'm still on 9.3. Does anyone have the equivalent files for 9.3, or is there any way to convert from the version 10 XML to something compatible with version 9.3? Thanks Dan
... View more
03-26-2013
01:46 AM
|
0
|
0
|
1955
|
|
POST
|
In my experience geoprocessing tools don't like events layers. Try exporting as a feature class first. Hope that helps Dan
... View more
03-19-2013
05:27 AM
|
0
|
0
|
492
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 10-21-2016 07:55 AM | |
| 1 | 12-02-2015 08:36 AM | |
| 1 | 03-25-2014 08:25 AM | |
| 1 | 08-17-2011 07:28 AM | |
| 1 | 03-24-2017 04:26 AM |
| Online Status |
Offline
|
| Date Last Visited |
03-03-2022
10:03 AM
|