Skip to content

Commit 2ed5717

Browse files
committed
Merge branch '2024_1_staging' of https://github.com/morehawes/waymark into 2024_1_staging
2 parents 891d3ff + 613379d commit 2ed5717

File tree

3 files changed

+116
-122
lines changed

3 files changed

+116
-122
lines changed

inc/Helpers/Waymark_GeoJSON.php

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,27 @@
22

33
class Waymark_GeoJSON {
44

5-
static public function string_to_feature_collection($string = '') {
5+
/**
6+
* Convert a GeoJSON string to an array
7+
*
8+
* @param string $string GeoJSON string
9+
* @return array GeoJSON array
10+
*/
11+
static public function string_to_feature_collection(String $string = '') {
612
if (is_string($string)) {
713
return json_decode($string, true, 512, JSON_OBJECT_AS_ARRAY);
814
}
915

1016
return false;
1117
}
1218

13-
static public function get_feature_count($FeatureCollection = []) {
19+
/**
20+
* Get count of features in a GeoJSON array
21+
*
22+
* @param array $FeatureCollection GeoJSON array
23+
* @return int Count of features
24+
*/
25+
static public function get_feature_count(Array $FeatureCollection = []) {
1426
if (is_string($FeatureCollection)) {
1527
$FeatureCollection = self::string_to_feature_collection($FeatureCollection);
1628
}
@@ -23,7 +35,15 @@ static public function get_feature_count($FeatureCollection = []) {
2335
return false;
2436
}
2537

26-
static public function update_feature_property($FeatureCollection = [], $property_key = null, $property_value = null) {
38+
/**
39+
* Update every feature's property in a GeoJSON array
40+
*
41+
* @param array $FeatureCollection GeoJSON array
42+
* @param string $property_key Property key
43+
* @param string $property_value Property value
44+
* @return array Updated GeoJSON array
45+
*/
46+
static public function update_feature_property(Array $FeatureCollection = [], String $property_key = '', String $property_value = '') {
2747
if (is_string($FeatureCollection)) {
2848
$FeatureCollection = self::string_to_feature_collection($FeatureCollection);
2949
}
@@ -44,7 +64,13 @@ static public function update_feature_property($FeatureCollection = [], $propert
4464
return $FeatureCollection;
4565
}
4666

47-
static public function clean_feature_descriptions($FeatureCollection = []) {
67+
/**
68+
* Replace bad characters in every feature's description property in a GeoJSON array
69+
*
70+
* @param array $FeatureCollection GeoJSON array
71+
* @return array Updated GeoJSON array
72+
*/
73+
static public function clean_feature_descriptions(Array $FeatureCollection = []) {
4874
//Feature Collection
4975
if ($FeatureCollection && isset($FeatureCollection['features'])) {
5076

@@ -61,6 +87,12 @@ static public function clean_feature_descriptions($FeatureCollection = []) {
6187
return $FeatureCollection;
6288
}
6389

90+
/**
91+
* Sort features into Markers, Lines and Shapes and then by type
92+
*
93+
* @param array $FeatureCollection GeoJSON array
94+
* @return array Sorted GeoJSON array
95+
*/
6496
static public function features_by_overlay_type(Array $FeatureCollection = []) {
6597

6698
// Waymark_Helper::debug($FeatureCollection);

readme.md

Lines changed: 40 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Waymark adds powerful mapping features to WordPress that are easy to use. Create
1212

1313
## Description ##
1414

15-
🗺 [View the Demo](https://www.waymark.dev/demo/)
15+
🗺 [View the Demo](https://www.waymark.dev/)
1616
🛠️ [Try the Editor](https://www.waymark.dev/try/)
1717
📼 [Watch the Video](https://www.waymark.dev/#footer)
1818
📖 [Read the Docs](https://www.waymark.dev/docs/)
@@ -21,68 +21,54 @@ Waymark adds powerful mapping features to WordPress that are easy to use. Create
2121

2222
### Creating Maps
2323

24-
Use the intuitive [Editor](https://www.waymark.dev/try/) to create Maps with interactive Overlays. A Map could contain a single Marker/Line/Shape, or many thousands.
25-
26-
- **Overlays** - Markers, Lines and Shapes can have:
27-
- Title
28-
- Image
29-
- Description
30-
- [Type](https://www.waymark.dev/docs/types/)
31-
- **Import** - From:
32-
- [GPX](https://www.topografix.com/gpx.asp)
33-
- [KML](https://developers.google.com/kml/documentation/kmlreference)
34-
- [GeoJSON](https://geojson.org/) (including [Properties](https://www.waymark.dev/docs/settings/#properties))
35-
- [EXIF](https://www.loc.gov/preservation/digital/formats/fdd/fdd000147.shtml) (Image location metadata)
36-
- [Elevation data](https://www.waymark.dev/map/track-with-elevation/)
24+
Use the intuitive [Editor](https://www.waymark.dev/try/) to create Maps with one, or thousands of interactive Overlays.
25+
26+
- **Overlays** - Create Markers, Lines and Shapes with:
27+
- Title
28+
- Image (Upload or link to external image)
29+
- Description (Rich text editor, HTML supported)
30+
- [Type](https://www.waymark.dev/docs/types/) (defined in Settings)
31+
- **Import**
32+
- GPX
33+
- KML
34+
- GeoJSON (including [Properties](https://www.waymark.dev/docs/settings/#properties))
35+
- EXIF (Image location metadata)
36+
- [Elevation data](https://www.waymark.dev/map/track-with-elevation/) (adds an interactive profile chart for Lines with elevation data)
37+
- **[Meta](https://www.waymark.dev/docs/meta/)** - Add extra information to your Maps using Meta; these are customisable form inputs that allow you to add additional content to your Maps.
38+
- **[Types](https://www.waymark.dev/docs/types/)** - Set options to visuallly distinguish between Overlays (colours/icons etc.), then select it when using the Editor.
39+
- **[Collections](https://www.waymark.dev/docs/collections/)** - Group Maps together and display multiple Maps at once. Create complex Collection hierarchies to suit your needs and associate Maps with multiple Collections.
40+
- **[Submissions](https://www.waymark.dev/docs/submissions/)** - Allow registered users, or guests to create Maps from the front-end of your site. You can control who can Submit Maps, what editor features are available and whether submissions should be approved before they are published.
3741

3842
### Displaying Maps
3943

40-
- Use the [Shortcode](https://www.waymark.dev/docs/shortcodes/), or link to the [Map Details](https://www.waymark.dev/map/route-map/) page.
44+
Embed your Maps using the Shortcode, or link to the [Map Details](https://www.waymark.dev/map/route-map/) page.
4145

4246
- **[Shortcodes](https://www.waymark.dev/docs/shortcodes/)**
43-
- Display a single Map, or a [Collection](https://www.waymark.dev/docs/collections/) of Maps anywhere that Shortcodes are supported.
44-
- The Shortcode Header displays the Map/Collection title, a link to the Map Details page, any [Meta](https://www.waymark.dev/docs/shortcodes/) and an optional Export feature.
45-
- Display a [Marker](https://www.waymark.dev/docs/shortcodes/#shortcode-markers) defined through the Shortcode.
46-
- Display [Files](https://www.waymark.dev/docs/shortcodes/#shortcode-files) (GPX, KML & GeoJSON) without the need for a Map to be created.
47-
- Customise which features
48-
49-
50-
Lines can also have direction arrows.
51-
52-
53-
54-
* An interactive profile chart can be displayed for Tracks uploaded with elevation data.
55-
56-
57-
58-
### Customisable
59-
60-
- **[Basemaps](https://www.waymark.dev/docs/basemaps/)** - Uses [OpenStreetMap](https://www.openstreetmap.org/fixthemap) by default, with support for multiple Basemaps.
61-
- **[Types](https://www.waymark.dev/docs/types/)** - Set styles and options (colours/icons etc.) once, then select it when adding an Overlay.
62-
- **[Meta](https://www.waymark.dev/docs/meta/)** - Add extra information to your Maps using Meta; these are customisable form inputs that allow you to add additional data to your Maps.
63-
Settings
64-
CSS
65-
JavaScript
47+
- Display a single Map, or a [Collection](https://www.waymark.dev/docs/collections/) of Maps anywhere that Shortcodes are supported.
48+
- An optional Shortcode Header displays the Map/Collection title, a link to the Map Details page and any [Meta](https://www.waymark.dev/docs/shortcodes/).
49+
- Display a [Marker](https://www.waymark.dev/docs/shortcodes/#shortcode-markers) defined through the Shortcode.
50+
- Display [Files](https://www.waymark.dev/docs/shortcodes/#shortcode-files) (GPX, KML & GeoJSON) from a URL without the need for a Map to be created.
51+
- Display a Basemap only, without any overlays by providing centre and zoom parameters.
52+
- **[Basemaps](https://www.waymark.dev/docs/basemaps/)** - Uses [OpenStreetMap](https://www.openstreetmap.org/fixthemap) by default, with support for multiple raster tiled/"slippy" Basemaps.
53+
- **Overlay Filter** - Allow the user to filter which Markers, Lines and Shapes are currently visible on the Map. The current Basemap can also be switched.
54+
- **[Export](https://www.waymark.dev/docs/shortcodes/#shortcode-export)**
55+
- (Optionally) Let anyone Export Maps into GPX, KML and GeoJSON formats through the Shortcode Header or on the Map Details page.
56+
- Works with the Overlay Filter to only include the currently visible Overlays.
57+
- Works on mobile devices.
6658

59+
### Customising
6760

61+
Built to be flexible, Waymark has lots of Settings to choose from.
6862

69-
### Data Formats
63+
For developers:
7064

71-
* Import from GPX, KML and GeoJSON formats (GeoJSON properties can also be imported). You can export Maps and Collections in the same formats and let your visitors do it too.
65+
- Most elements can be [styled using CSS](https://www.waymark.dev/docs/styling-with-css-selectors/) and have sensibly named `waymark-` classes.
66+
- Maps are stored using the custom post type `waymark_map`
67+
- Meta is stored as Custom Fields (prefixed with `waymark_`)
68+
- Collections use the `waymark_collection` Taxonomy.
69+
- Use the [JavaScript callback function](https://www.waymark.dev/docs/callback-function/) to extend Waymark functionality.
7270

73-
74-
### GIS Features
75-
76-
* Add extra information to your Maps using <a href="https://www.waymark.dev/docs/meta/">Meta</a>; these are customisable form inputs that allow you to add additional data to your Maps.
77-
* Group Maps together using <a href="https://www.waymark.dev/docs/collections/">Collections</a> and display multiple Maps at once.
78-
* <a href="https://www.waymark.dev/docs/submissions/">Submissions</a> allow registered users, or guests to create Maps from the front-end of your site. You can control who can Submit Maps, what editor features are available and whether submissions should be approved before they are published.
79-
80-
81-
### Developer Friendly
82-
83-
* For the developers: Maps are stored using the custom post type `waymark_map`, Meta is stored as Custom Fields and Collections use the `waymark_collection` Taxonomy. Most elements can be styled using CSS and have sensibly named `waymark-` classes.
84-
85-
Waymark is free, open-source ([GPL v2](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html)) and a labour of Love. I try to keep the plugin well supported, so please feel free to <a href="https://wordpress.org/support/plugin/waymark/#new-topic-0">reach out</a> with any questions or feedback.
71+
Waymark is free, open-source ([GPL v2](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html)) and a labour of Love. I try to keep the plugin well supported, so please feel free to <a href="https://wordpress.org/support/plugin/waymark/#new-topic-0">reach out</a> with any issues, questions or feedback.
8672

8773
## Installation ##
8874

@@ -94,7 +80,7 @@ With Waymark enabled, click on the "Maps" link in the sidebar to create and edit
9480

9581
### Is There a Demo? ###
9682

97-
Yes, <a href="https://www.waymark.dev/demo/">here</a>. You can also try the Editor <a href="https://www.waymark.dev/try/">here</a>.
83+
Yes, <a href="https://www.waymark.dev/">here</a>. You can also try the Editor <a href="https://www.waymark.dev/try/">here</a>.
9884

9985
### Can I Get More Help? ###
10086

@@ -103,7 +89,6 @@ Yes, please view the <a href="https://www.waymark.dev/docs/">Documentation</a>.
10389
### How Can I Contribute? ###
10490

10591
* [Star the project on GitHub](https://github.com/opengis/waymark/)
106-
10792
* [Rate the plugin](https://wordpress.org/support/plugin/waymark/reviews/#new-post)
10893
* [Report bugs](https://wordpress.org/support/plugin/waymark/#new-topic-0)
10994
* [Suggest new features](https://wordpress.org/support/plugin/waymark/#new-topic-0)
@@ -124,12 +109,8 @@ Please! Waymark is localization ready, <a href="https://translate.wordpress.org/
124109

125110
Waymark relies on input from it's users, thank you to everyone for providing feedback :)
126111

127-
A big thank you to the following projects and their contributors. Without their work this plugin would not be possible:
128-
129112
Built on the shoulders of giants, [thank you](https://www.waymark.dev/docs/thanks/)!
130113

131-
132-
133114
## Screenshots ##
134115

135116
### 1. Add Overlays (Markers, Lines and Shapes) to create detailed interactive Maps. You can import/export from GPX/KML/GeoJSON. ###

0 commit comments

Comments
 (0)