Hacking Google Maps and Google Earth (ExtremeTech)

(Dana P.) #1

Chapter 16 — Generating Google Earth Feeds 323


printf(“”,lc($row->{type}));


printf(“\n1\nrelativeToGround ;


\n%s,%s,250\n\n”,
$row->{lng},
$row->{lat},
);

}
$sth->finish();


print(“\n\n”);


The preceding script also introduces another concept. You extrude the point from the ground.
This creates a line between the icon used to represent the entity and its actual location on the
ground. To do this, when defining the tag of the KML you add the extrude option:


1

You then need to set the altitude of the point, first by defining the relationship between the actual
point on the ground and the elevation at which you want to create the tag:


relativeToGround

The relativeToGroundspecification sets the system so that the height is relative to the
height of the ground where the marker is created. So, if you specify the altitude of the point as
250m, but the elevation of the location is already 68m, then the marker would display at 318m
above sea level.


Other options are clampedToGround(the altitude is ignored, this is the default mode) and
absolute, where the altitude is exactly as specified (250m would display at 250m above sea
level, even if the elevation of that point was more than that amount).


Figure 16-8 shows the resulting information in Google Earth. You can see how the markers
appear to float above the map, but a line is clearly connected from the marker to the real lati-
tude/longitude of the point.


Because the information is floating, rotating the map shows the icons constantly associated
with the right location (see Figure 16-9).


Although the view is quite confusing here, users have the ability to include and exclude the dif-
ferent businesses they want to view because businesses are grouped into appropriate folders.
The organization (providing the KML is generated appropriately) is automatic and is a lot eas-
ier to use than the system that had to be developed within Google Maps.

Free download pdf