#014 - Stitching vectors

This code is non-reproducible and specific to these particular datasets. However, it’s useful to show what vector stitching looks like when there is no alternative but to manually piece together a mosaic of datasets. In this case, two .csv files, MainShoreline1890.csv and InsetShoreline1890.csv are extracted from an old map from 1890, each of a particular region of Burrard Inlet. The code below shows the stepwise process that pieces sections together, alternating between source files.

Main=readmatrix('MainShoreline1890.csv');
Inset=readmatrix('InsetShoreline1890.csv');

Q=Main(2802:3130,:);
Q=cat(1,flipud(Q),flipud(Main(3131:3140,:)));
Q=cat(1,(Q),flipud(Main(3141:3174,:)));
Q=cat(1,(Q),flipud(Main(3175:3185,:)));
Q=cat(1,(Q),flipud(Main(3186:3193,:)));
Q=cat(1,(Q),flipud(Main(3194:3230,:)));
Q=cat(1,(Q),flipud(Main(2046:2416,:)));
Q=cat(1,(Q),flipud(Main(3231:3234,:)));
Q=cat(1,(Q),flipud(Main(3235:3238,:)));
Q=cat(1,(Q),flipud(Main(3239:3330,:)));
Q=cat(1,(Q),flipud(Inset(6608:7123,:)));
Q=cat(1,(Q),flipud(Inset(932:1966,:)));
Q=cat(1,(Q),flipud(Inset(6225:6607,:)));
Q=cat(1,(Q),(Main(1870:1889,:)));
Q=cat(1,(Q),flipud(Main(3331:3341,:)));
Q=cat(1,(Q),flipud(Main(3342:3362,:)));
Q=cat(1,(Q),flipud(Main(2417:2439,:)));
Q=cat(1,(Q),flipud(Main(2440:2447,:)));
Q=cat(1,(Q),flipud(Main(3363:3546,:)));
Q=cat(1,(Q),flipud(Main(3547:3568,:)));
Q=cat(1,(Q),flipud(Main(3569:3596,:)));
Q=cat(1,(Q),flipud(Main(3597:3783,:)));
Q=cat(1,(Q),flipud(Main(3784:3813,:)));
Q=cat(1,(Q),flipud(Main(3814:3942,:)));
Q=cat(1,(Q),flipud(Main(3943:3987,:)));
Q=cat(1,(Q),flipud(Main(3988:4027,:)));
Q=cat(1,(Q),flipud(Main(4028:4220,:)));
Q=cat(1,(Q),flipud(Main(4221:4432,:)));
Q=cat(1,(Q),flipud(Main(4433:4763,:)));
Q=cat(1,(Q),flipud(Main(4764:4781,:)));
Q=cat(1,(Q),flipud(Main(4782:4815,:)));
Q=cat(1,(Q),flipud(Main(4816:4817,:)));
Q=cat(1,(Q),flipud(Main(4818:4970,:)));
Q=cat(1,(Q),flipud(Main(4971:4975,:)));
Q=cat(1,(Q),flipud(Main(4976:4991,:)));
Q=cat(1,(Q),flipud(Main(4992:4993,:)));
Q=cat(1,(Q),flipud(Main(4994:5048,:)));
Q=cat(1,(Q),flipud(Main(5049:5063,:)));
Q=cat(1,(Q),flipud(Main(5064:5066,:)));
Q=cat(1,(Q),flipud(Main(5067:5078,:)));
Q=cat(1,(Q),flipud(Main(5079:5081,:)));
Q=cat(1,(Q),flipud(Main(5082:5085,:)));
Q=cat(1,(Q),flipud(Main(5086:5087,:)));
Q=cat(1,(Q),flipud(Main(5088:5109,:)));
Q=cat(1,(Q),flipud(Main(5110:5111,:)));
Q=cat(1,(Q),flipud(Main(5112:5155,:)));
Q=cat(1,(Q),flipud(Main(5156:5157,:)));
Q=cat(1,(Q),flipud(Main(5158:5317,:)));
Q=cat(1,(Q),flipud(Main(5318:5325,:)));
Q=cat(1,(Q),flipud(Main(5326:5340,:)));
Q=cat(1,(Q),flipud(Main(5341:5342,:)));
Q=cat(1,(Q),flipud(Main(5343:5357,:)));
Q=cat(1,(Q),flipud(Main(5358:5359,:)));
Q=cat(1,(Q),flipud(Main(5360:5466,:)));
Q=cat(1,(Q),flipud(Main(5467:5468,:)));
Q=cat(1,(Q),flipud(Main(5469:5522,:)));
Q=cat(1,(Q),flipud(Main(5523:5525,:)));
Q=cat(1,(Q),flipud(Main(5526:5538,:)));
Q=cat(1,(Q),flipud(Main(5539:5555,:)));
Q=cat(1,(Q),flipud(Main(5556:5567,:)));
Q=cat(1,(Q),flipud(Main(5568:5570,:)));
Q=cat(1,(Q),flipud(Main(5571:5572,:)));

