|
POST
|
Hi Ia, One thing that stands out i your code is, you are using same map service for creating a tiled map service object and feature layer. you can't use this combination. If your map service is tiled then you can't use it as a feature layer. If you map service is dynamic (which is suspect it is) you need create a ArcGISDynamicMapServiceLayer. Refer this sample. Edit fiddle - JSFiddle
... View more
08-21-2014
12:26 AM
|
0
|
10
|
1432
|
|
POST
|
line 8 in above snippet should be map.centerAt(response.results.results[0].feature.geometry);
... View more
08-20-2014
08:47 PM
|
0
|
0
|
1791
|
|
POST
|
try this work around. On map load event call query any feature layer where you can get shape of the USA country boundary. Get extent of the shape as arcgisGeocoder.searchExtent this will restrict geocode Set autoNavigate: false property to false. Attach to find-results event.
geocoder.on("find-results", function (response)
{
response.results.results[0].feature.symbol = new SimpleMarkerSymbol("circle", 20, null, new Color([255, 0, 0, 0.25]))
map.graphics.add(response.results.results[0].feature);
materAt(response.results.results[0].feature.geometry);
})
Use GeometryTask to check if returned geometry is within US boundary identified in step 1. Discard the one's not within US boundary. I have not implemented this workaround anywhere, hopefully this should work for you.
... View more
08-20-2014
08:46 PM
|
0
|
1
|
1791
|
|
DOC
|
Hi Xander, Thanks for the pointers, should agree your code looks more elegant than mine. Regards Riyas Deen
... View more
08-20-2014
07:52 PM
|
0
|
0
|
891
|
|
POST
|
Hi Lon, Not sure if there are other ways to take maps offline, but regarding your concern on setting up enterprise GDB. You don't need an ArcSDE license if you make direct connection to your database. You need ArcSDE license only if you need to use ArcSDE Service for accessing the Spatial database. May be discussions in this thread will help understand better. Why would I install ArcSDE with 10.1? As always for all licensing suggestions i advise you contact your local ESRI distributor before making licensing decisions. More help on how to set up direct connection can be found here. ArcGIS Desktop
... View more
08-20-2014
06:01 PM
|
0
|
7
|
1384
|
|
POST
|
Hi Beakal, Noticed that Tim's sample is displaying the pixel's attributes like colour and layer name, i understand you are interested in the value of the pixel. I have modified find_popup sample to display the pixel value. Edit fiddle - JSFiddle
... View more
08-20-2014
05:33 PM
|
1
|
3
|
5084
|
|
POST
|
Hi Saloni, Modified your code to make it work. Edit fiddle - JSFiddle
... View more
08-20-2014
05:23 PM
|
2
|
6
|
1834
|
|
POST
|
Hi Gustavo, Try below: Script: def isEqual(x,y): if x == y: return 1 else: return 0
... View more
08-20-2014
04:27 PM
|
2
|
2
|
688
|
|
POST
|
Hi Michael, Try below script, this creates an event layer and adds it to an MXD file. You can use UniqueValuesSymbology class in mapping module to build your symbology ArcGIS Help 10.1
import arcpy
import os
table = r"C:\Users\deenr\Desktop\Data.xlsx\Sheet1$"
layerName = "EVENT_LAYER"
# Temp layer file location
lyrFile = r"C:\Users\deenr\Desktop\delete_event_layer.lyr"
# IMPORTANT, set your spatial reference
sRef = ""
arcpy.MakeXYEventLayer_management(table, "X", "Y", layerName, sRef, "")
arcpy.SaveToLayerFile_management(layerName, lyrFile)
# Create Layer object
layer = arcpy.mapping.Layer(lyrFile)
# Open MXD
mxd = arcpy.mapping.MapDocument(r"C:\Users\deenr\Desktop\forum_delete_1.mxd")
# Get your first data frame
df = arcpy.mapping.ListDataFrames(mxd)[0]
# add layer and save MXD
arcpy.mapping.AddLayer(df, layer)
mxd.save()
#Delete layer file
os.remove(lyrFile)
... View more
08-20-2014
06:51 AM
|
0
|
0
|
641
|
|
POST
|
Hi David, There seems to be some line intend issue when i posted the script in the forum. I have uploaded the script in this location.Variable_from_excel.py
... View more
08-20-2014
04:46 AM
|
0
|
1
|
2835
|
|
POST
|
Hi David, Not sure what change you made to the code. Below is the data used and output for the code I posted. Line 46 is printing the whole dictionary out, including key and value. Line 51 is printing the values for each key from the dictionary.
... View more
08-20-2014
03:52 AM
|
0
|
3
|
2835
|
|
POST
|
Hi David, Below code reads through a Excel datasheet and creates a dictionary. You can reference the values for your key column from the dictionary as key.
import arcpy
import arcgisscripting
gp = arcgisscripting.create()
def Message(sMsg):
print sMsg
gp.AddMessage(sMsg)
# Define the feature class
table = "C:\Users\deenr\Desktop\Data.xlsx\Sheet1$"
keyField = "ID"
keyIdx = -1
fields = arcpy.ListFields(table)
# Get Key column Id
fIdx = 0
for field in fields:
if field.name == keyField:
keyIdx = fIdx
break
fIdx += 1
dictionary = {}
with arcpy.da.SearchCursor(table, ("*")) as cursor:
for row in cursor:
idx = 0
for cell in row:
if idx == fIdx:
if dictionary.has_key(str(cell)) == False:
dictionary[str(cell)] = []
else:
if dictionary.has_key(str(row[fIdx])) == True:
dictionary[str(row[fIdx])].append(cell)
idx += 1
# Print whole dictionary
Message(str(dictionary.items()))
for key in dictionary.keys():
# Print Values
Message(str(dictionary[key]))
... View more
08-20-2014
03:20 AM
|
0
|
5
|
2835
|
|
POST
|
Hi Alex, Try below option, this option does not use relationship class, but labels a layer based on another feature class with 1:M relation. I have not tested this with publishing the layer to ArcGIS Server. I would expect it to work with ArcGIS Server as well. Below is the expression code used.
import arcpy
def FindLabel ( [ROUTE_LINK_NO] ):
relateTable = r"C:\tempdelete\PL_TO_LINE.gdb\PL\VERT_TO_POINIT"
returnFieldName = "POINT_M"
joinFieldName = "ROUTE_LINK_NO"
label = ""
with arcpy.da.SearchCursor(relateTable, (returnFieldName), joinFieldName + " = " + [ROUTE_LINK_NO] ) as cursor:
for row in cursor:
label = label + str(row[0]) + ","
return label
... View more
08-19-2014
11:58 PM
|
0
|
0
|
526
|
|
POST
|
Hi Najd, Try below code. Note: Even if there is a suttle change in direction between segments (i.e. not exactly 180 degree), it'll be treated as change and gets counted as different section. Do post back if this worked.
ISegmentCollection segments = (ISegmentCollection)lta.Shape;
List<double> dimensions = new List<double>();
if (segments != null)
{
double length = 0;
for (int idx = 0; idx < segments.SegmentCount; idx++)
{
ISegment currentSegemnt = segments.get_Segment(idx);
if (idx + 1 < segments.SegmentCount)
{
ISegment otherSegment = segments.get_Segment(idx + 1);
if (currentSegemnt.ReturnTurnDirection(otherSegment) != 1)
{
dimensions.Add(length);
length = 0;
}
}
else
{
dimensions.Add(length);
}
}
}
... View more
08-19-2014
06:06 PM
|
0
|
1
|
1752
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 08-31-2014 06:04 AM | |
| 1 | 09-25-2014 06:03 PM | |
| 1 | 09-16-2014 06:15 PM | |
| 1 | 10-08-2014 03:50 AM | |
| 1 | 08-25-2014 08:33 PM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:24 AM
|