Google map and .kml file example




















Network links give you the power to serve content from a remote location and are commonly used to distribute data to large numbers of users. In this way, if the data needs to be amended, it has to be changed only at the source location, and all users receive the updated data automatically. With some knowledge of a scripting language such as PHP, Python, or Perl, you can create a script that delivers a stream or file of KML data to each network link.

The response must be valid KML. For complex applications, proper error handling is very important. Tip: A simple way to handle errors is to parse the server's error as the text for a folder name. This is more informative and more user-friendly than letting the connection drop. Whenever the network link is refreshed, the Python script runs again and generates KML with new latitude and longitude values. A standard network link is a uni-directional link: data flows only from the server to Google Earth.

The view-based refresh enables bi-directional communication. When the view-based refresh is active, Google Earth returns the view coordinates to the server at a specified time. This may be every n seconds, minutes, or hours, or once a certain amount of time has elapsed since the view stopped moving.

The coordinates are returned to the server by means of an HTTP GET that appends the coordinates as follows this is the default bounding box information :. If the request were made while the user was looking down on San Francisco, the coordinates might look as follows:. This feature can be used for some very creative applications, but to get you started, a simple example is presented below. The following server-side Python script parses the return message sent by Google Earth and responds with a Placemark at the center of the screen.

Each time the Network Link is refreshed, a new Placemark is generated. The principle illustrated in this example can be used for some very complex applications. For example, if you have a database of geographic information, you can extract the coordinates of the viewer, make a call to the database for the data specific to the view, and return it to Google Earth as KML.

When responding to a request from Google Earth or any Earth browser , a KML server must follow a certain set of rules so that Google Earth can correctly interpret its responses. If the server returns invalid KML, the Network Link will stop, deactivate, and output an error message. Ready for more? Also, browse the KML Reference for information on specific elements.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4. For details, see the Google Developers Site Policies.

Keyhole Markup Language. By this stage of the tutorial, you have captured click events on the layer's features. You can now set the application to write the feature's data and info window content to the sidebar. Now each time you click a KML feature on the map, the sidebar updates to display its info window content. Read more about using KML files. Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.

For details, see the Google Developers Site Policies. Routes Directions API. Places Places API. Get Started Contact sales. Guides Reference Samples Support. Use data with your map. Customizing a map. Customizing with Cloud-based maps styling. Customizing with JSON styling. Interact with the map. Give it a descriptive name for example, buffetthawaiitour. Put the default KML file doc. Include only one. It ignores all subsequent. If the archive contains multiple. Include one or more subfolders within the main folder to collect images, models, textures, sound files, or other resources referenced in the doc.

The complexity of this directory structure depends on the number of supporting files and your preferences for organization. Use relative references. See References to External Files for more details. All relative paths begin inside the base folder described above in item 1. For example, if a KMZ file vacationJournal.

Do not use the. For example, here is the file structure of the KMZ file for the Jimmy Buffett tour: Since there are only five supporting files, they are all collected into a files subfolder within the main folder. Right click on the page View Source. Download the file. Double-click to open the downloaded zip file. Double-click on the file name to open in Google Earth. Google Earth must be installed on your computer; see download link above.

Ireland by Car — the best, most comprehensive travel guide to Ireland Active 4 years, 6 months ago. Post navigation Download Adobe Java.



0コメント

  • 1000 / 1000