Google Earth Tools for Capturing Buildings
by Buddy McCloskey Contact
1. Google Earth Tools: 05/03/2013
With the Ruler Icon tool or Tools > Ruler, we have choices 'Line' or 'Path'. The path choice can give us 4 points in order but the line
only gives us 2 points. The path around the building corners would be better, except line records ground elevation in meters while path
doesn't. Running the mouse across the roof, with the building's 3D on, we eyeball an average height ft. msl which includes the terrain.
We click on the lower left building corner xg,yg first then xg,yg next. A yellow length line appears connecting these
to give us the length(l) or width(w). However, this length isn't included in the save. Click [Save] and the comment windows appears. Within
the window Name: blue Line Measure box, give it a building name like b1L,b2L, ..., for L= length then type the eyeball average building height'
in the big blank description window, then click [OK]. It will show up listed in the [Temporary Places] at the bottom of the sidebar .
It's best to pile a group of these b?w, b?l's up before the final save. With the same building showing it's length now changed to red, (SAN B2 L & W), click on the lower left building corner xg,yg again and then to upper left corner (xg,yg) and do similar saves as with length. However, we don't need to type bh in the description window again, but must do so if you forgot to put it in the b1L. The program GETb.c will read bh in either or both as you must save this width as b1W,b2W, ..., for W= width. A series of these are seen in SAN Buildings L & W. Notice in the lower left, the 3D was not turned off and the W-L was drawn to the top of the building so stands out above the building when the 3D is off as shown here. This would overestimate the building, being worse with higher building heights.
Highlight each building name in the bottom [Temporary] and right click it, also can highlight by right click, then hit the [Save Place As], not the [Save to My Places] as that will take it out of and place it above the [Temporary Places]. You haven't lost this and can highlight it there later to [Save Place As]. In the [Save Place As], we find the b5W name and directory tree choice. Also, set the type of file to .kml, not the compressed .kmz binary file as it has to be read in ASCII to write code for extracting as explained below.
2. GETb.c = Google Earth Tools for Buildings:
We have to extract the Google Earth's *.kml files to complete the rectangle building corner # 2 and change the Lat\Lon's for use
in CDRCRD.c . A sample from C:\Radfo\SAN\b5W.kml appears in Building # 5W - KML .
Notice, 'name'=b5W, 'description'=bh=75', 'coordinates'= Long/Lat & Z terrain in meters for both corners 0 & 3.
If there is no 'description' here, then 'coordinates' are found and 'description' should have been in b5L.kml.
We would read b5l.kml first then b5w.kml as they are listen in alphabetical order in the directory input list. SANbkml.dir We pick up 'name' for building name, 'description' for bh and then the 'coordinates' for xg,yg,zm and then read b5w.kml for xg,yg,zm. For the mean ground elevation, we double weight zm as = zm, and average all 4 corners or zf=(zm+2*zm+zm)/4. Then zf in meters, converted to feet and subtracted off from bh for the calculated building height above ground.
A. Replot as a Polygon/Heights:
To fill in xg,yg, let's view Building 260 deg . Here we see a different colored pair of
dx's,dy's for the bw & bl. Following, we derive xg,yg in the lower right hand corner as xg=xg+dx from the
length and yg=yg+dy from the width.
Now we extract from a generic GE Polygon kml file and add building height's in the coordinate section as seen in Poly Building # 5 - KML . The first replacement needed is the 'color' for bh. We chose the last hex 2 characters to display reddish. So just for a test, we doubled the height, then using hex base 16, we convert the value to hex numbers including a-f for 16'ths (bh16) and units (bhu). Note, in the linear ring coordinates and bh, we go dot to dot corners 0-1-2-3-0 to complete the 4 sides, a bent ring for sure?
(1) Example Plots:
We zoom in progressively from (SAN Poly Buildings 1), (SAN Poly Buildings 2) and (SAN Poly Buildings 3). We could have applied this to the individual Lidar extracted buildings but the color is enough indication of height without blocking the other buildings. However, may sneak this in later.
B. Calculate Hidden Components:
Probably the easiest way to reference this pic is to provide several spaced links rather than putting it under this text, then below the pic, scroll up all the time and lose your reading place. So here is another view of Building 260 deg . Here we can calculate bl & bw and area without doing any rotation in The program SANxb18b.c . It is by bw=(dx^2+dy2)^1/2 and bl=(dx^2+dy2)^1/2 for their respective colored dx,dy's. Once we know, bw & bl, we have the building orientation by the angle (dir) formed by it's length as seen in Building 260 deg .
C. Relative G0 Coordinate System:
We have bypassed more code normally found in SANxb18b.c but we still need the G0 Coordinate System that was usually internal in SANb.c . Since out building corners are in Lat/Lon, we only have this to work with. Could use the llutm4() calls but in case we cross UTM zones, let's be universal and apply a relative coordinate system by using the techniques shown in SPbb.dia again.
(1) Building Corners:
We calculate the mid building coordinates bxgmid,bygmid by averaging the 4 xg,yg[s]. We find the converging longitude factor using G0 & mid building by g0bmlc=cos((dlat+bygmid)/2) where g0bmlc = G0-Building Mid-Long Correction. Considering a building near our limit of 5.25 miles away, for SAN, this value is < 2% error if not correcting for 5.25 mi N or S of G0. Also, we must change deg to ft to apply our g0bmlc to. We call this degtf=60*1.15*fpmi @ 0 deg or lat. The units are 60 nmi/deg, 1.15 n-mi/st-mi and 5280'/st-mi. For lat, y[n]=(dlat-yg[n])*degtf in ft. then, x[n]=(dlon-xg[n])*degtf*g0bmlc. In Building 260 deg , it is understood that we are applying these invisible factors here to dx's,dy's from xg,yg's before bl,bw & dir. Then simply area=bl*bw in '^2.
(2) Building - Ground Zero Link:
For building center to G0, we have dx=(dlon-bxgmid),dy=(dlat-bygmid). Then applying lon correction and conversion factors, delta y to G0 from building center is dy0=dy*degtf and dx is dx0=dx*degtf*g0bmlc. We also could have averaged the 4 x,y's. We now again call vect() for dirw=dir for the pressure wave direction (dirw) & range. Then we develop the local building coordinates xo,yo with 0,0 at the center by considering the building lies W-E,N-S or aligned on the x-axis with G0. That is simply +,- 1/2 bl & 1/2 bw for the 4 corners. See Unrotated Rectangle . However, since this is not usually the case, we must rotate the building in reference to G0 for the pressure wave direction or ddir=(dira-dirw) = Building Orientation - Pressure Wave Direction. So we rotate the building back to -ddir and define sind=sin(-ddir) & cosd=cos(-ddir). Then the rotated 4 Corners are xr[n]=xo[n]*cosd + yo[n]*sind and yr[n]=yo[n]*cosd - xo[n]*sind. Finding the cross wave by max-ymin of the yr's, then dwbl=area/cw. This is a partial review portion of the complete PSI explanation topic earlier summarized by pic Real Rotated Rectangle . The final results of all this is to add these extracted buildings to the drlwh.san list. Safest to cut and paste the buildings after removing the header in SAN's drlwhgeb . Notice, these buildings are not from a tile (-1).