North1890=Q;
 
Q=Main(2448:2612,:);
Q=cat(1,(Q),(Main(1:287,:)));
Q=cat(1,(Q),(Main(2613:2682,:)));
Q=cat(1,(Q),(Main(2796:2801,:)));
Q=cat(1,(Q),(Main(2683:2795,:)));
Q=cat(1,(Q),(Inset(4507:4637,:)));
Q=cat(1,(Q),(Inset(4467:4506,:)));
Q=cat(1,(Q),(Inset(4638:4718,:)));
Q=cat(1,(Q),(Inset(2417:2888,:)));
Q=cat(1,(Q),(Inset(3724:3810,:)));
Q=cat(1,(Q),(Inset(2217:2416,:)));
Q=cat(1,(Q),(Inset(3811:3861,:)));
Q=cat(1,(Q),(Inset(1:931,:)));
Q=cat(1,(Q),(Inset(3862:4466,:)));
Q=cat(1,(Q),(Inset(4719:5892,:)));
Q=cat(1,(Q),(Inset(2889:3247,:)));
Q=cat(1,(Q),(Inset(5893:6224,:)));
Q=cat(1,(Q),(Inset(3248:3723,:)));
Q=cat(1,(Q),(Inset(2159:2216,:)));
Q=cat(1,(Q),(Main(7227:7942,:)));
Q=cat(1,(Q),(Main(288:1688,:)));
Q=cat(1,(Q),(Main(7220:7226,:)));
Q=cat(1,(Q),(Main(6516:7219,:)));
Q=cat(1,(Q),(Main(6514:6515,:)));
Q=cat(1,(Q),(Main(6056:6513,:)));
Q=cat(1,(Q),(Main(6054:6055,:)));
Q=cat(1,(Q),(Main(6021:6053,:)));
Q=cat(1,(Q),(Main(6019:6020,:)));
Q=cat(1,(Q),(Main(6012:6018,:)));
Q=cat(1,(Q),(Main(6010:6011,:)));
Q=cat(1,(Q),(Main(5996:6009,:)));
Q=cat(1,(Q),(Main(5994:5995,:)));
Q=cat(1,(Q),(Main(5987:5993,:)));
Q=cat(1,(Q),(Main(5919:5986,:)));
Q=cat(1,(Q),(Main(5799:5918,:)));
Q=cat(1,(Q),(Main(5797:5798,:)));
Q=cat(1,(Q),(Main(5613:5796,:)));

South1890=Q;

Visualization is key to track stitching progress, and to fine-tune index selection. The code below plots progress. Notice the use of the decimal GUI hack from “#010 - Increasing Matlab’s cursor resolution”. In the figure, the scrambled source files are assembled into two continuous vectors, one for the northern shore and one for the south. The three dimensional view shows the vector index in addition to latitude and longitude.

figure('Position',[10,10,1420,780],'Resize','off');hold on;
decimal_10=datacursormode();set(decimal_10,'UpdateFcn',@DecimalGUI,'Enable','on');
plot3(Main(:,1),Main(:,2),1:length(Main));
plot3(Inset(:,1),Inset(:,2),1:length(Inset));
plot3(North1890(:,1),North1890(:,2),1:length(North1890),'-c','LineWidth',1.25);
plot3(South1890(:,1),South1890(:,2),1:length(South1890),'-c','LineWidth',1.25);
view(0,90);

 

 

 

Many thanks to fellow PhD researcher Greig Olford who georectified an old 1893 Admiraly map of Burrard Inlet using ArcGIS, which formed the basis for the vectorized shoreline data in the .csv files shown above.