开发者 | christian_feldbauer |
---|---|
更新时间 | 2020年8月6日 12:19 |
PHP版本: | 3.0.1 及以上 |
WordPress版本: | 5.3.2 |
版权: | GPLv2 or later |
版权网址: | 版权信息 |
Here are some examples to report a latitude of 25° 51' N and a longitude of 135° 7.3' W as your current location: [locationreport lat="25.85" lon="-135.1217"] ... Here the coordinates are given in decimal degrees. Positive values for N and E, negative for S and W. Note, as this format does not have any blanks, the quotes can be omitted: [locationreport lat=25.85 lon=-135.1217] ... This is fine as well. [locationreport lat="25° 51' N" lon="135° 7.3' W"] ... If you really love typing (and searching for the degree character)... Coordinates are given as a triplet of degrees (positive integer), minutes (decimal) and cardinal direction. [locationreport lat=25°51'N lon=135°7.3'W] ... Without blanks the quotes are not needed. [locationreport lat="25 51 N" lon="135 7.3 W"] ... The degree and minute characters are not needed. [locationreport lat="25 51N" lon="135 7.3W"] ... Is okay as well. [locationreport lat="25N 51" lon="135W 7.3"] ... And so is this. [locationreport lat="N25 51" lon="W135 7.3"] ... And this. [locationreport lat=25N51 lon=135W7.3] ... And also this. Choose your favorite coordinate format and put this shortcode with your actual location in a blog entry. That's it. Giving the position as degrees, minutes and seconds is not supported yet.
When the blog entry is saved (published or private), the shortcode is replaced by a short paragraph: 'Position reported on DATE at TIME UTC: LAT, LON.' and a placemark is added/modified in the kml files for your route and your current location. Date and time is taken from the post's publication time. The post title and the text content are shown in the popup window of the created placemark.
The kml files are in your blog's upload directory in the subfolder 'locationreport', normally at '/wp-content/uploads/locationreport/'. The files are named 'latest.kml' and 'route.kml'.
There are many map plugins available for WordPress. You need one that is capable of displaying kml files. I successfully tested displaying the locationreport kml files using the 'OSM' plugin, the 'Flexible Map' plugin, 'Leaflet Map', and 'Geo Mashup'. Leaflet Map does not (yet) support marker icons from kml styles out-of-the-box, however installation of the 'Leaflet FullKML' plugin adds this support. All those tested plugins provide shortcodes to put a map on a post, a page or a text widget. Refer to the documentation of your favorite map plugin for more information on how to display kml files.
Some servers as well as some web browsers cache kml files. Since version 1.0.4 an easy workaround is implemented: the upload directory now also contains html-links to the kml files. Now, instead of telling your map plugin to load 'route.kml', let it load 'route.html'.
Yes, that is possible. Since version 1.0.3 you can easily do that by editing the post that contains the problematic [locationreport ...] shortcode. Log in to your blog and search for the post and click 'Edit.' Modify the [locationreport ...] shortcode with the corrected coordinates, and the corresponding placemark in the kml file(s) will be updated. You can also modify the post title and the remaining post content (which will be shown in the placemark's popup window). Even the post's publication date can be modified (this can be used to change the route along the placemarks in a modified order).
Yes. Create a new post with a [locationreport ...] shortcode and change the publication date/time to a past date/time that is in-between the dates/times of those two placemarks where you want to insert the new one.
Yes. Edit the post that contains the corresponding '[locationreport lat=.. lon=..]' shortcode and remove both the 'lat' and 'lon' attributes, i.e., it can be empty like '[locationreport]'. When updating the post, the shortcode in the post and the placemark in the kml file(s) is removed. If the placemark belongs to an archived route, it can be deleted from that archive in the same way by removing the 'lat' and 'lon' attributes, however the 'file' attribute MUST NOT be removed, e.g., '[locationreport file="archive.kml"]'.
On your WordPress admin page you can find a menu entry 'LocationReport' under 'Settings' that opens the LocationReport Manager. Use it to archive your old route and to start a new one.
Kml files can include styles to define placemark icons (as well as line styles), and both locationreport kml files are prepared with empty style definitions for easy customization. To change how the placemark for your latest location is displayed, you can add your IconStyle definition in the file 'style.kml' inside the Style element called 'locationreportLatestStyle' by manually editing the kml file: click on 'Editor' under the 'Plugin' section of your dashboard. Select 'Location Report' as the plugin to be edited. Then select the file 'style.kml.txt' (the .txt extensions are just a workaround to get the kml files included in the file list). Save the file by clicking on 'Update File'. This style definition will effect markers in both kml files, latest.kml and route.kml (most recent marker only). You also can change the placemark icon for the older location reports as well as the line style for your route. Simply add your IconStyle and LineStyle definitions in the file 'style.kml.txt' inside the Style element called 'locationreportRouteStyle'. Don't change the styles inside latest.kml or route.kml (or their symbolic links latest.kml.txt or route.kml.txt) directly as these files will be overwritten when you use the [locationreport] shortcode the next time. Here are some example style definitions: http://yourblog.com/icon.jpg ff0088ff ff0000ff 6 For a complete documentation on how to define styles refer to the KML reference. Since version 1.0.3 this plugin comes with a template customized for a sailboat, which can be (usually) found at /wp-content/plugins/locationreport/templates/lilly. If you like to use this for your blog, copy all files within lilly/ to your blog's upload folder, usually under /wp-content/uploads/locationreport/.