Skip to content

Commit

Permalink
[BUILD] SearchCoordinates
Browse files Browse the repository at this point in the history
  • Loading branch information
Viglino committed Jun 21, 2024
1 parent 36231ea commit 6117afe
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 23 deletions.
6 changes: 3 additions & 3 deletions dist/ol-ext.js
Original file line number Diff line number Diff line change
Expand Up @@ -15573,15 +15573,15 @@ ol.control.SearchBAN = class olcontrolSearchBAN extends ol.control.SearchPhoton
* @extends {ol.control.Search}
* @fires select
* @param {Object=} Control options.
* @param {ol/proj/ProjectionLike} options.projection
* @param {ol/proj/ProjectionLike} [options.projection="EPSG:3857"] control projection
* @param {string} [options.className] control class name
* @param {Element | string } [options.target] Specify a target if you want the control to be rendered outside of the map's viewport.
* @param {string} [options.label="search"] Text label to use for the search button, default "search"
* @param {string} [options.labelGPS="Locate with GPS"] placeholder, default "Locate with GPS"
* @param {number} [options.typing=300] a delay on each typing to start searching (ms), default 300.
* @param {integer} [options.minLength=1] minimum length to start searching, default 1
* @param {integer} [options.maxItems=10] maximum number of items to display in the autocomplete list, default 10
* @param {integer} [options.digit=2] number of digit in coords
* @param {integer} [options.digit=3] number of digit in coords
*/
ol.control.SearchCoordinates = class olcontrolSearchCoordinates extends ol.control.Search {
constructor(options) {
Expand All @@ -15591,7 +15591,7 @@ ol.control.SearchCoordinates = class olcontrolSearchCoordinates extends ol.contr
super(options);
// Projection
this.projection_ = options.projection || 'EPSG:3857'
this.set('digit', typeof(options.digit) === 'number' ? options.digit : 2)
this.set('digit', typeof(options.digit) === 'number' ? options.digit : 3)
// Geolocation
this.geolocation = new ol.Geolocation({
projection: "EPSG:4326",
Expand Down
2 changes: 1 addition & 1 deletion dist/ol-ext.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions examples/interaction/map.interaction.splitter.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ <h2>Options:</h2>
var map = new ol.Map({
target: 'map',
view: new ol.View({
/** /
/**/
zoom: 5,
center: [261720, 5951081],
/*/
Expand Down Expand Up @@ -103,7 +103,7 @@ <h2>Options:</h2>
vector.getSource().addFeature(new ol.Feature(new ol.geom.Point([261720, 5951081])));

// Add splitter before other interaction
var splitter = new ol.interaction.Splitter({ source: vector.getSource(), tolerance: 1e-8 });
var splitter = new ol.interaction.Splitter({ source: vector.getSource(), tolerance: 1e-3 });
map.addInteraction(splitter);

// Add interactions to modify features
Expand Down
35 changes: 21 additions & 14 deletions examples/search/map.control.searchcoord.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,25 @@ <h1>ol-ext: Search by coordinates control</h1>

<div class="options">
<i>Use the search control to start a new search.</i>
Projection:
<select id="grat" onchange="setGraticule(true)">
<option value="4326">WGS 84 (EPSG:4326)</option>
<option value="2154">Lambert-93 (France) EPSG:2154</option>
<option value="27700">British National Grid (EPSG:27700)</option>
<option value="54009">Mollweide (ESRI:54009)</option>
<option value="23032">ED50 / UTM zone 32N (EPSG:23032)</option>
<option value="2163">US National Atlas Equal Area (EPSG:2163)</option>
<option value="3413">NSIDC Polar Stereographic North (EPSG:3413)</option>
<option value="5479">RSRGD2000 / MSLC2000 (EPSG:5479)</option>
<!--
<option value="32662">Plate Carree</option>
-->
</select>
<ul>
<li>
Projection:
<select onchange="search.setProjection(this.value)">
<option value="EPSG:4326">WGS 84 (EPSG:4326)</option>
<option value="EPSG:3857" selected="selected">Pseudo-Mercator EPSG:3857</option>
<option value="EPSG:2154">Lambert-93 (France) EPSG:2154</option>
<option value="EPSG:27700">British National Grid (EPSG:27700)</option>
<option value="ESRI:54009">Mollweide (ESRI:54009)</option>
<option value="EPSG:23032">ED50 / UTM zone 32N (EPSG:23032)</option>
<option value="EPSG:2163">US National Atlas Equal Area (EPSG:2163)</option>
<option value="EPSG:3413">NSIDC Polar Stereographic North (EPSG:3413)</option>
<option value="EPSG:5479">RSRGD2000 / MSLC2000 (EPSG:5479)</option>
<!--
<option value="32662">Plate Carree</option>
-->
</select>
</li>
</ul>

</div>

Expand All @@ -83,6 +88,8 @@ <h1>ol-ext: Search by coordinates control</h1>
proj4.defs('EPSG:3413', '+proj=stere +lat_0=90 +lat_ts=70 +lon_0=-45 +k=1 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs');
proj4.defs('EPSG:2163', '+proj=laea +lat_0=45 +lon_0=-100 +x_0=0 +y_0=0 +a=6370997 +b=6370997 +units=m +no_defs');
proj4.defs('ESRI:54009', '+proj=moll +lon_0=0 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs');

ol.proj.proj4.register(proj4);

// Layers
var layers = [ new ol.layer.Tile({ source: new ol.source.OSM() }) ];
Expand Down
Binary file added img/map.control.searchcoord.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1153,6 +1153,14 @@ <h2>Search</h2>
<p class="tag">search, control, GPS, longitude, latitude</p>
</div>

<div class="example" data-date="2024-06-21">
<a class="mainlink" href="examples/search/map.control.searchcoord.html">
<strong>Search coordinates</strong><br>
</a>
<p class="description">A search control to search place by coordinates.</p>
<p class="tag">search, control, coordinate, projection</p>
</div>

<div class="example">
<a class="mainlink" href="examples/search/map.control.searchfeature.html">
<strong>Search feature</strong><br>
Expand Down
6 changes: 3 additions & 3 deletions src/control/SearchCoordinates.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ import ol_ext_element from '../util/element.js'
* @extends {ol_control_Search}
* @fires select
* @param {Object=} Control options.
* @param {ol/proj/ProjectionLike} options.projection
* @param {ol/proj/ProjectionLike} [options.projection="EPSG:3857"] control projection
* @param {string} [options.className] control class name
* @param {Element | string } [options.target] Specify a target if you want the control to be rendered outside of the map's viewport.
* @param {string} [options.label="search"] Text label to use for the search button, default "search"
* @param {string} [options.labelGPS="Locate with GPS"] placeholder, default "Locate with GPS"
* @param {number} [options.typing=300] a delay on each typing to start searching (ms), default 300.
* @param {integer} [options.minLength=1] minimum length to start searching, default 1
* @param {integer} [options.maxItems=10] maximum number of items to display in the autocomplete list, default 10
* @param {integer} [options.digit=2] number of digit in coords
* @param {integer} [options.digit=3] number of digit in coords
*/
var ol_control_SearchCoordinates = class olcontrolSearchCoordinates extends ol_control_Search {
constructor(options) {
Expand All @@ -37,7 +37,7 @@ var ol_control_SearchCoordinates = class olcontrolSearchCoordinates extends ol_c

// Projection
this.projection_ = options.projection || 'EPSG:3857'
this.set('digit', typeof(options.digit) === 'number' ? options.digit : 2)
this.set('digit', typeof(options.digit) === 'number' ? options.digit : 3)
// Geolocation
this.geolocation = new ol_Geolocation({
projection: "EPSG:4326",
Expand Down

0 comments on commit 6117afe

Please sign in to comment.