Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions assets/src/modules/Geolocation.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import { Vector as VectorLayer } from 'ol/layer.js';
import Point from 'ol/geom/Point.js';
import Circle from 'ol/geom/Circle.js';
import Feature from 'ol/Feature.js';
import Style from 'ol/style/Style.js';
import Icon from 'ol/style/Icon.js';

/**
* @class
Expand Down Expand Up @@ -236,6 +238,16 @@ export default class Geolocation {
geometry: new Point(coordinates)
});

const iconStyle = new Style({
image: new Icon({
src: 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbDpzcGFjZT0icHJlc2VydmUiIHZpZXdCb3g9IjAgMCAxNzkyIDE3OTIiIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiI+CiAgPHBhdGggZD0iTTE4OCAxNjU5IDg5NiAxMzNsNzA4IDE1MjYtNzA4LTM3M3oiLz4KPC9zdmc+Cg==', // eslint-disable-line
rotation: this._geolocation.getHeading(),
rotateWithView: true,
}),
});

positionFeature.setStyle(iconStyle);

const accuracyFeature = new Feature({
geometry: new Circle(coordinates, this._geolocation.getAccuracy() / 2)
});
Expand Down
71 changes: 53 additions & 18 deletions tests/qgis-projects/tests/geolocation.qgs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<qgis projectname="" saveDateTime="2024-01-08T12:04:51" saveUser="nboisteault" saveUserFull="nboisteault" version="3.28.14-Firenze">
<qgis projectname="" saveDateTime="2025-10-17T10:07:00" saveUser="nboisteault" saveUserFull="nboisteault" version="3.40.11-Bratislava">
<homePath path=""></homePath>
<title></title>
<transaction mode="Disabled"></transaction>
Expand All @@ -16,6 +16,20 @@
<geographicflag>false</geographicflag>
</spatialrefsys>
</projectCrs>
<verticalCrs>
<spatialrefsys nativeFormat="Wkt">
<wkt></wkt>
<proj4></proj4>
<srsid>0</srsid>
<srid>0</srid>
<authid></authid>
<description></description>
<projectionacronym></projectionacronym>
<ellipsoidacronym></ellipsoidacronym>
<geographicflag>false</geographicflag>
</spatialrefsys>
</verticalCrs>
<elevation-shading-renderer combined-method="0" edl-distance="0.5" edl-distance-unit="0" edl-is-active="1" edl-strength="1000" hillshading-is-active="0" hillshading-is-multidirectional="0" hillshading-z-factor="1" is-active="0" light-altitude="45" light-azimuth="315"></elevation-shading-renderer>
<layer-tree-group>
<customproperties>
<Option></Option>
Expand All @@ -26,7 +40,7 @@
<Option name="wmsShortName" type="QString" value="baselayers"></Option>
</Option>
</customproperties>
<layer-tree-layer checked="Qt::Checked" expanded="0" id="OpenStreetMap_ab9cd479_708a_4147_a0b1_2508e7ba864c" legend_exp="" legend_split_behavior="0" name="OpenStreetMap" patch_size="-1,-1" providerKey="wms" source="type=xyz&amp;url=https://tile.openstreetmap.org/{z}/{x}/{y}.png&amp;zmax=19&amp;zmin=0">
<layer-tree-layer checked="Qt::Checked" expanded="0" id="OpenStreetMap_ab9cd479_708a_4147_a0b1_2508e7ba864c" legend_exp="" legend_split_behavior="0" name="OpenStreetMap" patch_size="-1,-1" providerKey="wms" source="crs=EPSG:3857&amp;format&amp;type=xyz&amp;url=https://tile.openstreetmap.org/%7Bz%7D/%7Bx%7D/%7By%7D.png&amp;zmax=19&amp;zmin=0">
<customproperties>
<Option></Option>
</customproperties>
Expand Down Expand Up @@ -85,7 +99,7 @@
</legendgroup>
</legend>
<mapViewDocks></mapViewDocks>
<main-annotation-layer autoRefreshEnabled="0" autoRefreshTime="0" legendPlaceholderImage="" refreshOnNotifyEnabled="0" refreshOnNotifyMessage="" type="annotation">
<main-annotation-layer autoRefreshMode="Disabled" autoRefreshTime="0" hasScaleBasedVisibilityFlag="0" legendPlaceholderImage="" maxScale="0" minScale="0" refreshOnNotifyEnabled="0" refreshOnNotifyMessage="" styleCategories="AllStyleCategories" type="annotation">
<id>Annotations_b12e8ca5_4086_4f94_95af_3e00b49d1450</id>
<datasource></datasource>
<keywordList>
Expand Down Expand Up @@ -113,6 +127,7 @@
<title></title>
<abstract></abstract>
<links></links>
<dates></dates>
<fees></fees>
<encoding></encoding>
<crs>
Expand All @@ -131,12 +146,21 @@
<extent></extent>
</resourceMetadata>
<items></items>
<flags>
<Identifiable>1</Identifiable>
<Removable>1</Removable>
<Searchable>1</Searchable>
<Private>0</Private>
</flags>
<customproperties>
<Option></Option>
</customproperties>
<layerOpacity>1</layerOpacity>
<blendMode>0</blendMode>
<paintEffect></paintEffect>
</main-annotation-layer>
<projectlayers>
<maplayer autoRefreshEnabled="0" autoRefreshTime="0" hasScaleBasedVisibilityFlag="0" legendPlaceholderImage="" maxScale="0" minScale="1e+08" refreshOnNotifyEnabled="0" refreshOnNotifyMessage="" styleCategories="AllStyleCategories" type="raster">
<maplayer autoRefreshMode="Disabled" autoRefreshTime="0" hasScaleBasedVisibilityFlag="0" legendPlaceholderImage="" maxScale="0" minScale="1e+08" refreshOnNotifyEnabled="0" refreshOnNotifyMessage="" styleCategories="AllStyleCategories" type="raster">
<extent>
<xmin>-20037508.34278924390673637</xmin>
<ymin>-20037508.34278924763202667</ymin>
Expand All @@ -146,11 +170,11 @@
<wgs84extent>
<xmin>-180</xmin>
<ymin>-85.05112877980660357</ymin>
<xmax>179.99999999999997158</xmax>
<xmax>180</xmax>
<ymax>85.05112877980660357</ymax>
</wgs84extent>
<id>OpenStreetMap_ab9cd479_708a_4147_a0b1_2508e7ba864c</id>
<datasource>type=xyz&amp;url=https://tile.openstreetmap.org/{z}/{x}/{y}.png&amp;zmax=19&amp;zmin=0</datasource>
<datasource>crs=EPSG:3857&amp;format&amp;type=xyz&amp;url=https://tile.openstreetmap.org/%7Bz%7D/%7Bx%7D/%7By%7D.png&amp;zmax=19&amp;zmin=0</datasource>
<shortname>OpenStreetMap</shortname>
<keywordList>
<value></value>
Expand Down Expand Up @@ -180,6 +204,7 @@
<links>
<link description="" format="" mimeType="" name="Source" size="" type="WWW:LINK" url="https://www.openstreetmap.org/"></link>
</links>
<dates></dates>
<fees></fees>
<rights>Fond de carte et données d’OpenStreetMap et de la Fondation OpenStreetMap (CC-BY-SA). © les contributeurs de https://www.openstreetmap.org.</rights>
<license>Open Data Commons Open Database License (ODbL)</license>
Expand Down Expand Up @@ -216,13 +241,13 @@
<Searchable>1</Searchable>
<Private>0</Private>
</flags>
<temporal enabled="0" fetchMode="0" mode="0">
<temporal bandNumber="1" enabled="0" fetchMode="0" mode="0">
<fixedRange>
<start></start>
<end></end>
</fixedRange>
</temporal>
<elevation band="1" enabled="0" symbology="Line" zoffset="0" zscale="1">
<elevation band="1" enabled="0" mode="RepresentsElevationSurface" symbology="Line" zoffset="0" zscale="1">
<data-defined-properties>
<Option type="Map">
<Option name="name" type="QString" value=""></Option>
Expand All @@ -239,7 +264,7 @@
<Option name="type" type="QString" value="collection"></Option>
</Option>
</data_defined_properties>
<layer class="SimpleLine" enabled="1" locked="0" pass="0">
<layer class="SimpleLine" enabled="1" id="{c5956455-a031-4bd0-80ea-50b39e67c68f}" locked="0" pass="0">
<Option type="Map">
<Option name="align_dash_pattern" type="QString" value="0"></Option>
<Option name="capstyle" type="QString" value="square"></Option>
Expand All @@ -251,7 +276,7 @@
<Option name="dash_pattern_offset_unit" type="QString" value="MM"></Option>
<Option name="draw_inside_polygon" type="QString" value="0"></Option>
<Option name="joinstyle" type="QString" value="bevel"></Option>
<Option name="line_color" type="QString" value="225,89,137,255"></Option>
<Option name="line_color" type="QString" value="225,89,137,255,rgb:0.88235294117647056,0.34901960784313724,0.53725490196078429,1"></Option>
<Option name="line_style" type="QString" value="solid"></Option>
<Option name="line_width" type="QString" value="0.6"></Option>
<Option name="line_width_unit" type="QString" value="MM"></Option>
Expand Down Expand Up @@ -288,15 +313,15 @@
<Option name="type" type="QString" value="collection"></Option>
</Option>
</data_defined_properties>
<layer class="SimpleFill" enabled="1" locked="0" pass="0">
<layer class="SimpleFill" enabled="1" id="{19a4ce8e-aef7-47c0-b532-364307157b7c}" locked="0" pass="0">
<Option type="Map">
<Option name="border_width_map_unit_scale" type="QString" value="3x:0,0,0,0,0,0"></Option>
<Option name="color" type="QString" value="225,89,137,255"></Option>
<Option name="color" type="QString" value="225,89,137,255,rgb:0.88235294117647056,0.34901960784313724,0.53725490196078429,1"></Option>
<Option name="joinstyle" type="QString" value="bevel"></Option>
<Option name="offset" type="QString" value="0,0"></Option>
<Option name="offset_map_unit_scale" type="QString" value="3x:0,0,0,0,0,0"></Option>
<Option name="offset_unit" type="QString" value="MM"></Option>
<Option name="outline_color" type="QString" value="35,35,35,255"></Option>
<Option name="outline_color" type="QString" value="35,35,35,255,rgb:0.13725490196078433,0.13725490196078433,0.13725490196078433,1"></Option>
<Option name="outline_style" type="QString" value="no"></Option>
<Option name="outline_width" type="QString" value="0.26"></Option>
<Option name="outline_width_unit" type="QString" value="MM"></Option>
Expand All @@ -318,6 +343,7 @@
<Option name="identify/format" type="QString" value="Value"></Option>
</Option>
</customproperties>
<mapTip enabled="1"></mapTip>
<pipe-data-defined-properties>
<Option type="Map">
<Option name="name" type="QString" value=""></Option>
Expand Down Expand Up @@ -351,6 +377,7 @@
<layerorder>
<layer id="OpenStreetMap_ab9cd479_708a_4147_a0b1_2508e7ba864c"></layer>
</layerorder>
<labelEngineSettings></labelEngineSettings>
<properties>
<Digitizing>
<AvoidIntersectionsMode type="int">0</AvoidIntersectionsMode>
Expand Down Expand Up @@ -380,6 +407,7 @@
<PAL>
<CandidatesLinePerCM type="double">5</CandidatesLinePerCM>
<CandidatesPolygonPerCM type="double">2.5</CandidatesPolygonPerCM>
<DrawLabelMetrics type="bool">false</DrawLabelMetrics>
<DrawRectOnly type="bool">false</DrawRectOnly>
<DrawUnplaced type="bool">false</DrawUnplaced>
<PlacementEngineVersion type="int">1</PlacementEngineVersion>
Expand All @@ -388,7 +416,7 @@
<ShowingCandidates type="bool">false</ShowingCandidates>
<ShowingPartialsLabels type="bool">true</ShowingPartialsLabels>
<TextFormat type="int">0</TextFormat>
<UnplacedColor type="QString">255,0,0,255</UnplacedColor>
<UnplacedColor type="QString">255,0,0,255,rgb:1,0,0,1</UnplacedColor>
</PAL>
<Paths>
<Absolute type="bool">false</Absolute>
Expand Down Expand Up @@ -501,16 +529,20 @@
<role></role>
</contact>
<links></links>
<dates>
<date type="Created" value="2024-01-05T16:45:15"></date>
</dates>
<author>nboisteault</author>
<creation>2024-01-05T16:45:15</creation>
</projectMetadata>
<Annotations></Annotations>
<Layouts></Layouts>
<mapViewDocks3D></mapViewDocks3D>
<Bookmarks></Bookmarks>
<Sensors></Sensors>
<ProjectViewSettings UseProjectScales="0" rotation="0">
<Scales></Scales>
<DefaultViewExtent xmax="35326508.54500140994787216" xmin="-35326508.54500140994787216" ymax="21039383.75992871075868607" ymin="-21039383.75992871075868607">
<DefaultViewExtent xmax="37144272.87513187527656555" xmin="-37144272.87513187527656555" ymax="21039383.75992871075868607" ymin="-21039383.75992871075868607">
<spatialrefsys nativeFormat="Wkt">
<wkt>PROJCRS["WGS 84 / Pseudo-Mercator",BASEGEOGCRS["WGS 84",ENSEMBLE["World Geodetic System 1984 ensemble",MEMBER["World Geodetic System 1984 (Transit)"],MEMBER["World Geodetic System 1984 (G730)"],MEMBER["World Geodetic System 1984 (G873)"],MEMBER["World Geodetic System 1984 (G1150)"],MEMBER["World Geodetic System 1984 (G1674)"],MEMBER["World Geodetic System 1984 (G1762)"],MEMBER["World Geodetic System 1984 (G2139)"],ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]],ENSEMBLEACCURACY[2.0]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],ID["EPSG",4326]],CONVERSION["Popular Visualisation Pseudo-Mercator",METHOD["Popular Visualisation Pseudo Mercator",ID["EPSG",1024]],PARAMETER["Latitude of natural origin",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8801]],PARAMETER["Longitude of natural origin",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8802]],PARAMETER["False easting",0,LENGTHUNIT["metre",1],ID["EPSG",8806]],PARAMETER["False northing",0,LENGTHUNIT["metre",1],ID["EPSG",8807]]],CS[Cartesian,2],AXIS["easting (X)",east,ORDER[1],LENGTHUNIT["metre",1]],AXIS["northing (Y)",north,ORDER[2],LENGTHUNIT["metre",1]],USAGE[SCOPE["Web mapping and visualisation."],AREA["World between 85.06°S and 85.06°N."],BBOX[-85.06,-180,85.06,180]],ID["EPSG",3857]]</wkt>
<proj4>+proj=merc +a=6378137 +b=6378137 +lat_ts=0 +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m +nadgrids=@null +wktext +no_defs</proj4>
Expand All @@ -524,11 +556,11 @@
</spatialrefsys>
</DefaultViewExtent>
</ProjectViewSettings>
<ProjectStyleSettings DefaultSymbolOpacity="1" RandomizeDefaultSymbolColor="1" projectStyleId="attachment:///fNtfOn_styles.db">
<ProjectStyleSettings DefaultSymbolOpacity="1" RandomizeDefaultSymbolColor="1" colorModel="Rgb" iccProfileId="attachment:///QGIS3-fanupy" projectStyleId="attachment:///cHdhQL_styles.db">
<databases></databases>
</ProjectStyleSettings>
<ProjectTimeSettings cumulativeTemporalRange="0" frameRate="1" timeStep="1" timeStepUnit="h"></ProjectTimeSettings>
<ElevationProperties>
<ProjectTimeSettings cumulativeTemporalRange="0" frameRate="1" timeStep="1" timeStepUnit="h" totalMovieFrames="100"></ProjectTimeSettings>
<ElevationProperties FilterInvertSlider="0">
<terrainProvider type="flat">
<TerrainProvider offset="0" scale="1"></TerrainProvider>
</terrainProvider>
Expand Down Expand Up @@ -575,4 +607,7 @@
</spatialrefsys>
</CoordinateCustomCrs>
</ProjectDisplaySettings>
<ProjectGpsSettings autoAddTrackVertices="0" autoCommitFeatures="0" destinationFollowsActiveLayer="1" destinationLayer="">
<timeStampFields></timeStampFields>
</ProjectGpsSettings>
</qgis>
24 changes: 17 additions & 7 deletions tests/qgis-projects/tests/geolocation.qgs.cfg
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
{
"metadata": {
"qgis_desktop_version": 32814,
"lizmap_plugin_version_str": "4.1.3-alpha",
"lizmap_plugin_version": 40103,
"lizmap_web_client_target_version": 30800,
"lizmap_web_client_target_status": "Stable",
"qgis_desktop_version": 34011,
"lizmap_plugin_version_str": "4.5.4",
"lizmap_plugin_version": 40504,
"lizmap_web_client_target_version": 31100,
"lizmap_web_client_target_status": "Dev",
"instance_target_url": "http://localhost:8130/",
"instance_target_repository": "testsrepository"
},
"warnings": {},
"debug": {
"total_time": 0.253
},
"options": {
"projection": {
"proj4": "+proj=merc +a=6378137 +b=6378137 +lat_ts=0 +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m +nadgrids=@null +wktext +no_defs",
Expand All @@ -21,6 +24,8 @@
"12514194.88550000078976154"
],
"mapScales": [
500,
1000,
10000,
25000,
50000,
Expand All @@ -31,7 +36,7 @@
10000000,
50000000
],
"minScale": 10000,
"minScale": 500,
"maxScale": 50000000,
"use_native_zoom_levels": false,
"hide_numeric_scale_value": true,
Expand All @@ -47,13 +52,15 @@
"pointTolerance": 25,
"lineTolerance": 10,
"polygonTolerance": 5,
"automatic_permalink": false,
"tmTimeFrameSize": 10,
"tmTimeFrameType": "seconds",
"tmAnimationFrameLength": 1000,
"datavizLocation": "dock",
"theme": "dark",
"fixed_scale_overview_map": true,
"dataviz_drag_drop": []
"dataviz_drag_drop": [],
"default_background_color_index": 1
},
"layers": {
"baselayers": {
Expand All @@ -70,6 +77,7 @@
"popupSource": "auto",
"popupTemplate": "",
"popupMaxFeatures": 10,
"children_lizmap_features_table": true,
"popupDisplayChildren": "False",
"popup_allow_download": true,
"legend_image_option": "hide_at_startup",
Expand Down Expand Up @@ -103,6 +111,7 @@
"popupSource": "auto",
"popupTemplate": "",
"popupMaxFeatures": 10,
"children_lizmap_features_table": true,
"popupDisplayChildren": "False",
"popup_allow_download": true,
"legend_image_option": "hide_at_startup",
Expand All @@ -129,6 +138,7 @@
"popupSource": "auto",
"popupTemplate": "",
"popupMaxFeatures": 10,
"children_lizmap_features_table": true,
"popupDisplayChildren": "False",
"popup_allow_download": true,
"legend_image_option": "hide_at_startup",
Expand Down
Loading