-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathosm_processing_get_intersections.pl
More file actions
638 lines (497 loc) · 26.9 KB
/
Copy pathosm_processing_get_intersections.pl
File metadata and controls
638 lines (497 loc) · 26.9 KB
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
#-------------------------------------------------
#
# osm_processing_get_intersections.pl
#
# (c) Copyright 2023 by Richard Fobes at SolutionsCreative.com
# Permission to copy and use and modify this
# software is hereby given to individuals and to
# businesses with ten or fewer employees if this
# copyright notice is included in all copies
# and modified copies.
# All other rights are reserved.
# Businesses with more than ten employees are
# encouraged to contract with small businesses
# to supply the service of running this software
# if there are arrangements for either business
# to make donations to support the Open Street
# Map project.
# Disclaimer of Warranty: THERE IS NO WARRANTY
# FOR THIS SOFTWARE. THE COPYRIGHT HOLDER PROVIDES
# THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY
# KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
# BUT NOT LIMITED TO, THE FITNESS FOR A
# PARTICULAR PURPOSE.
# Limitation of Liability: IN NO EVENT WILL THE
# COPYRIGHT HOLDER BE LIABLE TO ANYONE FOR
# DAMAGES, INCLUDING ANY GENERAL, SPECIAL,
# INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
# OUT OF THE USE OR INABILITY TO USE THE SOFTWARE.
#
#
# This Perl script runs other Perl scripts that
# process the Open Street Map data to get the
# location (by latitude and longitude) and name
# of every street intersection, everywhere in the
# world. An intersection is named by the names
# of the two streets that intersect.
# Keep in mind that freeways do not have
# intersections. Also, one street passing over
# another via a bridge is not an intersection.
#
# Usage:
#
# First, if you have not already run the
# script named "osm_processing_do_all.pl"
# then run just the beginning of it to
# get the latitude and longitude of every
# node. Then, run:
#
# perl osm_processing_get_intersections.pl
#
# To monitor progress, run the Linux "top"
# command in a separate terminal (to watch
# memory usage and compression and
# decompression workloads), and use a "file"
# utility (to watch which files are created,
# and watch the file sizes increase).
#
# To execute just a portion of the code in this
# script, comment out the lines that are
# preceded with the text "conlts" which is an
# abbreviation of the words:
# "Comment Out Next Line To Skip".
#-------------------------------------------------
# Verify that some needed files exist.
#
# The "no_content" file is used at the end
# to deal with the need for special punctuation
# at the end.
@filenames_needed = (
'planet_relations_only.bz2' ,
'planet_ways_relations_only.bz2' ,
'osm_split_and_abbrev_node_way_relation.pl' ,
'osm_get_way_ids_from_relation_info.pl' ,
'osm_consolidate_street_info_by_region.pl' ,
'osm_eliminate_non_intersection_street_joins.pl' ,
'osm_exclude_intersections_with_listed_street_ids.pl' ,
'osm_find_intersections_and_merge_lats_lons.pl' ,
'osm_join_intersection_info_files.pl' ,
'osm_generate_uploadable_street_words.pl' ,
'osm_get_street_node_way_pairs.pl' ,
'osm_handle_sorted_street_names.pl' ,
'osm_prepare_street_info_for_sorting.pl' ,
'osm_generate_mapable_intersection_lats_lons.pl' ,
'split_on_server.pl' ,
'remove_column_one.pl' ,
'remove_column_two.pl' ,
'remove_column_three.pl' ,
'generate_map_density_squares.pl' ,
'map_image_begin.txt' ,
'map_image_end.txt' ,
'text_yes.txt' ,
'text_no.txt' ,
'no_content.txt' ) ;
foreach $filename ( @filenames_needed )
{
if ( not( -e $filename ) )
{
print "needed file named " . $filename . " not found, so exiting" . "\n" ;
exit ;
}
}
#-------------------------------------------------
# Initialization.
$option_t_space = "-t' '" ;
$character_apostrophe = "'" ;
#-------------------------------------------------
# Clear the output log file.
system( 'head -v no_content.txt > output_log_intersection_processing.txt' ) ;
system( 'head -v text_yes.txt >> output_log_intersection_processing.txt' ) ;
system( 'head -v text_no.txt >> output_log_intersection_processing.txt' ) ;
print "started writing the file output_log_intersection_processing.txt" . "\n" ;
#-------------------------------------------------
# Create a needed folder, or verify that
# this folder already exists.
# The "p" switch, for "mkdir", specifies
# "if it does not exist".
# conlts:
system( 'mkdir -p ./street_node_way_pairs >> output_log_intersection_processing.txt' ) ;
#-------------------------------------------------
# Get information from the "relations" that are
# tagged in ways that indicate they relate to
# a street.
#
# This step takes about a quarter of an hour.
system( 'head -n 3 osm_split_and_abbrev_node_way_relation.pl >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
system( 'cat no_content.txt > input_list_of_special_nodes_ways_to_get.txt' ) ;
system( 'cat text_yes.txt > yes_or_no_get_street_info.txt' ) ;
system( 'cat text_no.txt > yes_or_no_get_business_info.txt' ) ;
system( 'cat text_no.txt > yes_or_no_get_city_info.txt' ) ;
system( 'cat text_no.txt > yes_or_no_get_node_info.txt' ) ;
system( 'cat text_no.txt > yes_or_no_get_way_info.txt' ) ;
system( 'cat text_yes.txt > yes_or_no_get_relation_info.txt' ) ;
# conlts:
system( 'bzcat planet_relations_only.bz2 | perl osm_split_and_abbrev_node_way_relation.pl' ) ;
# conlts:
system( 'cat output_street_relation_info.txt > output_street_relation_info_tagged_as_street.txt' ) ;
system( 'head -v output_street_relation_info_tagged_as_street.txt >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
#-------------------------------------------------
# Generate a list of the way IDs that appear in
# the street relation info.
system( 'head -n 3 osm_get_way_ids_from_relation_info.pl >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
# conlts:
system( 'perl osm_get_way_ids_from_relation_info.pl < output_street_relation_info_tagged_as_street.txt > output_way_ids_from_street_relation_links.txt' ) ;
system( 'head -v output_way_ids_from_street_relation_links.txt >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
#-------------------------------------------------
# Get information from the "ways" that are
# tagged in ways that indicate they relate to
# a street.
#
# This step omits ways labelled as
# "highway_path". However there is one way that
# is tagged with "highway_paths" (plural).
#
# This step takes more than 10 hours.
system( 'head -n 3 osm_split_and_abbrev_node_way_relation.pl >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
system( 'cat output_way_ids_from_street_relation_links.txt > input_list_of_special_ways_to_get.txt' ) ;
system( 'cat text_yes.txt > yes_or_no_get_street_info.txt' ) ;
system( 'cat text_no.txt > yes_or_no_get_business_info.txt' ) ;
system( 'cat text_no.txt > yes_or_no_get_city_info.txt' ) ;
system( 'cat text_no.txt > yes_or_no_get_node_info.txt' ) ;
system( 'cat text_yes.txt > yes_or_no_get_way_info.txt' ) ;
system( 'cat text_no.txt > yes_or_no_get_relation_info.txt' ) ;
system( 'head -n 3 osm_split_and_abbrev_node_way_relation.pl >> output_log_intersection_processing.txt' ) ;
# conlts:
system( 'bzcat planet_ways_relations_only.bz2 | perl osm_split_and_abbrev_node_way_relation.pl' ) ;
# conlts:
system( 'cat output_street_way_info.txt > output_street_way_info_tagged_as_street.txt' ) ;
system( 'head -v output_street_way_info_tagged_as_street.txt >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
#-------------------------------------------------
# Create lists of node IDs and their associated
# way ID or relation ID. The output is 100 files
# that are written to the "street_node_way_pairs"
# folder.
#
# This step takes less than an hour.
system( 'head -n 3 osm_get_street_node_way_pairs.pl >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
# conlts:
system( 'perl osm_get_street_node_way_pairs.pl' ) ;
system( 'head -v street_node_way_pairs/node_way_pairs_in_group_00.txt >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
system( 'tail -v street_node_way_pairs/node_way_pairs_in_group_00.txt >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
#-------------------------------------------------
# Merge the latitudes and longitudes with the
# pair of ways (or sometimes a pair of a way and
# a relation, or two relations) that define an
# intersection. The node numbers associate
# these two pieces of data, but the node IDs are
# not included in the output. To keep
# associative arrays from getting too big, and
# to reduce the combination of checks needed,
# the input data is split and handled based on
# the last two digits of the node ID number.
# The output data is split into ten files.
# Then join the ten files into a single file.
#
# This step takes about 6 hours.
# conlts:
system( 'rm output_intersections_with_lats_lons_group_?.txt' ) ;
system( 'head -n 3 osm_find_intersections_and_merge_lats_lons.pl >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
# conlts:
system( 'perl osm_find_intersections_and_merge_lats_lons.pl' ) ;
system( 'head -v output_intersections_with_lats_lons_group_0.txt >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
# conlts:
system( 'perl osm_join_intersection_info_files.pl' ) ;
system( 'head -v output_joined_intersection_info_before_exclusions.txt >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
#-------------------------------------------------
# Identify street IDs that should be excluded.
# Specifically exclude streets with names that
# contain a left paren ((),
# right paren ()),
# semicolon (;),
# the text "highway_path",
# "highway_bus_stop", or
# "N:N" (which is "N:N") where "N" indicates
# any digit.
# Colons (:) alone are not considered because
# they appear in the text "name:en".
# Typically these complicated names apply to
# highways rather than neighborhood
# intersections.
# Currently removes about 10 percent of the
# intersections.
#
# The "P" option uses Perl regular expression
# syntax.
system( 'echo USING GREP >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 1 output_log_intersection_processing.txt' ) ;
$grep_regular_expression = '(()|())|(;)|([0-9]:[0-9])|( highway_path)|( highway_bus_stop)|( \?\?+ )' ;
# conlts:
system( 'grep -P ' . "'" . $grep_regular_expression . "'" . ' output_street_relation_info_tagged_as_street.txt > output_street_ids_to_exclude.txt' ) ;
# conlts:
system( 'grep -P ' . "'" . $grep_regular_expression . "'" . ' output_street_way_info_tagged_as_street.txt >> output_street_ids_to_exclude.txt' ) ;
system( 'head -v output_street_ids_to_exclude.txt >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
system( 'tail -v output_street_ids_to_exclude.txt >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
#-------------------------------------------------
# Remove from the intersection info the
# intersections at which one of the two street
# IDs is a street to be excluded.
# This reduces the number of intersections by
# about 10 percent. It reduces the data size by
# about 75 percent, probably because the streets
# with excluded naming conventions tend to be
# for long highways. Neighborhood intersections
# are not much affected by this reduction.
system( 'head -n 3 osm_exclude_intersections_with_listed_street_ids.pl >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
# conlts:
system( 'perl osm_exclude_intersections_with_listed_street_ids.pl' ) ;
system( 'head -v output_street_intersections_after_exclusions.txt >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
#-------------------------------------------------
# Gather street information that will be sorted
# and merged based on the street ID number. The
# merge brings together region IDs -- which look
# like "1063_1010" -- and street names.
system( 'head -v output_street_relation_info_tagged_as_street.txt >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
system( 'head -v output_street_way_info_tagged_as_street.txt >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
system( 'head -v output_street_intersections_after_exclusions.txt >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
system( 'head -n 3 osm_prepare_street_info_for_sorting.pl >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
# conlts:
system( 'perl osm_prepare_street_info_for_sorting.pl' ) ;
system( 'head -v output_sortable_relation_ids_and_names.txt >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
system( 'head -v output_sortable_way_ids_and_names.txt >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
system( 'head -v output_sortable_street_ids_and_region_ids.txt >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
#-------------------------------------------------
# Sort and merge the street information so that
# each street name is followed by the region IDs
# in which that street intersects with another
# street.
#
# The "k" option specifies which space-delimited
# fields to sort on. The number after the comma
# is used to limit that sort to just that
# field instead of including the remainder of
# the line as part of that sort. The decimal
# point in the "k" option specifies the
# character position within the specified
# field. The "n" option specifies a numeric
# sort.
# The "t" option is used to change the
# recognized field separator from the default
# to (just) a space. Do not use the "u"
# option because it eliminates duplicate
# (non-unique) values even if the remainder of
# the line is different.
# conlts:
system( 'cat output_sortable_relation_ids_and_names.txt > output_regions_names_merged_by_street_id.txt' ) ;
# conlts:
system( 'cat output_sortable_way_ids_and_names.txt >> output_regions_names_merged_by_street_id.txt' ) ;
# conlts:
system( 'perl remove_duplicate_adjacent_lines.pl < output_sortable_street_ids_and_region_ids.txt >> output_regions_names_merged_by_street_id.txt' ) ;
system( 'echo SORTING FILE >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 1 output_log_intersection_processing.txt' ) ;
# conlts:
system( 'sort ' . $option_t_space . ' -k1.2,1n -k2,2n output_regions_names_merged_by_street_id.txt -o output_regions_names_sorted_by_street_id.txt' ) ;
system( 'head -v output_regions_names_sorted_by_street_id.txt >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
system( 'tail -v output_regions_names_sorted_by_street_id.txt >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
#-------------------------------------------------
# Generate the lists of street names and street
# words, along with which regions have those
# street names and words.
system( 'head -n 3 osm_handle_sorted_street_names.pl >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
# conlts:
system( 'perl osm_handle_sorted_street_names.pl' ) ;
system( 'head -v output_sortable_street_names.txt >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
system( 'head -v output_sortable_street_words.txt >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
system( 'head -v output_sortable_regions_streets.txt >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
#-------------------------------------------------
# Sort the street names to create the uploadable
# street name info.
system( 'echo SORTING FILE >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 1 output_log_intersection_processing.txt' ) ;
# conlts:
system( 'sort ' . $option_t_space . ' -k2,2 output_sortable_street_names.txt -o output_uploadable_street_names.txt' ) ;
system( 'head -v output_uploadable_street_names.txt >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
#-------------------------------------------------
# Sort the list of street words.
system( 'echo SORTING FILE >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 1 output_log_intersection_processing.txt' ) ;
# conlts:
system( 'sort ' . $option_t_space . ' -k1,1 -k2,2 -k3,3 output_sortable_street_words.txt -o output_sorted_street_words.txt' ) ;
system( 'head -v output_sorted_street_words.txt >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
#-------------------------------------------------
# Write the multiple street IDs for each street
# word on the same line, along with the region
# ID.
system( 'head -n 3 osm_generate_uploadable_street_words.pl >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
# conlts:
system( 'perl osm_generate_uploadable_street_words.pl' ) ;
system( 'head -v output_uploadable_street_words.txt >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
#-------------------------------------------------
# Eliminate intersection name pairs where both
# street names are the same, such as
# "La Costa Avenue & La Costa Avenue". These do
# not affect search results because they are
# avoided by the lookup code, but those
# intersections use "disk" storage space. Also
# remove intersections for which either street
# name is missing from the region-specific
# street name info.
system( 'head -n 3 osm_swap_street_ids_in_intersection_data.pl >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
# conlts:
system( 'perl osm_swap_street_ids_in_intersection_data.pl < output_street_intersections_after_exclusions.txt > temp_output_intersections_with_swapped_ids.txt' ) ;
system( 'head -v temp_output_intersections_with_swapped_ids.txt >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
system( 'echo SORTING FILE >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 1 output_log_intersection_processing.txt' ) ;
# conlts:
system( 'cat output_sortable_regions_streets.txt temp_output_intersections_with_swapped_ids.txt > temp_merged_intersections_and_street_names.txt' ) ;
# conlts:
system( 'sort -k1,1 temp_merged_intersections_and_street_names.txt -o output_merged_sorted_intersections_and_street_names.txt' ) ;
system( 'head -v output_merged_sorted_intersections_and_street_names.txt >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
system( 'head -n 3 osm_eliminate_non_intersection_street_joins.pl >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
# conlts:
system( 'perl osm_eliminate_non_intersection_street_joins.pl' ) ;
system( 'head -v output_uploadable_street_intersections.txt >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
system( 'head -v output_log_street_joins.txt >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
system( 'tail -v output_log_street_joins.txt >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
#-------------------------------------------------
# View the three uploadable files to verify they
# have the correct data types.
system( 'head -v output_uploadable_street_intersections.txt >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
system( 'head -v output_uploadable_street_names.txt >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
system( 'head -v output_uploadable_street_words.txt >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
#-------------------------------------------------
# Generate a density map of the intersections.
# This provides verification of the data.
system( 'head -n 3 osm_generate_mapable_intersection_lats_lons.pl >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
# conlts:
system( 'perl osm_generate_mapable_intersection_lats_lons.pl < output_uploadable_street_intersections.txt > output_density_mapable_lats_lons.txt' ) ;
system( 'head -v output_density_mapable_lats_lons.txt >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
system( 'head -n 3 generate_map_density_squares.pl >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
# conlts:
system( 'perl generate_map_density_squares.pl < output_density_mapable_lats_lons.txt > output_map_density_squares.txt' ) ;
# conlts:
system( 'cat map_image_begin.txt > map_full_intersections.svg' ) ;
# conlts:
system( 'cat output_map_density_squares.txt >> map_full_intersections.svg' ) ;
# conlts:
system( 'cat map_image_end.txt >> map_full_intersections.svg' ) ;
system( 'ls -l map_full_intersections.svg >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
#-------------------------------------------------
# Split the uploadable street name file into
# multiple files and put those files into a new
# folder named "street_names_new".
system( 'head -n 3 split_on_server.pl >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
# conlts:
system( 'rm street_names_new/pattern_*/street_names_category_*.txt' ) ;
# conlts:
system( 'perl split_on_server.pl < output_uploadable_street_names.txt' ) ;
system( 'head -v street_names_new/pattern_14/street_names_category_6214.txt >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
#-------------------------------------------------
# Split the uploadable street word file into
# multiple files and put those files into a new
# folder named "street_words_new".
system( 'head -n 3 split_on_server.pl >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
# conlts:
system( 'rm street_words_new/lat9_*/street_words_category_*.txt' ) ;
# conlts:
system( 'perl split_on_server.pl < output_uploadable_street_words.txt' ) ;
system( 'head -v street_words_new/lat9_1045/street_words_category_1045_0877.txt >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
system( 'grep sandy street_words_new/lat9_1045/street_words_category_1045_0877.txt >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
#-------------------------------------------------
# Split the uploadable street intersection file
# into multiple files and put those files into a
# new folder named "street_intersections_new".
system( 'head -n 3 split_on_server.pl >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
# conlts:
system( 'rm intersections_new/lat9_*/intersections_category_*.txt' ) ;
# conlts:
system( 'perl split_on_server.pl < output_uploadable_street_intersections.txt' ) ;
system( 'head -v intersections_new/lat9_1045/intersections_category_1045_0877.txt >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
#-------------------------------------------------
# Create a version of the intersection data file
# that uses standard decimal signed numbers for
# latitude and longitude.
system( 'head -v output_uploadable_street_intersections.txt >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
system( 'head -n 3 osm_prepare_to_convert_intersection_lats_lons_to_decimal.pl >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
# conlts:
system( 'perl osm_prepare_to_convert_intersection_lats_lons_to_decimal.pl < output_uploadable_street_intersections.txt > output_pre_converted_for_intersections_decimal.txt' ) ;
system( 'head -v output_pre_converted_for_intersections_decimal.txt >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
system( 'head -n 3 osm_convert_lats_lons_to_decimal.pl >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
# conlts:
system( 'perl osm_convert_lats_lons_to_decimal.pl < output_pre_converted_for_intersections_decimal.txt > output_uploadable_street_intersections_decimal.txt' ) ;
system( 'head -v output_uploadable_street_intersections_decimal.txt >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
#-------------------------------------------------
# Show the file sizes.
system( 'ls -sSr output_*.txt >> output_log_intersection_processing.txt' ) ;
# system( 'wc -l output_*.txt >> output_log_intersection_processing.txt' ) ;
system( 'tail -n 3 output_log_intersection_processing.txt' ) ;
#-------------------------------------------------
# Display instructions for what to do next, which
# is to compress the data, upload it to the
# server, then uncompress it.
print "\n\n" . "Do next: Use the cd command to enter the new folders (intersections_new, street_names_new, street_words_new) and execute the following commands which must include the period at the end:" . "\n" ;
print " zip -r -q uploadable_intersections_zipped.zip ." . "\n" ;
print " zip -r -q uploadable_street_names_zipped.zip ." . "\n" ;
print " zip -r -q uploadable_street_words_zipped.zip ." . "\n" ;
print "\n" . "Then upload the created zip files to the server into new folders with the same folder names and unzip each file using the following command:" . "\n" ;
print " unzip uploadable_street_XXXXXs_zipped.zip" . "\n" ;
#-------------------------------------------------
# All done handling intersections.