POST
|
On second though, this might explain why the behavior is even different as part of a geoprocessing service... maybe server Python/arcpy has different environmental settings by defaul? I will have to look at that, too.
... View more
11-10-2020
05:21 AM
|
0
|
0
|
190
|
POST
|
Good stuff, Dan. This wasn't the first time I got close to sifting through those folders. But I'll be back to the JSAPI tomorrow, so I'm doomed to a life of limited understahding!
... View more
11-10-2020
05:16 AM
|
0
|
0
|
190
|
POST
|
I was beginning to wonder something like this... whether some "actions" are implied. Glad you bring arcpy.env.addOutputsToMap to my attention. Will take a look. Thanks!
... View more
11-10-2020
05:14 AM
|
0
|
0
|
190
|
POST
|
Working on a work-around for another conundrum and tried the following:
import arcpy
x = some X
y = some Y
point = arcpy.Point(x,y)
ptGeometry = arcpy.PointGeometry(point)
feature_class = arcpy.CreateFeatureclass_management("in_memory", "tempfc", "POINT")[0]
with arcpy.da.InsertCursor(feature_class, ["SHAPE@XY"]) as cursor:
cursor.insertRow(ptGeometry)
aprx = arcpy.mp.ArcGISProject("CURRENT")
symbologyLayer = r"<some path>...\someSymbology.lyrx"
arcpy.management.ApplySymbologyFromLayer(feature_class,symbologyLayer)
# Interestingly, the following works too
#arcpy.ApplySymbologyFromLayer_management(feature_class,symbologyLayer)
map = aprx.listMaps()[0]
map.addDataFromPath(feature_class)
So this works great in that I'm getting a symbol plotted where I needed. But it does that three (3) times giving me the following output.
Now, I realize I could try and control the place of insertion by using addLayer() and using the LYRX file directly after updating its data source. But the above output is not what I would expect based on what I'm doing. What's going on there?
... View more
11-09-2020
03:05 PM
|
0
|
5
|
218
|
POST
|
Last ditch effort to find someone who knows... These are steps I have taken to get me to where I am. Export JSON from web map Use Python to turn web map into APRX using a layout with 2 map frames. The MainMapFrame gets all the layers from JSON.including graphics created in web map. The other map frame gets layers as declared in layout template. Now, I'd like to copy one of the graphics layers from MainMapFrame to the other mapframe. So that I can print it all to PDF. Nothing has worked so far. I even tried this: myLayer = map1 . listLayers ( 'myLayer' ) [ 0 ] myLayer . saveACopy ( r "...\myLayer.lyrx" ) map2 . addLayer ( arcpy . mp . LayerFile ( r "...\mylayer.lyrx" ) ) Both map frames have same spatial reference and share other common service layers that display without any issues. Must be something about graphics.
... View more
11-05-2020
12:11 PM
|
0
|
0
|
98
|
POST
|
Wanted to add a little more context in the hopes of garnering some feedback. Using ConvertWebMapToArcGISProject to create a map. Now as part of the JSON, I'm ending up with a graphics layer. It looks something like this: { "mapOptions" : { . . . } , . . . } , "operationalLayers" : [ { "id" : "defaultBasemap" , . . . } , { "id" : "<map servce name>" , . . . . } , { "id" : "<mygraphicslayer>" , "opacity" : 1 , "minScale" : 0 , "maxScale" : 0 , "featureCollection" : { "layers" : [ { "layerDefinition" : { "name" : "pointLayer" , "geometryType" : "esriGeometryPoint" } , "featureSet" : { "geometryType" : "esriGeometryPoint" , "features" : [ { "geometry" : { "x" : someX , "y" : someY , "spatialReference" : { "wkid" : 102100 } } , . . . } ] } } ] } } ] } I can remove <mygraphicsLayer> from map by doing mymap.removeLayer(mymap.listLayers("pointLayer")[0] But I can't add this "pointLayer" to another map (see my first post). Is there any way to grab a portion of the JSON above... json . loads ( Web_Map_as_JSON ) [ 'operationalLayers' ][2] to define a layer and add it to another map? Such as ... json.loads(Web_Map_as_JSON)['operationalLayers'][2]["featureCollection"]["layers"][0] # doesnt seem to work ... or get some viable layer definition that can be fed into ... arcpy.JSONToFeatures_conversion() ... and then add those to the other map?
... View more
11-04-2020
10:15 AM
|
0
|
1
|
98
|
POST
|
This was terrific. I had a series of queries to make and was using a loop. I had a heckuva time trying to get to sense of all my callbacks completing at different times. Welcome to async hell. On a side note, I played some - only half successfully - with async/await before finding dojo/promise/all - is it true that this is a bad approach with the JSAPI ? Came across some post warning against it.
... View more
11-02-2020
03:55 PM
|
0
|
0
|
131
|
POST
|
Trying to get a graphics layer that was created from JSON (using the whole webmap to JSON workflow) from one map in APRX to another map using arcpy. I've tried this: myLayer = map1 . listLayers ( "myLayer" ) [ 0 ] map2 . addLayer ( myLayer ) map2 . listLayers ( ) The layer now shows up in the layer list. But I can't see it in the map. So I tried this: layerDef = json . loads ( Web_Map_as_JSON ) [ 'operationalLayers' ] [ < index of layer > ] map2 . addLayer ( map1 . listLayer ( "myLayer" ) [ 0 ] map2 . listLayers ( "myLayer" ) [ 0 ] . updateLayerFromJSON ( layerDef ) Everything runs without errors. I just don't get the added layer to display. Any suggestions?
... View more
11-02-2020
03:13 PM
|
0
|
2
|
143
|
POST
|
Never tried any of this but here is more on customization... Customize popup | Guide | ArcGIS API for JavaScript 3.34
... View more
10-22-2020
01:21 PM
|
0
|
0
|
133
|
POST
|
The article is pretty old but there is more general info on this page as well: Popup | ArcGIS API for JavaScript 3.34 if you're suing 3.x.
... View more
10-22-2020
10:28 AM
|
0
|
1
|
133
|
Online Status |
Offline
|
Date Last Visited |
2 weeks ago
|