|
POST
|
I don't think ArcObjects will help as you have the same issue attempting to convert the formula to C#. It is not clear what field is to be calculated and what parameters are going into the existing formula. As Darren points out, all of the values appear to be constants.
... View more
06-15-2015
05:21 PM
|
0
|
1
|
809
|
|
POST
|
Try the following: Open a new map document and add the Hurricanes map service: http://sampleserver6.arcgisonline.com/arcgis/rest/services/Hurricanes/MapServer Open the python command prompt and run the following code: mapdoc = arcpy.mapping.MapDocument("CURRENT")
lyrs = arcpy.mapping.ListLayers(mapdoc)
for lyr in lyrs:
if lyr.supports("serviceProperties"):
sp = lyr.serviceProperties
endpoint = "{0}/{1}/{2}".format(sp["URL"], lyr.name, sp["ServiceType"])
print endpoint You should end up with the map service URL:
... View more
06-15-2015
05:12 PM
|
0
|
3
|
1090
|
|
POST
|
I haven't done this with WAB, but for C# projects I use Visual Studio Online source control and it works well. I can work on code on my main desktop machine, check it into source control and then get the latest revisions on my laptop. Laptop revisions can be checked in the same way. Version control systems have the added benefit of being able to revert to an earlier version of a file. Using GitHub or any other source control system would be a similar experience. The only issue in my situation is the laptop does not have some of the drive mappings that the desktop does so I sometimes need to point code to test data on a different drive. You could get around this by putting test data into source control as well but some of my projects generate a lot of data so it is easier to change the drive path. When copying folders, you generally end up with multiple copies of the source all over the place making it difficult to track changes and versions.
... View more
06-11-2015
06:48 PM
|
0
|
0
|
1910
|
|
POST
|
I think Kelly is right, z-index is the only thing that I can think of that would be causing this issue.
... View more
06-09-2015
06:08 PM
|
0
|
0
|
1023
|
|
POST
|
It is probably worth going through the Model Builder Tutorial to get an idea of how to construct your own model.
... View more
06-09-2015
06:01 PM
|
0
|
0
|
941
|
|
POST
|
Note that the first formula has an extra closing parenthesis after the field placeholder [VALFIELD] that will result in an error: "{}K".format(int(round([VALFIELD]) / 1000.0)))
Parsing error SyntaxError: invalid syntax (line 1) Remove the extra closing parenthesis and it works great. As long as you are not labelling a crazy number of features I would go for the dynamic labelling as you don't need to update calculated fields as your data changes.
... View more
06-05-2015
04:06 PM
|
0
|
2
|
2410
|
|
POST
|
In the field calculator change the parser to python and use the following formula: int(round( !A_Value! , -3)) / 1000 This will give you the rounded value in thousands. Edit - you will need to replace the !A_Value! with your own field name.
... View more
06-04-2015
02:45 PM
|
1
|
0
|
2410
|
|
POST
|
Make sure that the delimiters are the same for your column headings and values, for example use commas: x,y,value
674596.8,9856351.9,100.967430980
... View more
06-01-2015
04:19 PM
|
2
|
0
|
773
|
|
POST
|
This example assumes the text file is comma separated (X, Y, Value). You will also need to change the spatial reference id and output field name to suit your needs: import arcpy, os
# read data from file (x, y, custom value)
row_values = []
with open(r'G:\Temp\GeoNet\Script\test.txt') as f:
for line in f:
tmp = line.split(',')
row_values.append((float(tmp[0]),float(tmp[1]),float(tmp[2])))
# Define the shapefile
shp = r'G:\Temp\GeoNet\Script\pts.shp'
# Define spatial reference and create shapefile.
sr = arcpy.SpatialReference(28355)
arcpy.CreateFeatureclass_management (out_path = os.path.dirname(shp), out_name = os.path.basename(shp), geometry_type = "POINT", spatial_reference = sr)
arcpy.AddField_management(shp, "DataField", "DOUBLE")
# Use InsertCursor to update rows
cursor = arcpy.da.InsertCursor(shp, ['SHAPE@X','SHAPE@Y','DataField'])
for row in row_values:
cursor.insertRow(row)
# Clean up
del cursor
... View more
05-31-2015
10:41 PM
|
3
|
1
|
2124
|
|
POST
|
With the old gp.CreateFeaturesFromTextFile tool you are limited to just creating points with id, x, y, z and m values. I wouldn't bother using this old tool - getting the sample you found to work is a much better option.
... View more
05-31-2015
10:09 PM
|
0
|
0
|
2124
|
|
POST
|
Good to hear it is resolved. This can be a tricky issue to pick up so it is good practice to be aware of the issue and use a strategy to avoid this problem. I generally use a prefix for temporary feature layers such as tmp_ or FL_ to avoid confusion with geodatabase feature class names.
... View more
05-31-2015
04:08 PM
|
1
|
1
|
1338
|
|
POST
|
Have you tried putting in a zero for the m value? The documentation states that if the z and m values are not provided then they will be assigned a null value but the tool may be expecting none or both to be specified. Would be a simple test: Point 0 8674596.8 9856351.9 100.967430980 0.0 End
... View more
05-31-2015
03:44 PM
|
0
|
4
|
2124
|
|
POST
|
This is a duplicate post. Please check the original: Getting wrong results in Search Cursor?
... View more
05-31-2015
02:55 PM
|
0
|
0
|
821
|
|
POST
|
You may have a variable collision where the script is picking up the feature layer object before the dissolve is happening. In these two lines self.mapLayerFinal is referring to both the feature layer and the result of the dissolve: arcpy.MakeFeatureLayer_management(self.censusLayer, self.mapLayerFinal,"DISTRICT_ID BETWEEN 1 AND "+str(self.totalDistricts),self.workSpace)
# Execute Dissolve using LANDUSE and TAXCODE as Dissolve Fields
arcpy.Dissolve_management(self.mapLayerFinal, str(self.workSpace)+"/"+str(self.mapLayerFinal), "DISTRICT_ID", "","MULTI_PART", "DISSOLVE_LINES") Try changing the script so that two different names are used: arcpy.MakeFeatureLayer_management(self.censusLayer, "tmp_Layer","DISTRICT_ID BETWEEN 1 AND "+str(self.totalDistricts),self.workSpace)
# Execute Dissolve using LANDUSE and TAXCODE as Dissolve Fields
arcpy.Dissolve_management("tmp_Layer", str(self.workSpace)+"/"+str(self.mapLayerFinal), "DISTRICT_ID", "","MULTI_PART", "DISSOLVE_LINES")
... View more
05-31-2015
02:53 PM
|
2
|
3
|
1338
|
|
POST
|
To pass in the names of the shapefiles you can use arcpy.GetParameterAsText(). For an outline of how to do this see these pages: Setting script tool parameters Accessing parameters in a script tool Using parameters you could also pass in the different workspaces and switch between them when required.
... View more
05-28-2015
03:07 PM
|
2
|
5
|
2688
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 10-07-2014 06:13 PM | |
| 1 | 08-25-2015 02:04 AM | |
| 1 | 10-07-2014 03:54 PM | |
| 1 | 08-07-2014 09:19 PM | |
| 1 | 03-04-2015 02:02 PM |
| Online Status |
Offline
|
| Date Last Visited |
07-21-2021
06:32 PM
|