ArcGIS is a geographical information system for working with maps and geographic information. ArcGIS was developed by Environmental Systems Research Institute aka ESRI. ArcGIS platforms initial release was 21 years earlier. ArcGIS is used for creating and using maps, compiling geographic data, analyzing mapped information, sharing and discovering geographic information, using maps and geographic information in a range of applications, and managing geographic information in a database.
Inside the ArcGIS application bundle, we have so many tools for data collection and data analytics. Survey123 is a very useful app to collect data from the field and itβs very easy to configure. Once we collected our data using survey123 we can generate reports and analyse data using inbuilt web gis tools. The use of web gis tools is very time consuming and hard to work with a big data set. So the ArcGIS have its python modules to work and generate reports with feature layers.
We can use the ArcGIS python module to access those inbuilt functionalities.
import arcgis
from arcgis.gis import GIS
now we have imported all the modules we need to get going.
next, we have to log in to the ArcGIS. Iβm writing this code inside my main function.
def main():
gis = GIS(username="USERNAME", password="PASSWORD")
The next step is to access our survey manager.
survey_manager = arcgis.apps.survey123.SurveyManager(gis)
For future steps, we need to find our survey id.
surveys = survey_manager.surveys
p = [print(s.properties['id'], s.properties['title']) for s in surveys]
this code will print the survey id and its title so you can find your relevant survey id for further steps. The next step is to access our survey using survey id.
survey_by_id = survey_manager.get("Survey_ID")
To ensure we have accessed our survey use the next code to print properties of the survey.
print(survey_by_id.properties)
This code will print the survey properties and the next step is to access our template to generate reports.
templates = survey_by_id.report_templates
this code will output a list and if we have uploaded a new template it will stay in templates[1]. The ArcGIS default template is templates[0]
Finally, we can generate our report. You can replace where parameter with your own column name and data to query a record and generate reports.
report = survey_by_id.generate_report(templates[1], where="column=data")
This will generate your report in Docx format and download it into C:\Users\Admin\AppData\Local\Temp\ folder.
For further customizations, you can use a dynamic where parameter.
ex:
Query_String = input("Enter Query String ")
Where_Parameter = f"Field_Name = {Query_String}"
report = survey_by_id.generate_report(templates[1], where=Where_Parameter)
Hope you got an idea about feature report generation in Survey123. Thank you!
Top comments (0)