[TikiWiki-commits] [Git][tikiwiki/tiki][30.x] Fixes for geojson files and features and other issues
"Jonny Bradley \(@jonnybradley\) via TikiWiki-cvs" <[email protected]>
| Newsgroups | gmane.comp.cms.tiki.cvs |
|---|---|
| Message-ID | <69cfdf48e7520_3b19076c6261f@gitlab-sidekiq-low-urgency-cpu-bound-v2-5cdf7b99ff-5wllp.mail> |
Jonny Bradley pushed to branch 30.x at Tiki Wiki CMS Groupware / Tiki Commits: 145b1e60 by Jonny Bradley at 2026-04-03T15:32:07+00:00 Fixes for geojson files and features and other issues --- * Fixes for geojson files and features and other issues --- * [FIX] uglify * [FIX] maps: Set style for vector intent features and improve projection mapping to use the current view's one * [MOD] maps: Fixes for geojson files and features, not working yet but no more js errors... * [FIX] maps: Now that plugin defaults are applied properly these random numbers just produce layer errors - no idea why I put these here in 2019, apologies See merge request tikiwiki/tiki!9889 (cherry picked from commit 51173c190691886533e000551d5ca443cdd7226e) cbe7881b [FIX] maps: Now that plugin defaults are applied properly these random numbers... 2207da68 [MOD] maps: Fixes for geojson files and features, not working yet but no more js errors... 9df59c79 [FIX] maps: Set style for vector intent features and improve projection... 212329cf [FIX] uglify Co-authored-by: Jonny Bradley <[email protected]> See merge request tikiwiki/tiki!9933 - - - - - 2 changed files: - lib/wiki-plugins/wikiplugin_map.php - src/js/jquery-tiki/tiki-maps-ol3.js Changes: ===================================== lib/wiki-plugins/wikiplugin_map.php ===================================== @@ -116,7 +116,7 @@ function wikiplugin_map_info() 'name' => tra('Tileset layers'), 'description' => tra('Tilesets to use for background layers, comma separated. Tileset groups can be added separated by a tilde character (requires Open Layers v3+, default is the geo_tilesets preference)'), 'since' => '20.1', - 'default' => "86, 134, 200", + 'default' => '', 'filter' => 'text', 'advanced' => true, ], ===================================== src/js/jquery-tiki/tiki-maps-ol3.js ===================================== @@ -289,20 +289,26 @@ import { defaults as defaultControls } from "ol/control"; } // Check for color on feature property - var featureColor = feature.get("color"); - if (featureColor) { + const intent = feature.get("intent"); + if (intent === "vectors") { + let borderColor = feature.get("color") ?? "#999"; + let fillColor = feature.get("fillColor"); + + if (!fillColor) { + // from theme-customizer.js + //fillColor = lightenDarkenColor(borderColor, -10); + fillColor = borderColor; + borderColor = "#666"; + } + return new ol.style.Style({ - geometry: feature.getGeometry(), - image: new ol.style.Circle({ - radius: 10, - fill: new ol.style.Fill({ color: featureColor }), - stroke: new ol.style.Stroke({ color: "#333", width: 2 }), - }), + fill: new ol.style.Fill({ color: fillColor }), + stroke: new ol.style.Stroke({ color: borderColor, width: 2 }), }); } // Check if it's a marker with icon - if (feature.get("intent") === "marker") { + if (intent === "marker") { return new ol.style.Style({ geometry: feature.getGeometry(), image: new ol.style.Icon({ @@ -1579,28 +1585,25 @@ import { defaults as defaultControls } from "ol/control"; } else if (i.geo_file) { // load a file containing geometry, set using tracker Files indexGeometry option - var format, - files = i.geo_file.split(","), - proj4326 = new ol.proj.Projection("EPSG:4326"), - proj900913 = new ol.proj.Projection("EPSG:900913"); + let format; + const files = i.geo_file.split(","); layer = container.getLayer(layerName); - if (i.geo_file_format == "geojson") { + if (i.geo_file_format === "geojson") { format = new ol.format.GeoJSON(); } else { - if (i.geo_file_format == "gpx") { + if (i.geo_file_format === "gpx") { format = new ol.format.GPX(); } } - for (var f = 0; f < files.length; f++) { + for (let f = 0; f < files.length; f++) { $.get(files[f], function (data) { - if (data.indexOf(""") > -1) { - // decode html entities coming from file galleries - data = $("<div/>").html(data).text(); - } try { - features = format.readFeatures(data); + features = format.readFeatures(data, { + dataProjection: "EPSG:4326", + featureProjection: container.map.getView().getProjection(), + }); } catch (e) { // Corrupted feature - display plain marker $(container).addMapMarker({ @@ -1632,12 +1635,6 @@ import { defaults as defaultControls } from "ol/control"; if (!feature.get("popup_tpl")) { feature.set("popup_tpl", $(form).data("popup-tpl")); } - // for some reason geometry needs to be in 900913 projection to correctly appear - // in the "Editable" vector layer, even though layer.projection === "EPSG:4326" - let geometry = feature.getGeometry(); - if (geometry) { - geometry.transform(proj4326, proj900913); - } }); layer.getSource().addFeatures(features); View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/145b1e6090154468237574c7b767cc7696c09721 -- View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/145b1e6090154468237574c7b767cc7696c09721 You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help _______________________________________________ TikiWiki-cvs mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs