Skip to content

About

Export CA Transit Routes, HQ Transit Stops, etc from the data warehouse to the open data portal via ArcGIS export and DRISI intake form.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

65 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

README

Open Data Portal

  1. HQTA Areas: metadata feature server or map server
  2. HQTA Stops: metadata feature server or map server
  3. CA Transit Routes: metadata feature server or map server
  4. CA Transit Stops: metadata feature server or map server
  5. CA Average Transit Speeds by Stop-to-Stop Segments: metadata feature server or map server
  6. CA Average Transit Speeds by Route and Time of Day: metadata feature server or map server
  7. All GTFS datasets metadata/data dictionary

GTFS Schedule Routes & Stops Geospatial Data

Traffic Ops had a request for all transit routes and transit stops to be published in the open data portal.

  1. Update update_vars.py for current month
  2. In terminal: make create_gtfs_schedule_geospatial_open_data

stops_routes_mermaid

Metadata Automation Steps and References

  1. If this is the first time running, do the following:
    • Create a new ArcGIS Pro project. In its home folder, place the HQRail .sde file, which you will need provided to you.
    • Download and install Microsoft SQL Server. This will require assistance from IT.
  2. Add all datasets that are to be pulished to the RUN_ME list in update_vars.py.
  3. Add all datasets that are to be published to catalog.yml and run gcs_to_esri.
    • In terminal: cd open_data followed by python gcs_to_esri.py
    • Since this file is under source control, it only needs to be changed if new datasets are being added.
    • The log will show basics like column names and EPSG. Make sure the metadata reflects the same info!
    • Only use EPSG:4326 (WGS84). All open data portal datasets will be in WGS84.
  4. If there are new datasets to add or changes to make, make them in metadata.yml and/or data_dictionary.yml.
    • If there are changes to make in metadata.yml, make them. Afterwards, in terminal, run: python supplement_meta.py
  5. If there are changes to be made to metadata.yml (adding new datasets, changing descriptions, change contact information, etc), make them. This is infrequent. An updated analysis date is already automated and does not have to be updated here.
  6. In the JupyterHub terminal: python supplement_meta.py
  7. In the JupyterHub terminal: python update_data_dict.py.
    • Check the log results, which tells you if there are columns missing from data_dictionary.yml. These columns and their descriptions need to be added. Every column in the ESRI layer must have a definition, and where there's an external data dictionary website to cite, provide a definition source.
  8. In the JupyterHub terminal: python update_fields_fgdc.py. This populates fields with data_dictionary.yml values.
    • Only run if update_data_dict had changes to incorporate
  9. Download all zipped shapefiles created by gcs_to_esri.py and metadata.json to your ArcGIS project directory. Delete any existing xml files in this directory that may have been generated in prior runs.
  10. Open ArcGIS Pro to the project with the .sde file.
  11. In ArcGIS, run the ArcGIS Notebook to create XML files.
    • Download arcgis_pro_script.py and arcgis_pro_notebook_sample.ipynb to your ArcGIS project.
    • Open the notebook in ArcGIS and update the value of arcpy.env.workspace to match the path to your ArcGIS working directory. This is likely the directory created as your ArcGIS "project", and should contain your downloaded files.
    • Run the notebook up to the markdown instructions to "Do field data dictionary updates in Jupyter Hub".
    • Check that two xml files have been updated per dataset, one should have have the same name of the dataset and one should be suffixed _fgdc.
  12. Upload the non-fgdc XML files to JupyterHub at open_data/xml/.
  13. In the JupyterHub terminal: python metadata_update_pro.py.
    • The overwritten XML is stored in open_data/xml/run_in_esri/.
    • Download the overwritten XML files locally to run in ArcGIS.
  14. For each dataset, update the FGDC XML:
    • From the ribbon, select "View", then "Catalog view" (not to be confused with the Catalog pane)
    • From the tab that opens, open "Folders", then your project's working directory, then open staging.gdb
    • You should see a list of each dataset. For each dataset, select it (click once), then from the ribbon select "Catalog" then Import in the metadata section. There will likely be several identically labeled buttons that say "Import", but only the one within the metadata section is useful here.
    • You should see a popup window with two display boxes - one that says "Import metadata from", and one that says "The type of metadata to import". In "Import metadata from" box, enter the path to the *_fgdc.xml file that was generated earlier. You should be able to open a file browser with the little folder icon. In the "The type of metadata to import" box, select the option containing "FGDC".
    • Please also add the corresponding thumbnail image, via the "edit metadata" option.
    • Repeat this process for each dataset.
  15. Run the remainder of the ArcGIS notebook after importing the updated XML metadata for each feature class.
    • Note that since you re-started ArcGIS, the notebook's kernel will restart and you will need to re-run the first few cells.
    • We no longer have an enterprise geodatabase (.sde) for this workflow, instead zip and upload the completed file geodatabase dds_data_sci_open_data.gdb, fill out the open data request form with a link to that file.
    • There are steps to create FGDC templates for each datasets to store field information, but this only needs to be done once when a new dataset is created.
  16. In terminal: python cleanup.py to clean up old XML files and remove zipped shapefiles.
    • The YAML and XML files created/have changes get checked into GitHub.

Metadata

  • Metadata
  • Data dictionary
  • update_vars contains a lot of the variables that would frequently get updated in the publishing process.
    • Apply standardized column names across published datasets, even they differ from internal keys (org_id in favor of gtfs_dataset_key, agency in favor of organization_name).
    • Since we do not save multiple versions of published datasets, the columns are renamed prior to exporting the geoparquet as a zipped shapefile.

Open Data Intake Process

  • Do a final check of datasets uploaded to the enterprise geodatabase (column names? metadata? record counts?).
    • Check that column names match your expectations
    • Check that metadata is correct.
      • To view all metadata, you may need to select "Project" from the ArcGIS ribbon, then "Options", then "Metadata", then from the dropdown labeled "Metadata style" select "FGDC CSDGM Metadata"
      • The CRS should be EPSG:4326, and all columns should have a description
    • Check that the geographic extent of each layer seems plausible
    • Check that the number of records is comparable to the number of records for the prior month.
  • Open a ticket on the Intranet to update or add new services and provide justification

About

Export CA Transit Routes, HQ Transit Stops, etc from the data warehouse to the open data portal via ArcGIS export and DRISI intake form.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages