Skip to content

Commit a0bec2b

Browse files
committed
fix: pr feedback
1 parent be60c14 commit a0bec2b

File tree

1 file changed

+24
-20
lines changed

1 file changed

+24
-20
lines changed

notebooks/Generate PDF Report/Generate PDF Report.ipynb

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"source": [
99
"# Generate PDF Report\n",
1010
"\n",
11-
"This example shows how to generate an HTML and PDF report for a specific feature layer. It demonstrates how to create a report that includes summary statistics, photos, maps, and attribute information. In this example we are going to work with a tree inventory layer that was deployed using this [ArcGIS Solution template](https://www.arcgis.com/apps/solutions/index.html?gallery=true&searchTerm=Tree%20Management&solution=vrrh5yvnj1b8ba2tkfab6kf36c2t18np).\n",
11+
"This example shows how to generate an HTML and PDF report for a specific feature layer. It demonstrates how to create a report that includes summary statistics, photos, maps, and attribute information. In this example we are going to work with a tree inventory layer that was deployed using this [ArcGIS Solution template](https://www.arcgis.com/apps/solutions/index.html?gallery=true&searchTerm=Tree%20Management&solution=vrrh5yvnj1b8ba2tkfab6kf36c2t18np) and the Trees Hosted Layer or Trees_public Hosted Layer View. \n",
1212
"\n",
1313
"This notebook was originally created as part of DevSummit 2021."
1414
]
@@ -44,7 +44,7 @@
4444
}
4545
],
4646
"source": [
47-
"gis = arcgis.gis.GIS(\"<org>\", \"<username>\")\n",
47+
"gis = arcgis.gis.GIS(\"https://www.arcgis.com\", \"<username>\")\n",
4848
"item = gis.content.get(\"<item-id>\")\n",
4949
"trees_layer = item.layers[0]"
5050
]
@@ -124,25 +124,29 @@
124124
"def get_location_data(exif_data):\n",
125125
" gps_info = exif_data.get_ifd(ExifTags.IFD.GPSInfo)\n",
126126
" time = dt.now()\n",
127-
" if gps_info is None:\n",
128-
" return (0, 0)\n",
127+
" try:\n",
129128
"\n",
130-
" lat_degrees = gps_info[ExifTags.GPS.GPSLatitude][0]\n",
131-
" lat_minutes = gps_info[ExifTags.GPS.GPSLatitude][1]\n",
132-
" lat_seconds = gps_info[ExifTags.GPS.GPSLatitude][2]\n",
133-
" lon_degrees = gps_info[ExifTags.GPS.GPSLongitude][0]\n",
134-
" lon_minutes = gps_info[ExifTags.GPS.GPSLongitude][1]\n",
135-
" lon_seconds = gps_info[ExifTags.GPS.GPSLongitude][2]\n",
129+
" lat_degrees = gps_info[ExifTags.GPS.GPSLatitude][0]\n",
130+
" lat_minutes = gps_info[ExifTags.GPS.GPSLatitude][1]\n",
131+
" lat_seconds = gps_info[ExifTags.GPS.GPSLatitude][2]\n",
132+
" lon_degrees = gps_info[ExifTags.GPS.GPSLongitude][0]\n",
133+
" lon_minutes = gps_info[ExifTags.GPS.GPSLongitude][1]\n",
134+
" lon_seconds = gps_info[ExifTags.GPS.GPSLongitude][2]\n",
136135
"\n",
137-
" lat = float(lat_degrees + lat_minutes / 60 + lat_seconds / 3600)\n",
138-
" lon = float(lon_degrees + lon_minutes / 60 + lon_seconds / 3600)\n",
136+
" lat = float(lat_degrees + lat_minutes / 60 + lat_seconds / 3600)\n",
137+
" lon = float(lon_degrees + lon_minutes / 60 + lon_seconds / 3600)\n",
139138
"\n",
140-
" if gps_info[ExifTags.GPS.GPSLatitudeRef] == \"S\":\n",
141-
" lat = -lat\n",
142-
" if gps_info[ExifTags.GPS.GPSLongitudeRef] == \"W\":\n",
143-
" lon = -lon\n",
144-
" if ExifTags.GPS.GPSTimeStamp in gps_info:\n",
145-
" time = gps_info[ExifTags.GPS.GPSTimeStamp]\n",
139+
" if gps_info[ExifTags.GPS.GPSLatitudeRef] == \"S\":\n",
140+
" lat = -lat\n",
141+
" if gps_info[ExifTags.GPS.GPSLongitudeRef] == \"W\":\n",
142+
" lon = -lon\n",
143+
" if ExifTags.GPS.GPSTimeStamp in gps_info:\n",
144+
" time = gps_info[ExifTags.GPS.GPSTimeStamp]\n",
145+
"\n",
146+
" except Exception as e:\n",
147+
" lat = 0\n",
148+
" lon = 0\n",
149+
" time = dt.now()\n",
146150
"\n",
147151
" return (lat, lon, time)"
148152
]
@@ -312,7 +316,7 @@
312316
],
313317
"metadata": {
314318
"kernelspec": {
315-
"display_name": "cartopy-dev",
319+
"display_name": "field-maps-scripts-99999",
316320
"language": "python",
317321
"name": "python3"
318322
},
@@ -326,7 +330,7 @@
326330
"name": "python",
327331
"nbconvert_exporter": "python",
328332
"pygments_lexer": "ipython3",
329-
"version": "3.10.11"
333+
"version": "3.11.11"
330334
}
331335
},
332336
"nbformat": 4,

0 commit comments

Comments
 (0)