|
POST
|
Hi Karen/Stephen, I am running out of gas here... 😞 Following the documentation it works for me and not for you...?! The only thing I could think of, but that's just a wild guess, is that you are using an incorrect single quote?! Maybe someone else has an idea? Egge-Jan
... View more
04-04-2019
01:12 AM
|
0
|
1
|
8622
|
|
POST
|
Hi Randy, I don't think that's correct? When I use your syntax (with an epoch/UNIX timestamp in milliseconds) I get an error: 'where' parameter is invalid According to Sarah Scott's blog (Querying Feature Services: Date-Time Queries ) the syntax - using this converter https://www.epochconverter.com/ - should indeed be: fset = FL.query(where = 'DATE_LATEST_INSPECTION > TIMESTAMP \'2019-02-08 12:08:56\'') which in my case works correctly. Egge-Jan
... View more
04-04-2019
01:06 AM
|
0
|
1
|
8622
|
|
POST
|
Hi Stephen Usmar and Karen Smith, Hmmmm, it works for me, so maybe it should also work for you ...? I would suggest to try it again. It really comes down to the correct syntax - as soon as the syntax is not completely correct the query will fail. (There is no such thing as slightly correct or more or less OK syntax. Nope, it's got to be perfect, or otherwise it will refuse to run. In that sense computers are just like...) BTW - I am testing this in ArcGIS Online, which of course always offers the latest and the greatest version ("currentVersion" : 10.61). So, if you are running an older version of Portal, it might be that this syntax is not yet supported?! (What version are you running?) Anyway, let's try: If you go to your service's REST query page (e.g. https://some_place/some_id/arcgis/rest/services/My_Service/FeatureServer/0/query), the syntax should be: CreationDate > DATE '2019-03-26' In your Jupyter Notebook though, the syntax should be: fset = FL.query(where = 'CreationDate > DATE \'2019-03-26\'')
# i.e. use backslashes to escape the single quotes around the date Please let us know: is it your version not supporting this functionality OR did you manage to correct the syntax? Just try to help 🙂 Egge-Jan
... View more
04-03-2019
03:10 PM
|
0
|
6
|
8620
|
|
POST
|
Hi Karen Smith, I think your code should look like this: from arcgis.gis import GIS
item = gis.content.get('itemid')
FL = item.layers[0]
fset = FL.query(where = 'CreationDate > DATE \'2019-03-26\'')
# use backslashes to escape the single quotes around the date I found the answer in this recent blog - thanks to my good old friend G...: Querying Feature Services: Date-Time Queries It says: You can query esriFieldTypeDate (date-time) fields in two different ways: by DATE or TIMESTAMP date functions. Each type of date-time query must include a date function to make sure the query is treated in the proper way. <DateField> = DATE 'YYYY-MM-DD' <DateField> = TIMESTAMP 'YYYY-MM-DD HH:MI:SS' HTH, Egge-Jan
... View more
04-03-2019
04:10 AM
|
1
|
8
|
8620
|
|
POST
|
Hi Kristian, Please have a look at the sample below. This works for me: Login to ArcGIS Online Select the relevant layer of your Hosted Feature Layer Create an update_dict with your coded values in the correct order and apply this to the relevant field with update_definition() Does this answer your question? Cheers, Egge-Jan # This script should be run within a specific ArcGIS/Python environment using the batch file below
# (This batch file comes with the installation of ArcGIS Pro)
# "C:\Program Files\ArcGIS\Pro\bin\Python\scripts\propy.bat" update_coded_value_domains.py
from arcgis.gis import GIS
from provide_credentials import provide_credentials
username, password = provide_credentials()
my_agol = GIS("https://www.arcgis.com", username, password)
# Get the first layer - Layer 0 - of your Hosted Feature Layer with ID <HFL_ID>
lyr = my_agol.content.get('<HFL_ID>').layers[0]
# Add domain values to the field "Color"
update_dict = {"fields": [
{
"name": "Color",
"domain": {"type":"codedValue","name":"MY_CODED_VALUE_DOMAIN",
"codedValues":[{"name":"Blue","code":"Blue"},
{"name":"Green","code":"Green"},
{"name":"Orange","code":"Orange"},
{"name":"Red","code":"Red"},
{"name":"Yellow","code":"Yellow"}]}
}
]}
update = lyr.manager.update_definition(update_dict)
print(update) # Should give {'success': True}
... View more
04-01-2019
02:12 PM
|
5
|
1
|
5301
|
|
POST
|
Hi Ebrar, Can you please tell us what steps you have taken so far and where you got stuck? For a general introduction to the implementation of multivariate statistical analysis in ArcGIS, you might have a look at the documentation: For ArcGIS Pro: An overview of the Multivariate toolset—Help | ArcGIS Desktop and following pages. For ArcMap: An overview of the Multivariate toolset—Help | ArcGIS Desktop and following pages Cheers, Egge-Jan
... View more
03-31-2019
02:05 AM
|
0
|
0
|
1159
|
|
POST
|
Hi Kai, You might go and search for a tool to download an entire website for offline reading... But I just wondered: why would you like to have the docs offline? The ArcGIS API for Python is designed to interact with your web GIS. So to implement or test what you read in the manual you will have to be online anyway. Sorry, just curious... Egge-Jan
... View more
03-30-2019
04:49 AM
|
0
|
0
|
721
|
|
POST
|
Hi Angel, You are not the first - and most probably will not be the last - to notice the ability to group layers is missing in ArcGIS Online... What you could do for the moment is to upvote this idea on the Ideas list: Group layers for ArcGIS online This idea was first listed in November 2014 and has since then been voted for many times by many users and currently has the status In Product Plan. So, it looks like they are working on it. HTH, Egge-Jan
... View more
03-30-2019
04:04 AM
|
2
|
0
|
3327
|
|
POST
|
Yeah, but to make life more complicated than it should be: both ArcMap and ArcGIS Pro are considered to be part of ArcGIS Desktop: Powerful Desktop GIS | ArcGIS Desktop So, good reason to stick with good old ArcGIS Desktop ArcMap for the years to come...
... View more
03-28-2019
07:26 AM
|
1
|
0
|
4620
|
|
POST
|
I have had a quick look with Online regex tester and debugger: PHP, PCRE, Python, Golang and JavaScript Your expression meets your requirements, according to the test: for example GS654321 is highlighted, whereas DQ7654321 is not. So there should be another reason your regex does not work...?
... View more
03-28-2019
07:02 AM
|
0
|
2
|
1804
|
|
POST
|
This doesn't sound like a nice and smooth UX. It is good that you have written it down. Let's hope Esri will have a look at it and come with a useful answer. Sorry, can't help you - still using good old ArcMap for all non-automated tasks...
... View more
03-28-2019
06:35 AM
|
1
|
0
|
4620
|
|
POST
|
Hi, An alternative solution would be to add the new field with the domains directly in Portal on the layer's item page. This would save you the effort to download and make the changes in ArcGIS Pro and upload again. See pages below - this is true for Portal for ArcGIS 10.7: http://enterprise.arcgis.com/en/portal/latest/use/work-with-fields.htm http://enterprise.arcgis.com/en/portal/latest/use/add-or-delete-fields.htm http://enterprise.arcgis.com/en/portal/latest/use/define-attribute-lists-and-ranges.htm HTH, Egge-Jan
... View more
03-28-2019
03:32 AM
|
0
|
1
|
858
|
|
BLOG
|
Define Area of Interest on Hosted Feature Layer View using ArcGIS API for Python Let's say you are responsible for a Hosted Feature Layer with data for the whole country and you want to share these data with regional teams in such a way that they are able to see only records in their own region. For many practical reasons you don't want to divide your data over multiple Hosted Feature Layers. You want to create regional views on the data instead. You can draw these regions manually, following the procedure on this page: https://doc.arcgis.com/en/arcgis-online/manage-data/set-view-definition.htm But hey, you know your regions, and you don't want to draw them by hand. Instead you want to use existing geometry and create the views automatically. In the example below we use data from the Netherlands. We have a data set with police stations ('Politiebureaus') and one with provinces ('Provincies (Bestuurlijke Grenzen 2019)') - with the ArcGIS Online Assistant we have copied these data sets to our own environment. See the script below how we create twelve views - one for each province - showing only the police stations within the provincial boundaries Hope this helps! P.S. for another example - setting a view definition - you might have a look at this blog https://community.esri.com/groups/arcgis-python-api/blog/2019/02/11/using-the-arcgis-api-for-python-to-create-a-view-from-a-hosted-feature-layer-and-to-define-a-view-fefinition by Earl Medina. ## ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
## Script: agol_define_areas_of_interest_on_hosted_feature_layer_views.py
## Goal: to define an area of interest on multiple hosted feature layer views using input geometry
## Author: Egge-Jan Polle - Tensing GIS Consultancy
## Date: March 27, 2019
## ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#
# This script should be run within a specific ArcGIS/Python environment using the batch file below
# (This batch file comes with the installation of ArcGIS Pro)
# "C:\Program Files\ArcGIS\Pro\bin\Python\scripts\propy.bat" agol_define_areas_of_interest_on_hosted_feature_layer_views.py
from arcgis.gis import GIS
from arcgis.features import FeatureLayerCollection
from provide_credentials import provide_credentials
username, password = provide_credentials()
my_agol = GIS("https://www.arcgis.com", username, password)
# The Hosted Feature Layer containing a countrywide dataset
police_stations = my_agol.content.get('<itemID>')
police_stations_flc = FeatureLayerCollection.fromitem(police_stations)
# The Hosted Feature Layer containing the regional division
provinces = my_agol.content.get('<itemID>').layers[0].query()
# Get the Spatial Reference
spat_ref = provinces.spatial_reference
# Loop through the regional division to create the views
for index, province in enumerate(provinces):
prov_name = provinces.features[index].attributes['Provincienaam'].upper().replace('-','_')
print(prov_name)
view_name = police_stations.name + "_" + prov_name + "_View"
print(view_name)
# Get the geometry for the regions
view_geom = provinces.features[index].geometry.get('rings')
new_view = police_stations_flc.manager.create_view(name=view_name)
# Search for newly created View
view_search = my_agol.content.search(view_name)[0]
view_flc = FeatureLayerCollection.fromitem(view_search)
service_layer = view_flc.layers[0]
# Populate the update_dict with the geometry and the spatial reference
update_dict = {"viewLayerDefinition":{"filter":
{"operator":"esriSpatialRelContains","value":
{"geometryType":"esriGeometryPolygon","geometry":
{"rings": view_geom,
"spatialReference":spat_ref}}}}}
# Update the definition to include the Area of Interest
service_layer.manager.update_definition(update_dict)
print('Done!')
... View more
03-27-2019
08:06 AM
|
7
|
1
|
3035
|
|
POST
|
If you use the VBScript parser you can use vbCrLf for new lines, like: [Field1] & vbCrLf & [Field2] See screendump below for an example:
... View more
03-27-2019
02:09 AM
|
1
|
1
|
15102
|
|
POST
|
OK - would not know how to accomplish that. Let's see what others have to say about it...
... View more
03-25-2019
09:59 AM
|
0
|
0
|
9326
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 03-30-2020 09:03 AM | |
| 2 | 12-12-2024 03:56 AM | |
| 2 | 04-15-2024 03:25 AM | |
| 2 | 03-25-2024 02:06 PM | |
| 1 | 01-17-2024 10:19 AM |
| Online Status |
Offline
|
| Date Last Visited |
3 weeks ago
|