No dataset returned for geocoding

318
8
Jump to solution
04-22-2024 05:01 PM
Jades1
by
New Contributor III

Hi all,

I'm comparatively new to ArcGIS and am trying to automate Geocoding. Since there is protected health information, I am performing this in ArcGIS pro with Jupyter notebook (though I'm having this issue both with and without using the Python script) and a locator. I have not had this issue in the past: only the data has changed (still a csv file). (I've always had to go into the ArcGIS "MyProject" folder to find the .gbd table (not sure if there is another way of doing this, retrieving the individual .gbd table vs a feature layer--or another file that I can actually name is kind of a pain).

You can see from the map that there are addresses geocoded.

Jades1_0-1713829814171.png

However, when I look through the ArcGIS project folder and find the appropriate .gbd table. It just shows this

Jades1_1-1713829935323.png

 

Here is the script and also a screenshot of the fields I've completed in the Arc pro interface.

arcpy.geocoding.GeocodeAddresses(

    in_table=r"C:/Users/Jades/OneDrive - University of California, San Diego Health/CASRC - Mcdonald, Kate's files/network_adequacy/01_tidy_data/cyf_geocoding.csv",

   address_locator="https://utility.arcgis.com/usrsvcs/servers/b7e1ad94008740ad9fb4e4d59b04fe78/rest/services/Locators/N...",

    in_address_fields="'Address or Place' ADDR1 VISIBLE NONE;Address2 ADDR2 VISIBLE NONE;Address3 <None> VISIBLE NONE;Neighborhood <None> VISIBLE NONE;City CITY VISIBLE NONE;County <None> VISIBLE NONE;State ST VISIBLE NONE;ZIP ZIP VISIBLE NONE;ZIP4 <None> VISIBLE NONE;Country <None> VISIBLE NONE",

   out_feature_class=r"C:\Users\Jades\Documents\ArcGIS\Projects\MyProject1\MyProject1.gdb\cyf_geocoding_GeocodeAddress",

    out_relationship_type="STATIC",

    country=None,

    location_type="ROUTING_LOCATION",

    category=None,    output_fields=""

)


 
Updating Media

 

0 Kudos
2 Solutions

Accepted Solutions
HannesZiegler
Esri Contributor

@Jades1 you will not be able to identify individual featureclasses when viewing a geodatabase in file explorer, just the mess of files you shared in your screenshot. To see individual featureclasses you have to use ArcGIS Pro's Catalog pane. You can use arcpy.ListFeatureClasses, but make sure to first set the arcpy.env.workspace environment variable to the path of your geodatabase to list all the featureclasses within it. Regarding converting the featureclass to a spatially enabled dataframe (SEDF), see from_featureclass in arcgis.features module | ArcGIS API for Python.

EX:

 

import arcgis
import pandas as pd

# Convert a Featureclass to an ArcGIS API SEDF.
nsowlnests_path = r'C:\data\forestry.gdb\northern_spotted_owl_nests'
nsowlnests_sedf = pd.DataFrame.spatial.from_Featureclass(nsowlnests_path)

 

 

View solution in original post

Jades1
by
New Contributor III

This is perfect. Thanks so much!

Yeah, it really is a mess of files, so I was trying to deal with the feature layer itself and pull it into Jupyter such that I could manipulate it. Seems like arcpy doesn't really have anything. I'm familiar with ArcGIS API from using AGOL (not so familiar with ArcGIS Pro). Seems like it's probably best to just use both arcpy and arcgis.

Thanks for this!

View solution in original post

8 Replies
ShanaBritt
Esri Regular Contributor

@Jades1 Is the output feature class named "cyf_geocoding_GeocodeAddress" not listed in the Contents pane in ArcGIS Pro? You should be able to view the "MyProject1.gdb" file geodatabase in your project in Catalog pane underneath Databases or in the MyProject1 folder under the Folders item.

ShanaBritt_0-1715199044518.png

 

0 Kudos
Jades1
by
New Contributor III

Hi Shana,

Thanks! This is what I see:

Jades1_2-1715359993278.png

When I look under my project in Arc this is what the output of files looks like:

Jades1_1-1715359966580.png

 

0 Kudos
ShanaBritt
Esri Regular Contributor

@Jades1 , The Project folder in your case is named "MyProject1" and within the project is the default file geodatabase which has the same name as the project "MyProject1.gdb". The file geodatabase (.gdb) shows up in Windows Explorer or File Explorer as a file folder and  you won't find the feature class name listed in the geodatabase folder there. In the Catalog pane if you expand Folders item, you will see "MyProject1" as the folder and the "MyProject1.gdb" listed as well. Below are some resources for more details about file geodatabases:

https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/overview/types-of-geodatabases.htm#G...

https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/overview/what-is-a-geodatabase-.htm

https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/overview/fundamentals-of-the-geodata...

What is it that you are trying to do with the "cyf_geocoding_GeocodeAddress" feature class in the "MyProject1.gdb" file geodatabase?

Here is another resource to help you get started with ArcGIS Pro. https://pro.arcgis.com/en/pro-app/latest/get-started/pro-quickstart-tutorials.htm

 

 

0 Kudos
Jades1
by
New Contributor III

Okay, thanks for this! So I am trying to pull that feature class/layer "cyf_geocoding_GeocodeAddress" into Jupyter notebook (python) and then change it to an sdf to be able to manipulate it in python. When I use the ListFeatureClasses() command, it seems that it is just a list of strings vs the feature class itself, so how do I actually grab that feature class: "cyf_geocoding_GeocodeAddress"?

0 Kudos
HannesZiegler
Esri Contributor

@Jades1 you will not be able to identify individual featureclasses when viewing a geodatabase in file explorer, just the mess of files you shared in your screenshot. To see individual featureclasses you have to use ArcGIS Pro's Catalog pane. You can use arcpy.ListFeatureClasses, but make sure to first set the arcpy.env.workspace environment variable to the path of your geodatabase to list all the featureclasses within it. Regarding converting the featureclass to a spatially enabled dataframe (SEDF), see from_featureclass in arcgis.features module | ArcGIS API for Python.

EX:

 

import arcgis
import pandas as pd

# Convert a Featureclass to an ArcGIS API SEDF.
nsowlnests_path = r'C:\data\forestry.gdb\northern_spotted_owl_nests'
nsowlnests_sedf = pd.DataFrame.spatial.from_Featureclass(nsowlnests_path)

 

 

Jades1
by
New Contributor III

This is perfect. Thanks so much!

Yeah, it really is a mess of files, so I was trying to deal with the feature layer itself and pull it into Jupyter such that I could manipulate it. Seems like arcpy doesn't really have anything. I'm familiar with ArcGIS API from using AGOL (not so familiar with ArcGIS Pro). Seems like it's probably best to just use both arcpy and arcgis.

Thanks for this!

HannesZiegler
Esri Contributor

Ah, if you are looking for a way to manipulate individual records in the featureclass/table with ArcPy, take a look at the arcpy.da cursors. You might still prefer working with the pandas DataFrame instead if that is what you are used to, but the capability to manipulate records does exist in ArcPy.

Jades1
by
New Contributor III

Yeah, thanks. Still learning about cursors; I don't think there will be any way of avoiding it; I used cursors to get the pandas DF into format for fastest route network problem. Good to know that that fits within arcpy's purview of manipulating a df. It just seems pretty clunky to me. I think when I can avoid it, using Arcgis features will be the way to go.

0 Kudos