|
POST
|
Okay, I think the problem may be solved. I carelessly didn't update my html according to the sample file on Rene's page here. There is a bit of dojoese in there the lack of which likely caused the above shown dojo related errors. Got my imports working...
... View more
04-04-2019
07:15 AM
|
0
|
0
|
2321
|
|
POST
|
Rene, this is the tsconfig I was using. I believe it's straight from the sample I was referencing with the exception of the 2 inserts I tried that are commented out. { "compilerOptions": { "module": "amd", "target": "es6", "esModuleInterop": true, "noImplicitAny": true, "sourceMap": true, "jsx": "react", "jsxFactory": "tsx", //"allowSyntheticDefaultImports": true, //added this based on https://github.com/Esri/jsapi-resources/issues/37 //"maintainModuleNames" : true, //added this based on https://github.com/Esri/esri-system-js/pull/10 "experimentalDecorators": true, "preserveConstEnums": true, "suppressImplicitAnyIndexErrors": true }, "include": [ "./app/*" ] , "exclude": [ "node_modules" ] } BTW, I enjoyed a number of your sessions at the Dev Summit... definitely some of the "impetus" behind my resolve to look at Typescript and React. But as I've said elsewhere on this forum, you did make my head explode a few times - haha.
... View more
04-04-2019
07:01 AM
|
0
|
0
|
2321
|
|
POST
|
Been wanting to get my feet wet with Typescript to start working on custom widgets and learning some React. So I've followed the example here, which worked like a charm. The Typescript code includes the new kind of imports, which I imagine any Pythonista will prefer of the traditional require syntax in Javascript. import Map = require("esri/Map");
import MapView = require("esri/views/MapView"); But I really wanted to get it to work like this, which would look even more like Python: import Map from "esri/Map";
import MapView from "esri/views/MapView";
When I try that, the code still compiles successfully. But I get these intellisense warnings about default exports... Since I'm new to Typescript, I will have to read up on this import/export business. In the meantime, is this an innocuous warning? Based on this thread, I should be trying the following: import * as Map from "esri/Map";
import * as MapView from "esri/views/MapView"; But that blows up completely... app/main.ts:10:13 - error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
10 const map = new Map({
~~~~~~~~~
11 basemap: "streets"
~~~~~~~~~~~~~~~~~~~~
12 });
~~
app/main.ts:7:1
7 import * as Map from "esri/Map";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Type originates at this import. A namespace-style import cannot be called or constructed, and will cause a failure at runtime. Consider using a default import or import require here instead.
This source suggests this setting in tsconfig.json "allowSyntheticDefaultImports": true When I try that, Dev Tools scream at me: Another tweak I tried came from here and looked like this: "maintainModuleNames" : true. But that didn't compile so well... tsconfig.json:13:7 - error TS5023: Unknown compiler option 'maintainModuleNames'. Long story short, if anything here screams rookie mistake, please comment. Would love to get these beautiful imports to work.
... View more
04-03-2019
03:31 PM
|
0
|
3
|
3398
|
|
POST
|
I am working on my local machine with JSAPI in VS Code, and I'm getting the following CORS related error thrown at me in Chrome Dev Tools: Access to XMLHttpRequest at 'https//... my environment ..../MapServer?f=json'
from origin 'http://localhost:8080' has been blocked by CORS policy:
No 'Access-Control-Allow-Origin' header is present on the requested resource. I've read enough about CORS to understand its purpose, and that according to ESRI, ... By default, ArcGIS Server allows cross-domain requests so Javascript clients can invoke the server's services from any domain.... (Restrict cross-domain requests to ArcGIS Server—ArcGIS Server Administration (Linux) | ArcGIS Enterprise) So I think no additional tweaks to the web server are warranted. I've been able to "work around" this by developing in a directory that's on the same Dev/Test box where my map services are running on. This works great. Additionally, I've reviewed 'Allowed Origins' in ArcGIS Server Administrator to make it meets my needs. Are there other adjustments I could make that would allow me to still do all my work locally and hit AGS map services without CORS issues? I get the sense from reading various threads online that a lot of folks new to working with JSAPI may be running into this. But I haven't found the ESRI documentation tremendously illuminating.
... View more
04-03-2019
03:11 PM
|
1
|
2
|
9993
|
|
POST
|
I've tried passing in a complete new dict or just the 'user' and 'password' values as you suggested. I've tried the approach of referencing another layer's connectionProperties suggested here: lyr = m.listLayers('some other layer')[0]
l.updateConnectionProperties(l.connectionProperties, lyr.connectionProperties) None of it is working. Darn!
... View more
03-25-2019
03:36 PM
|
0
|
1
|
8957
|
|
POST
|
When I publish an ArcGIS Server map service (10.6) to my federated AGS, a Portal item gets automatically created with a cute little thumbnail that's generated from the current extent in ArcGIS Pro when publishing from Pro. Is there a way I can preserve that item thumbnail through future version of the same service? It's great to be able to select "Overwirte Web Layer" in Pro but it would be nice for your those browsing content if the thumbnail didn't change every time you re-publish.
... View more
03-25-2019
03:11 PM
|
0
|
0
|
635
|
|
POST
|
Stephen, thanks. Appreciate you chiming. I realize that connection_info is a dictionary. But I wasn't sure how to use it. Keyword "database' only updates the database. I'm actually trying to switch this to use a different account (new 'user' and 'password') and was hoping to do so using a new SDE connection file. Can you maybe not to do? If you look at the other keys in the dict, I need more than 'database' to be updated. {'authentication_mode': 'DBMS',
'database': 'Prod',
'dbclient': 'sqlserver',
'db_connection_properties': 'myserver',
'password': '<*********>',
'instance': 'sde:sqlserver:myserver',
'server': 'myserver',
'user': 'myaccount',
'version': 'dbo.DEFAULT'} I am not an expert on these SDE connection files. But my understanding has always been that they store a reference to DB server/instance, DB name, authentication (and/pr password). So basically what's in the dictionary above. So merely updating 'database' in the dict wouldn't be sufficient, I think. To be safe, I tried it, and to no effect.
... View more
03-25-2019
12:00 PM
|
0
|
3
|
8958
|
|
POST
|
Okay, folks, this contribution of mine may not be plug and play. I agree with the above statements that type of problem is best solved with SQL. If that's not possible, it look like some sort of nested Update Cursors. I didn't go so far as to try that on some dummy feature class but I've been thinking about this all day (.. the likely reason being that I'm merely a programming hack and not a computer scientist). Anyway, if your table rows were just a list, this is what I came up with. It's really just some Friday fun... I'm sorry if it doesn't help you finish the job. Happy Friday. numbers = [1,2,3,4,17,1,18,19,20,5,6,34,35,27,28,29,17,56,57,58,59,343,12,35,36,78,79,80]
#Creates a list of list tracking counts of values
counter = [[num,0] for num in numbers]
#Creates a counter for each series of consecutive values
consec_cnt = 1
for i,item in enumerate(counter):
if i == 0:
item[1] = 1
elif item[0] == counter[i-1][0]+1:
consec_cnt += 1
item[1] = consec_cnt
if i == len(counter)-1:
hi = consec_cnt
for each in counter[i-hi+1:i+1]:
each.append(hi)
else:
hi = consec_cnt
consec_cnt = 1
item[1] = consec_cnt
for each in counter[i-hi:i]:
each.append(hi)
print(counter)
[[1, 1, 4], [2, 2, 4], [3, 3, 4], [4, 4, 4], [17, 1, 1], [1, 1, 1], [18, 1, 3], [19, 2, 3], [20, 3, 3], [5, 1, 2], [6, 2, 2], [34, 1, 2], [35, 2, 2], [27, 1, 3], [28, 2, 3], [29, 3, 3], [17, 1, 1], [56, 1, 4], [57, 2, 4], [58, 3, 4], [59, 4, 4], [343, 1, 1], [12, 1, 1], [35, 1, 2], [36, 2, 2], [78, 1, 3], [79, 2, 3], [80, 3, 3]]
#In this list, each item consists of the value from original list, a 1,2,3 for first, second, third consecutive, and a value of max consecutives in a row
... View more
03-22-2019
02:55 PM
|
0
|
0
|
1016
|
|
POST
|
So I've been busy publishing map services from an "old" standalone ArcGIS Server environment to Portal/Federated ArcGIS Server. Which means you create a map services and Portal creates a corresponding item. In the process, I've had to undo and clean up a few things. It's easy to wipe out map services with Python: from arcgis import gis
mygis = gis.GIS(url, username='arcgis_python')
gis_servers = gisprod.admin.servers.list()
server1 = gis_servers[0]
rest_folder = '<your_REST_endpoint_folder>'
map_services = server1.services.list(rest_folder)
for service in map_services:
try:
service.delete()
except Exception as e:
print(e.message) Alternatively, of course, you could simply select the services in ArcCatalog and delete them, if you're so inclined. But the script is convenient, when you have a list of services to remove. But now what happens is that the service gets removed but the Portal item representing the services does not. Which results in a broken item. This happens even if the item is protected. The proper way to clean things up would be by removing the Portal item, which takes the map services with it. item = gisprod.content.get('7db0bc4128eb4d819794815e4654a358')
item.delete(0) However, if the map services is gone, is there a way to link that item back to the service? If I publish the map service again, this creates a new item with a new item Id. The old one doesn't show up more. Also, for map services that show up as Portal items, what is the server id, when I interrogate dependencies: item.dependent_upon()
{'total': 1,
'start': 1,
'num': 1,
'nextStart': -1,
'list': [{'dependencyType': 'serverId', 'id': 'FK7U7Hisd6qRFdPK'}]}
What's the code 'FK7U7Hisd6qRFdPK' reference?
... View more
03-22-2019
01:10 PM
|
2
|
1
|
1493
|
|
POST
|
Trying to update data source for layers in ArcGIS Pro maps programmatically. So, I must be misunderstanding the syntax for doing that explained here. Because the following does not work: import arcpy
aprx = arcpy.mp.ArcGISProject(r'path to my project file')
#This gets me list of all the maps
maplist = aprx.listMaps()
#If I only want those belonging to MyGroup
mygroup = aprx.listMaps('MyGroup')[0]
#To get the layers in that group
grouplayers = mygroup.listLayers()
new_sdeConn = r'path to my SDE connection file'
for lyr in grouplayers:
old = lyr.connectionProperties #also tried lyr.connectionProperties['connection_info']
lyr.updateConnectionProperties(old, new_sdeConn) This doesn't throw an error. it just doesn't do update the data sources as desired. The ESRI example goes like: aprx.updateConnectionProperties(r'C:\Projects\YosemiteNP\Vector_Data\Yosemite.gdb',
r'C:\Projects\YosemiteNP\DBConnections\Server.sde') Does this maybe only work for the project as a whole?
... View more
03-22-2019
10:55 AM
|
1
|
35
|
22608
|
|
POST
|
Ok, still different from what I understood But I think I get it now.
... View more
03-22-2019
08:49 AM
|
0
|
0
|
4078
|
|
POST
|
Oh, I think, I get it... you don't want to be populating the 'Count' field with the current count, 1 for the 1st, 2 for the 2nd, but with the total count of consecutive numbers. So if there are 7 55's in field 1, field 2 should have the value 7 for all 55's. Is that it?
... View more
03-22-2019
08:20 AM
|
0
|
16
|
4078
|
|
POST
|
Didn't notice that but - OMG! - when will they ever get all these different versions of the API straightened out. How come 4.x still can't do what 3.x could! Who would release the new version of car when it has only 3 functioning wheels! Ok, I'll be quiet.
... View more
03-22-2019
07:59 AM
|
0
|
1
|
1596
|
|
POST
|
So which part of this is not working? Looks like you're trying to tackle this 2 ways.
... View more
03-22-2019
07:56 AM
|
0
|
18
|
4078
|
|
POST
|
Not entirely sure what you're trying to do but if you're trying to return attributes for a feature when click on a map created using JSAPI, does something like this not accomplish that: https://developers.arcgis.com/javascript/latest/sample-code/featurelayer-query/index.html ?
... View more
03-22-2019
07:23 AM
|
0
|
5
|
1596
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 08-16-2025 07:32 AM | |
| 1 | 02-09-2024 05:18 PM | |
| 1 | 02-04-2025 09:27 AM | |
| 1 | 03-22-2019 10:55 AM | |
| 1 | 03-05-2020 08:46 AM |
| Online Status |
Offline
|
| Date Last Visited |
Thursday
|