-
Notifications
You must be signed in to change notification settings - Fork 1
/
Fetch_v3.5.py
804 lines (700 loc) · 60 KB
/
Fetch_v3.5.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
#Python3
#This program creates geofence data based on user input and plotting locations provided in CSV, TSV, and Excel formats
# TO DO - Time slider is not updated when picking dates w calendar, declutter
# Remove export button from inside of maps that exports geojson files
# Support parsing KML as input
# Add time filter support to cell site maps
# Add details to cell site sector wedges
import simplekml #the library used to map longitudes and latitudes on google earth
import pandas #used to read spreadsheet data
import re
import operator
import streamlit as st
import chardet # used to check file encodings
import os
from polycircles import polycircles # creates kml polygons
import leafmap.foliumap as leafmap # maps
from leafmap.foliumap import plugins # maps
import geopandas
import folium # maps
from math import asin, atan2, cos, degrees, radians, sin # calculates shapes and polygons on sphere
from folium.plugins import Draw, Geocoder
from streamlit_folium import st_folium # used to create geofences
import datetime
import geocoder # search bar for geofence, api calls for address and ip lookups
import gpxpy
import numpy as np
now = datetime.datetime.now()
st.set_page_config(
page_title="Fetch v3.5",
#page_icon="🔴",
layout="wide",
initial_sidebar_state="expanded",
menu_items={}
)
logo = ("iVBORw0KGgoAAAANSUhEUgAAASUAAABZCAYAAAB48DJ5AAAEDmlDQ1BrQ0dDb2xvclNwYWNlR2VuZXJpY1JHQgAAOI2NVV1oHFUUPpu5syskzoPUpqaSDv41lLRsUtGE2uj+ZbNt3CyTbLRBkMns3Z1pJjPj/KRpKT4UQRDBqOCT4P9bwSchaqvtiy2itFCiBIMo+ND6R6HSFwnruTOzu5O4a73L3PnmnO9+595z7t4LkLgsW5beJQIsGq4t5dPis8fmxMQ6dMF90A190C0rjpUqlSYBG+PCv9rt7yDG3tf2t/f/Z+uuUEcBiN2F2Kw4yiLiZQD+FcWyXYAEQfvICddi+AnEO2ycIOISw7UAVxieD/Cyz5mRMohfRSwoqoz+xNuIB+cj9loEB3Pw2448NaitKSLLRck2q5pOI9O9g/t/tkXda8Tbg0+PszB9FN8DuPaXKnKW4YcQn1Xk3HSIry5ps8UQ/2W5aQnxIwBdu7yFcgrxPsRjVXu8HOh0qao30cArp9SZZxDfg3h1wTzKxu5E/LUxX5wKdX5SnAzmDx4A4OIqLbB69yMesE1pKojLjVdoNsfyiPi45hZmAn3uLWdpOtfQOaVmikEs7ovj8hFWpz7EV6mel0L9Xy23FMYlPYZenAx0yDB1/PX6dledmQjikjkXCxqMJS9WtfFCyH9XtSekEF+2dH+P4tzITduTygGfv58a5VCTH5PtXD7EFZiNyUDBhHnsFTBgE0SQIA9pfFtgo6cKGuhooeilaKH41eDs38Ip+f4At1Rq/sjr6NEwQqb/I/DQqsLvaFUjvAx+eWirddAJZnAj1DFJL0mSg/gcIpPkMBkhoyCSJ8lTZIxk0TpKDjXHliJzZPO50dR5ASNSnzeLvIvod0HG/mdkmOC0z8VKnzcQ2M/Yz2vKldduXjp9bleLu0ZWn7vWc+l0JGcaai10yNrUnXLP/8Jf59ewX+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P95RGs2RRHBT1lR/bzcade+XCkSEg0xBmVLcsdI7tOV3Fq6nBg93Agq0FJLEgFJjlVTmRCOLfigEQ0dBsfegJVmE41T3wZxnefrDW7qpgVUceGZPHJOToc6EIcyHpQEi+1LK1tkuVgeOlhuTh7vwAqij3IZX6kRq7CLdoYxaPMtf3k7CZjQwoxEtvJh9SFeqFTVYcDKRzoEqCk+sqRr4ihIfIWtUk+J6k+KL0Ya7SO3++K45ZdtvPucMDhwJ7hQJcBJZs92g0iQKeOBkpIctTS6loOvcqaGQQU2UMOhnbdnHeHAw4Hdp0D9CvtWhT2llq7QTAvNLPgmvCUqI9xYVa8bdd6GKe2DgccDmzDgS4nKW3zBM4JhwMOB/YqDlDWcMjhgMMBhwPZwwEHlLKnLZyaOBxwOEAOOKDkdAOHAw4HsooDDihlVXM4lXE44HDAASWnDzgccDiQVRxwQCmrmsOpjMMBhwMOKDl9wOGAw4Gs4sD/A+QI/vOwZ2BeAAAAAElFTkSuQmCC")
header_html = "<img src='data:image/png;base64,{}' class='img-fluid'>".format(logo)
st.markdown(
header_html, unsafe_allow_html=True,
)
#Custom button color to bring prominence to executable actions
m = st.markdown("""
<style>
div.stButton > button:first-child {
background-color: #ff0000;
color:#ffffff;
}
div.stButton > button:hover {
background-color: #8b0000;
color:#ff0000;
}
</style>""", unsafe_allow_html=True)
#This removes Streamlit default settings icons
hide_streamlit_style = """
<style>
#MainMenu {visibility: visible;}
footer {visibility: hidden;}
</style>
"""
st.markdown(hide_streamlit_style, unsafe_allow_html=True)
### Global Variables ###
get_headings = ""
selected_encoding = ""
icon_options = ["Yellow Paddle", "Green Paddle", "Blue Paddle", "White Paddle", "Teal Paddle", "Red Paddle", "Yellow Pushpin", "White Pushpin", "Red Pushpin", "Square"]
selected_icon = {'Square' :'http://maps.google.com/mapfiles/kml/shapes/placemark_square.png','Yellow Pushpin' : "http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png",'Red Pushpin' : "http://maps.google.com/mapfiles/kml/pushpin/red-pushpin.png",'White Pushpin' : "http://maps.google.com/mapfiles/kml/pushpin/wht-pushpin.png",'Red Paddle' : "http://maps.google.com/mapfiles/kml/paddle/red-circle.png",'Green Paddle' : "http://maps.google.com/mapfiles/kml/paddle/grn-circle.png",'Blue Paddle' : "http://maps.google.com/mapfiles/kml/paddle/blu-circle.png",'Teal Paddle' : "http://maps.google.com/mapfiles/kml/paddle/ltblu-circle.png",'Yellow Paddle' : "http://maps.google.com/mapfiles/kml/paddle/ylw-circle.png",'White Paddle' : "http://maps.google.com/mapfiles/kml/paddle/wht-circle.png"}
invalid_ips = ['0', '10.', '127.0.0.1','172.16', '172.17', '172.18', '172.19', '172.2', '172.21', '172.22', '172.23', '172.24', '172.25',
'172.26', '172.27', '172.28', '172.29', '172.30', '172.31', '192.168', '169.254', "255.255" ,"fc00"]
geo_list = []
#### Functions Live Here ######
def get_point_at_distance(lat1, lon1, d, bearing, R=6371): # used to draw tower wedges
"""
lat: initial latitude, in degrees
lon: initial longitude, in degrees
d: target distance from initial
bearing: (true) heading in degrees
R: optional radius of sphere, defaults to mean radius of earth
Returns new lat/lon coordinate {d}km from initial, in degrees
"""
lat1 = radians(lat1)
lon1 = radians(lon1)
a = radians(bearing)
lat2 = asin(sin(lat1) * cos(d/R) + cos(lat1) * sin(d/R) * cos(a))
lon2 = lon1 + atan2(
sin(a) * sin(d/R) * cos(lat1),
cos(d/R) - sin(lat1) * sin(lat2)
)
return (degrees(lat2), degrees(lon2),)
def make_geofence_map():
help_Box = st.expander(label="Help")
with st.form("geoform"):
user_geo_input = st.text_input("Street and I.P. Address Search",placeholder=None,)
search_geo_button = st.form_submit_button("Search")
with help_Box:
st.write("""Use the shape elements in the map toolbar to create shapes for the geofence. \n\nOnce your geofence has been drawn,
the coordinates will populate below the map. \n\nYou can add the coordinates to your clipboard to be pasted elsewhere or you
can save the entire page using your browser.\n\nATTENTION: Internet Protocol searches ARE NOT INDICATIVE OF THE LOCATION WHERE THE IP WAS USED.
THEY INDICATE A GENERAL AREA ASSOCIATED WITH THE SERVICE PROVIDER AND MAY BE COMPLETELY INACCURATE IN SOME INSTANCES. \n\nVerify
any addresses or locations presented by the search bar. \n\nAccuracy varies based on location.""")
global geomap
geomap = folium.Map(zoom_start=14)
geomap.fit_bounds([[27,-140],[48,-59]])
Draw(export=True,draw_options=({'circle': False,'circlemarker':False, 'marker':False})).add_to(geomap)
folium.TileLayer(tiles = 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}',
attr = 'Esri',
name = 'Esri Satellite',
overlay = False,
control = True
).add_to(geomap)
folium.LayerControl(position="topright", collapsed=True).add_to(geomap)
# try:
# outputmap = st_folium(geomap, width=1000, height=500,zoom=2)
# except ValueError:
# print("output map error line 120")
if len(user_geo_input) == 0:
global search_latlng
search_latlng = [40,-100]
if len(user_geo_input) > 0:
ipv4_ipv6_regex = "(^\s*((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))\s*$)|(^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$)"
if bool(re.search(ipv4_ipv6_regex, user_geo_input)) == False: # searches user input for alphabet if true geocode address search - false ip address search
try:
search_geo_results = geocoder.osm(user_geo_input)
search_latlng = search_geo_results.latlng
search_info_return = search_geo_results.json['address']
zoom = 17
print(search_info_return)
except TypeError:
st.error("Search input produced no results")
if bool(re.search(ipv4_ipv6_regex, user_geo_input)) == True: # searches user input for alphabet if true geocode address search - false ip address search
search_geo_results = geocoder.ipinfo(user_geo_input)
search_latlng = search_geo_results.latlng
search_info_return = search_geo_results.json
dont_show = "raw"
ip_stats = [value for key, value in search_info_return.items() if key not in dont_show]
zoom = 11
st.markdown(":blue[I.P. geolocation is a rough estimate related to provider coverage, and the point provided does not indicate use/user location.]")
st.json(search_info_return, expanded=False)
print(search_info_return)
try:
geomap = folium.Map(location=search_latlng,zoom_start=zoom)
folium.Marker(location=search_latlng,draggable=True,).add_to(geomap)
Draw(export=True,draw_options=({'circle': False,'circlemarker':False, 'marker':False})).add_to(geomap)
folium.TileLayer(tiles = 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}',
attr = 'Esri',
name = 'Esri Satellite',
overlay = False,
control = True
).add_to(geomap)
folium.LayerControl(position="topright", collapsed=True).add_to(geomap)
except UnboundLocalError:
print("geomap issue line 159")
# else:
# geomap = folium.Map(location=search_latlng,zoom_start=3)
outputmap = st_folium(geomap, width=1500, height=900)
try: # pulls the lats and longs from the returned JSON encoded map points
parse1 = (outputmap['last_active_drawing'])
parse2 = (parse1['geometry'])
parse3 = (parse2['coordinates'])
st.subheader("Geofence Coordinates")
text_of_coords = "Latitude, Longitude\n"
for list in parse3:
for coord in list:
lon, lat = coord[0], coord[1]
text_of_coords = text_of_coords + "\n" + (str(lat) + ", " + str(lon)) + "\n"
texting = st.write(text_of_coords)
download_coords = st.download_button(label="Download Coordinates", data=text_of_coords, file_name="Fetch_GeoFence_Coordinates.txt")
# copy_dis = st.button("Copy to Clipboard") # for local use only
# if copy_dis == True:
# pyperclip.copy(text_of_coords)
except TypeError:
# print("no data to populate - add some data")
pass
def parse_text_for_IPs(text): #used to map ips
ipv4_pattern = r'(?:\d{1,3}\.){3}\d{1,3}\b'
ipv6_pattern = r'(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))'
ipv4_addresses = re.findall(ipv4_pattern, text)
ipv6_addresses = re.findall(ipv6_pattern, text)
ipv6_list = []
ip_list = list(set(ipv4_addresses))
for address in ipv6_addresses:
clean_ipv6 = [item for item in address if len(item) > 16]
if clean_ipv6: # checks for empty lists
ipv6_list.append(clean_ipv6)
unique_ip6_list = [str(inner_list[0]) for inner_list in ipv6_list]
unique_ip6_list = list(set(unique_ip6_list))
ip_list.extend(unique_ip6_list)
return ip_list
def get_IP_locale(invalidList, IPs): #used to map ips
valid_only = [address for address in IPs if not any(address.startswith(inval) for inval in invalidList)] # removes invalid ips from list of bad ips
for thing in valid_only:
pull_geo_data = geocoder.ipinfo(thing)
geo_list.append(pull_geo_data.json) # Saves data to list in global variable geo_list
def geo_ip_to_Dataframe(geo_list): #used to map ips
df = pandas.json_normalize(geo_list)
df = df.dropna(how='all') #removes entirely empty rows
columns = df.columns
columnnamelist = []
for name in columns:
columnnamelist.append(name.upper())
df.columns = columnnamelist
df.rename(columns={"IP": 'IP ADDRESS','LAT': 'LATITUDE', 'LNG': "LONGITUDE", 'ORG': "SERVICE PROVIDER"}, inplace=True)
return (df)
def convert_df(df):
return df.to_csv().encode('utf-8')
def make_IPaddress_Map(): #used to map ips
# help_Box = st.expander(label="Help")
user_location = st.text_input("Place Name or Address - Use to Add a Relevant Location to the Map (Place e-mail received, point of comparison, etc)")
ipdata = st.text_area("Input Data with IP Addresses or an E-Mail Header",height=200)
ip_geo_button = st.button("Search")
# with help_Box:
if ip_geo_button == True:
# print(ipdata)
search_geo_results = geocoder.osm(user_location)
search_latlng = search_geo_results.json
print(search_latlng)
parsed_IPs = parse_text_for_IPs(ipdata)
get_IP_locale(invalid_ips, parsed_IPs)
datfram = geo_ip_to_Dataframe(geo_list=geo_list)
# print(geo_list)
# print(datfram)
show_these = ('IP ADDRESS', 'STATUS','SERVICE PROVIDER', 'CITY', 'STATE', 'COUNTRY','LATITUDE', 'LONGITUDE')
# show_these = None
st.dataframe(data=datfram,hide_index=True,column_order=show_these)
csv = convert_df(datfram)
st.download_button(label="Download as CSV",
data=csv,
file_name='Fetch_IP_Lookup.csv',
mime='text/csv',
)
# try:
cleandf = pandas.DataFrame.dropna(datfram, subset=["LONGITUDE","LATITUDE"])
cleandf = cleandf.reset_index()
print(cleandf)
gdf = geopandas.GeoDataFrame(cleandf, geometry=geopandas.points_from_xy(cleandf.LONGITUDE, cleandf.LATITUDE))
try:
user_gdf = pandas.json_normalize(search_latlng)
except NotImplementedError:
st.info("No user location provided. Mapping IPs.")
try:
user_gdf = geopandas.GeoDataFrame(user_gdf, geometry=geopandas.points_from_xy(user_gdf.lng, user_gdf.lat))
except UnboundLocalError:
pass
ipmap = leafmap.Map(zoom=2)
ipmap.add_basemap(basemap='ROADMAP')
ipmap.add_basemap(basemap='TERRAIN')
ipmap.add_basemap(basemap='HYBRID')
# ipmap.add_basemap(basemap="CartoDB.DarkMatter")
# ipmap.zoom_to_gdf(gdf)
try:
user_spot = ipmap.add_circle_markers_from_xy(data=user_gdf, x="lng", y="lat",color='Red',fill_color="White")
except UnboundLocalError:
pass
circle_Points = ipmap.add_circle_markers_from_xy(data=gdf, x="LONGITUDE", y="LATITUDE",color="Yellow",fill_color="Yellow", radius=5)
ipmap.to_streamlit()
downloadfile = ipmap.to_html() # for downloads
download_test = st.download_button(label="Download HTML Map", data=downloadfile,file_name="Fetch_Analysis_Map.html")
# except KeyError:
# st.error("Input Data is required OR No location data was located from the provided data.")
def make_map(in_df): #bring in pandas dataframe
gdf = geopandas.GeoDataFrame(in_df, geometry=geopandas.points_from_xy(in_df.LONGITUDE, in_df.LATITUDE))
map_Type = st.radio("Select Map Type", options=["Clustered Markers", "Circle Markers", "Heat Map", "Cell Sites"], horizontal=True)
Map = leafmap.Map()
#Zooms to bounds of the dataframe
Map.zoom_to_gdf(gdf)
Map.add_basemap(basemap='ROADMAP')
# Map.add_basemap(basemap='SATELLITE')
Map.add_basemap(basemap='TERRAIN')
Map.add_basemap(basemap='HYBRID')
Map.add_basemap(basemap="CartoDB.DarkMatter")
if map_Type == "Clustered Markers":
grouped_Points = Map.add_points_from_xy(gdf, x="LONGITUDE", y="LATITUDE", min_width=10,max_width=250,layer_name="Clustered Points", add_legend=False)
if map_Type == "Heat Map":
in_df.columns = in_df.columns.str.upper()
weight_type = st.radio("Select Weight Type", options=["Point Density", "Weighted Density"], horizontal=True)
if weight_type == "Point Density":
set_weight_to_one = gdf.assign(weight_column=1)
# print(set_weight_to_one)
try:
heatmap = Map.add_heatmap(set_weight_to_one, longitude="LONGITUDE", latitude="LATITUDE",value='weight_column',name="Heat Map", radius=25,)
except Exception:
st.info("Heat Maps use weighted numeric values to accomodate issues like population density. Select column for your dataset.")
if weight_type == "Weighted Density":
weighted_value_column = st.selectbox("Weighted Value Column", options=gdf.columns)
try:
heatmap = Map.add_heatmap(gdf, longitude="LONGITUDE", latitude="LATITUDE",value=weighted_value_column,name="Heat Map", radius=25,)
except Exception:
st.info("Heat Maps use weighted numeric values to accomodate issues like population density. Select column for your dataset.")
if map_Type == "Circle Markers":
st.markdown("---")
Map.zoom_to_gdf(gdf)
points_or_path = st.radio(label="Select map activity", options=["Markers", "Show Point Progression"], horizontal=True)
if points_or_path == "Markers": #Shows markers only
color = st.selectbox(label="Choose",options=['DarkRed', 'Yellow','Pink', 'Green', 'Teal', "Blue", "White"])
circle_Points = Map.add_circle_markers_from_xy(data=gdf, x="LONGITUDE", y="LATITUDE",color=color,fill_color=color, radius=5)
if points_or_path == "Show Point Progression": #Shows the moving path between markers
list_of_path_points = [] #stores coordinates from dataframe, but in long/lat format
pathpointforreal = [] #stores corrected coordinates in lat/long form to be used by the Antpath tool
color = st.selectbox(label="Choose",options=['DarkRed', 'Yellow','Pink', 'Green', 'Teal', "Blue", "White"])
# date_column = st.selectbox("Select the date column", options=in_df.columns)
# try:
# gdf[date_column] = pandas.to_datetime(gdf[date_column])
# except Exception:
# st.error("Select a column containing date data.")
try:
circle_Points = Map.add_circle_markers_from_xy(data=gdf, x="LONGITUDE", y="LATITUDE",color=color,fill_color=color, radius=5)
except ValueError:
st.error("Select")
for index, row in gdf.iterrows():
for pt in list(row['geometry'].coords):
list_of_path_points.append(pt)
for ting in list_of_path_points: # Takes list and swaps from long/lat tuple and strings to list lat/long floats
[longy, laty] = ting
ltlng = (str(laty) + "," + str(longy))
ltlng2list = [float(value) for value in ltlng.split(",")]
# print(ltlng2list)
pathpointforreal.append(ltlng2list)
plugins.AntPath(locations=pathpointforreal,color=color).add_to(Map)
# GOTTA ORDER THE DATAFRAME BY TIME AND DATE THEN ADD THE POINTS IN ORDER TO A LIST TO BE READ BY THE ANTPATH
if map_Type == "Cell Sites":
Map.zoom_to_gdf(gdf)
gdf.columns = gdf.columns.str.upper()
gdf.geometry = gdf["GEOMETRY"]
st.markdown("---")
wedge_color = st.selectbox("Sector Color", options=['Red', 'Blue', 'Green', 'Purple', 'Orange', 'DarkRed', 'Beige', 'DarkBlue', 'DarkGreen', 'CadetBlue', 'Pink', 'LightBlue', 'LightGreen', 'Gray', 'Black', 'LightGray'])
radii_list = ["1.5 Miles", "1 Kilometer"]
for oto in in_df.columns:
radii_list.append(oto)
radii = st.selectbox("Sector Footprint Size", options=radii_list)
if radii == "1.5 Miles":
in_df["1.5 Miles"] = pandas.Series(2414 for x in range(len(in_df.index)))
if radii == "1 Kilometer":
in_df["1 Kilometer"] = pandas.Series(1000 for x in range(len(in_df.index)))
Azimuth = st.selectbox("Sector Azimuth", options=in_df.columns)
beam_width = st.selectbox("Sector Beam Width", options=in_df.columns)
try:
for index, row in gdf.iterrows(): # iterates through the data frame to place points,shapes
plugins.SemiCircle((row["LATITUDE"],row["LONGITUDE"]), #wedge shape
radius=row[radii]/2,
direction=row[Azimuth],
arc=row[beam_width],
color=None,
fill_color=wedge_color,
opacity=1,
fill_opacity=.5,
# popup="Azimuth - " + str(row[Azimuth]) + " degrees, Beam width - " + str(row[beam_width]) + " degrees",).add_to(Map)
popup=('<br>'.join(f'{k}: {v}' for k, v in row.items()))).add_to(Map)
length = row[radii]/1000 #convert to meters
# print(length/1000)
half_beamwidth = row[beam_width] / 2
upside = (row[Azimuth] + half_beamwidth) #calc angle from center of beam up
upside %= 360 # accomodates crossing 360 degree point
downside = (row[Azimuth] - half_beamwidth) #calc angle from center of beam down
downside %= 360 # accomodates crossing 360 degree point
# print("AZ- "+str(row[Azimuth]) + " up-" + str(upside) + " down-" + str(downside))
up_lat, up_lon = get_point_at_distance(row["LATITUDE"], row["LONGITUDE"],d=length,bearing=upside)
dwn_lat, dwn_lon = get_point_at_distance(row["LATITUDE"], row["LONGITUDE"],d=length,bearing=downside)
# try:
# leafmap.folium.PolyLine([[row["LATITUDE"],row["LONGITUDE"]], [up_lat,up_lon]],color=wedge_color).add_to(Map) # lines for exterior wedge shape
# leafmap.folium.PolyLine([[row["LATITUDE"],row["LONGITUDE"]], [dwn_lat,dwn_lon]],color=wedge_color).add_to(Map)
# except ValueError:
# print("there are NaN in the location data set")
# pass
except TypeError:
st.info("Assign columns for Sector Footprint Size (Radius from Station in Meters), Tower Direction/Azimuth (Degrees), & Beam Width (Degrees)")
Map.to_streamlit()
col1, col2, col3, col4, col5 = st.columns(5)
with col1:
# sav_HTML = st.button("Export to HTML") # for use with local save of HTML
downloadfile = Map.to_html() # for downloads
download_test = st.download_button(label="Download HTML Map", data=downloadfile,file_name="Fetch_Analysis_Map.html")
with col2:
print("")
with col3:
print("")
with col4:
print("")
with col5:
print("")
# if sav_HTML == True: # for use with local file saves
# if len(filename) == 0:
# st.error("Provide a map name above")
# else:
# try:
# sav_location = HTML_output_file(filename)
# Map.to_html(sav_location)
# with notices:
# st.success("HTML file has been stored to: " + sav_location)
# except TypeError:
# print("woot")
def get_footprint_color(icon_Color):
if "Yellow" in icon_Color:
footprint_color = simplekml.Color.changealphaint(50, simplekml.Color.yellow)
if "Red" in icon_Color:
footprint_color = simplekml.Color.changealphaint(100, simplekml.Color.red)
if "Blue" in icon_Color:
footprint_color = simplekml.Color.changealphaint(100, simplekml.Color.blue)
if "White" in icon_Color:
footprint_color = simplekml.Color.changealphaint(100, simplekml.Color.white)
if "Green" in icon_Color:
footprint_color = simplekml.Color.changealphaint(100, simplekml.Color.green)
if "Teal" in icon_Color:
footprint_color = simplekml.Color.changealphaint(100, simplekml.Color.lightblue)
if "Square" in icon_Color:
footprint_color = simplekml.Color.changealphaint(200, simplekml.Color.white)
return footprint_color
def HTML_output_file(name_for_file):
try:
name_for_file = name_for_file + ".html"
except Exception:
st.error("Provide map name above")
out_folder = os.path.expanduser('~\\Documents\\Fetch_Maps\\')
if os.path.exists(out_folder) == False:
os.makedirs(out_folder)
else:
pass
out_file = os.path.expanduser(out_folder+name_for_file)
return out_file
def KML_output_file(name_for_file):
name_for_file = name_for_file + ".kml"
out_folder = os.path.expanduser('~\\Documents\\Fetch_Maps\\')
if os.path.exists(out_folder) == False:
os.makedirs(out_folder)
else:
pass
out_file = os.path.expanduser(out_folder+name_for_file)
return out_file
def get_file_encoding(infile): #checks file encoding
return (chardet.detect(infile.read()))
def make_dataframe(infile, outfile): # changes input file to pandas dataframe
if (".xls") in str(infile): # This will work for xls and xlsx file formats
dataf = pandas.read_excel(infile)
elif (".csv") in str(infile) or (".txt") in str(infile):
try:
dataf = pandas.read_csv(infile, encoding=selected_encoding)
except UnicodeError:
st.error("Decoding error. Try another encoding method.")
pass
elif (".tsv") in str(infile):
try:
dataf = pandas.read_csv(infile, encoding=selected_encoding, sep=("\t"))
except UnicodeError:
st.error("Decoding error. Try another encoding method.")
pass
elif (".gpx") in str(infile):
# with open(infile, 'r') as f:
gpx = gpxpy.parse(infile)
# Convert to a dataframe one point at a time.
points_data = []
# Loop through all points in all track segments
for track in gpx.tracks:
for segment in track.segments:
for point in segment.points:
# Create a dictionary to store the latitude, longitude, elevation, and time values for the point
point_data = {
'latitude': point.latitude,
'longitude': point.longitude,
'elevation': point.elevation,
'time': point.time
}
# Append the dictionary to the list
points_data.append(point_data)
dataf = pandas.DataFrame.from_records(points_data)
n = lines_t0_remove
if n > 0:
dataf.columns = dataf.iloc[n-1]
try:
dataf.columns = dataf.columns.str.upper()
dataf = dataf[0:]
dataf = dataf.iloc[n:]
first_five_lines = dataf.head(6)
first_five_lines = first_five_lines.loc[:,~first_five_lines.columns.duplicated()]
st.dataframe(data=first_five_lines, use_container_width=True)
headers = dataf.columns.to_list()
dataf['LATITUDE'].replace('', np.nan, inplace=True) # added to address NaN values in dataframe
dataf.dropna(subset=['LATITUDE'], inplace=True)
dataf['LONGITUDE'].replace('', np.nan, inplace=True)
dataf.dropna(subset=['LONGITUDE'], inplace=True)
return headers, dataf
except AttributeError:
pass
def create_kml(df_in, outfile):
try:
headers = df_in.columns.to_list()
# print(headers)
st.subheader("Assign Columns for KML")
label_for_icons = st.selectbox("Map Icon Labels", options=headers)
# print(label_for_icons)
point_description = st.selectbox("Additional Descriptions", options=headers)
if footprint == True:
radii = st.selectbox("Radius/Distance-from-Point in Meters", options=headers)
# print(point_description)
except AttributeError:
print("Attribute error on variable headers in createkml")
st.error("Check for errors in column selection.")
except UnboundLocalError:
print("Attribute error on variable headers in createkml")
st.error("Check for errors in column selection.")
if KML == True:
filename = "MITE_KML_Map" + str(now)
if len(filename) == 0:
with notices:
st.error("Map Name Required")
if len(filename) > 0:
kml = simplekml.Kml()
Descript = point_description
Label = label_for_icons
# try:
if footprint == True:
footy_color = get_footprint_color(icon_Color=icon)
for lon, lat, lab, desc, rad in zip(df_in["LONGITUDE"], df_in["LATITUDE"], df_in[Label], df_in[Descript], df_in[radii]): #zip with for
lo_search = re.findall(r'([0-9.-]+).+?([0-9.-]+)', str(lon)) #regex to find what appears to be longitude, makes tuple, only provides first result of tuple
first_result_lo = map(operator.itemgetter(0), lo_search)
for i in first_result_lo:
long = i
la_search = re.findall(r'([0-9.-]+).+?([0-9.-]+)', str(lat))
first_result_la = map(operator.itemgetter(0), la_search)
for f in first_result_la:
lati = f
point = kml.newpoint(name=lab, coords= [(long, lati)], description=desc) #15(lon),15(lat) are geological coordinates of the location.
point.style.iconstyle.icon.href = selected_icon[icon]
if footprint == True:
try:
polycircle = polycircles.Polycircle(latitude=float(lati),
longitude=float(long),
radius=float(rad),
number_of_vertices=72)
pol = kml.newpolygon(name=(str(lati) + ', ' + str(long) + ', ' + str(rad)), outerboundaryis=polycircle.to_kml())
pol.style.polystyle.color = \
footy_color #changes the radius circle color
except ValueError:
with notices:
st.error("Value Error - Inspect Latitude, Longitude, and Radius Columns")
if footprint == False:
for lon, lat, lab, desc in zip(df_in["LONGITUDE"], df_in["LATITUDE"], df_in[Label], df_in[Descript]): #zip with for
lo_search = re.findall(r'([0-9.-]+).+?([0-9.-]+)', str(lon)) #regex to find what appears to be longitude, makes tuple, only provides first result of tuple
first_result_lo = map(operator.itemgetter(0), lo_search)
for i in first_result_lo:
long = i
la_search = re.findall(r'([0-9.-]+).+?([0-9.-]+)', str(lat))
first_result_la = map(operator.itemgetter(0), la_search)
for f in first_result_la:
lati = f
point = kml.newpoint(name=lab, coords= [(long, lati)], description=desc) #15(lon),15(lat) are geological coordinates of the location.
point.style.iconstyle.icon.href = selected_icon[icon]
# except KeyError:
# print("There was a keyerror")
download_kml = kml.kml(format=True)
download_button_kml = st.download_button("Download KML", data=download_kml, file_name="Fetch_KML_Download.kml")
st.success("KML file has been stored to: " + outfile)
def time_range_slider(in_df):
## Range selector
try:
in_df[datetime_Column] = pandas.to_datetime(in_df[datetime_Column])
format = 'YYYY-MM-DD' # format output
start_date = min(in_df[datetime_Column]).to_pydatetime() # get start date of data frame
end_date = max(in_df[datetime_Column]).to_pydatetime() # get end date of data frame
slider = st.slider('Select Date (YYYY-MM-DD)', min_value=start_date, value=(start_date,end_date) ,max_value=end_date, format=format)
return slider #kicks out start and end datetime
except TypeError:
st.error("slider error")
def time_filter(in_df, date_column):
# try:
starting, ending = time_range_slider(in_df=in_df)
sorted = in_df.sort_values(by=date_column)
# print(sorted)
col1, col2, col3, col4 = st.columns(4)
with col1:
start_date = st.date_input("Start Date",value=starting)
with col2:
start_time = st.time_input("Start Time", value=datetime.time(0, 00, 00))
with col3:
end_date = st.date_input("End Date",value=ending)
with col4:
end_time = st.time_input("End Time", value=datetime.time(23, 59, 59))
first_is = str(start_date) + " " + str(start_time)
last_is = str(end_date) + " " + str(end_time)
selected_time = sorted[(sorted[date_column] > first_is) & (sorted[date_column] < last_is)]
st.markdown(":orange[Filtered Records:] " + str(len(selected_time.index)))
st.table(selected_time)
return selected_time
# except Exception:
# st.error("Select column with Date/Time data.")
def declutterer(in_df, date_column):
# resample every N minutes to get a mean value for lat and long.
# Sample Frequency cheatsheet
# B business day frequency
# C custom business day frequency (experimental)
# D calendar day frequency
# W weekly frequency
# M month end frequency
# SM semi-month end frequency (15th and end of month)
# BM business month end frequency
# CBM custom business month end frequency
# MS month start frequency
# SMS semi-month start frequency (1st and 15th)
# BMS business month start frequency
# CBMS custom business month start frequency
# Q quarter end frequency
# BQ business quarter endfrequency
# QS quarter start frequency
# BQS business quarter start frequency
# A year end frequency
# BA, BY business year end frequency
# AS, YS year start frequency
# BAS, BYS business year start frequency
# BH business hour frequency
# H hourly frequency
# T, min minutely frequency
# S secondly frequency
# L, ms milliseconds
# U, us microseconds
# N nanoseconds
in_df[date_column] = pandas.to_datetime(in_df[date_column])
declutter_data = in_df.set_index(date_column)
Time_intervals = { "Year": "A", "Month": "M", "Week": "W", "Day": "D", "Hour" : "H", "Minute": "T","Second": "S"}
spot1, spot2, spot3, spot4 = st.columns(4)
with spot1:
count_of_time = st.number_input("Interval Count", min_value=1, max_value=60,)
with spot2:
choose_interval = st.selectbox("Interval Type", options=list(Time_intervals.keys()))
resample_Rate = str(count_of_time) + Time_intervals[choose_interval]
print(resample_Rate)
declutter_data = declutter_data.resample(resample_Rate).agg({'LATITUDE': 'mean', 'LONGITUDE': 'mean'})
declutter_data = declutter_data[declutter_data['LATITUDE'].notna()]
st.markdown(":orange[Number of Averaged Locations:] " + str(len(declutter_data.index)))
# declutter_data = in_df.resample("5D").mean()
return declutter_data
########################################
########################################
#### Main Page ####
notices = st.empty() # Places notifications at the top of the screen
# filename = st.text_input(":red[Provide Map Name*]",)
uploaded_file = st.file_uploader("Choose a CSV, TXT (Comma Seperated), TSV, Excel, or GPX file", type=["csv","txt","tsv","xlsx","xls","gpx"], accept_multiple_files=False)
if uploaded_file != None:
# filename = st.text_input(":red[Provide Map Name*]",)
with st.expander("Manage Ingested Data"):
tabi, tabii, tabiii = st.tabs(["Review Ingest Data", "Time Filter", "Declutter"])
with tabi:
lines_t0_remove = st.slider(label="Number of Rows to Remove from Start of Table (First line must include 'Latitude' and 'Longitude')", min_value=0, max_value=10)
if uploaded_file != None:
suggested_encoding = get_file_encoding(uploaded_file) # block attempts to find csv encoding and allow manual choice
encode_options = st.radio(label="Encoding Options", options=["Use Suggested Encoding: " + str(suggested_encoding['encoding']), "Use Manual Encoding Selection"],horizontal=True)
if encode_options == "Use Suggested Encoding: " + str(suggested_encoding['encoding']):
selected_encoding = suggested_encoding['encoding']
if encode_options == "Use Manual Encoding Selection":
selected_encoding = st.selectbox("Choose File Encoding",options=["utf-8", 'utf-8-sig', 'utf-16', 'ISO-8859-1'])
uploaded_file.seek(0) #refresh action
outFile = KML_output_file("MITE_KML_Map"+str(now))
# print(outFile)
try:
get_headings, preview_data = make_dataframe(uploaded_file, outfile=outFile)
except UnboundLocalError:
pass
except TypeError:
st.error("Keep altering the row selection...")
with tabii:
filterbytime = st.checkbox("Filter by Date/Time")
if filterbytime == True:
datetime_Column = st.selectbox("Select Date/Time Column", options=preview_data.columns)
preview_data = time_filter(preview_data,date_column=datetime_Column)
print(preview_data)
with tabiii:
declutter_dis = st.checkbox("Consolidate points to an average location based on selected time interval.")
if declutter_dis == True:
try:
datetim_Column = st.selectbox("Choose Date/Time Column", options=preview_data.columns)
except AttributeError:
st.error("Select column with Date/Time data.")
try:
preview_data = declutterer(preview_data, date_column=datetim_Column)
print(preview_data)
except Exception:
st.error("Select date/time column")
if uploaded_file == None:
tabA, tabB = st.tabs(["Create Geofence", "IP Address Mapping"])
with tabA:
make_geofence_map()
with tabB:
make_IPaddress_Map()
if uploaded_file != None:
if declutter_dis or filterbytime == True:
st.markdown(":orange[FILTERS ARE IN EFFECT]")
tab1, tab2, tab3 = st.tabs(["Preview/KML Map", "Analysis Maps", "Create Geofence"])
with tab1:
try:
st.map(preview_data)
except TypeError:
st.error("Ensure you have correct settings in Manage CSV and Date/Time Filtering")
except Exception:
st.error("Check your data input. Hints - Must have Latitude and Longitude columns. Remove unnecessary header rows.")
icon = st.selectbox("Select Map Point Icon Style", options=icon_options)
footprint = st.checkbox("Dataset includes radius/area information",)
KML = st.button("GENERATE KML")
st.markdown("---")
create_kml(df_in=preview_data,outfile=outFile)
with tab2:
try:
make_map(preview_data)
except AttributeError:
st.error("Check that your data has Latitude and Longitude columns")
with tab3:
make_geofence_map()