Skip to content

Commit

Permalink
fix(ol:Controls): affichage plus fin des résultats de geocodage
Browse files Browse the repository at this point in the history
  • Loading branch information
elias75015 committed Mar 15, 2024
1 parent 636a26a commit 3174df0
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
15 changes: 14 additions & 1 deletion src/Common/Utils/GeocodeUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,20 @@ var GeocodeUtils = {
if (attributes.label) {
return attributes.label;
} else if (geocodedLocation.type === "PositionOfInterest") {
return attributes.postcode + " " + attributes.toponym;
var resultToReturn = attributes.toponym;
if (attributes.category && Array.isArray(attributes.category) && attributes.category.length >= 2 && attributes.category[0] === "administratif") {
// gestion particulière des territoires administratifs
resultToReturn = resultToReturn + ", " + attributes.category[1];
} else {
// gestion standard des POI non adminsitratifs
if (attributes.postcode) {
resultToReturn = resultToReturn + ", " + attributes.postcode[0];
if (attributes.city) {
resultToReturn = resultToReturn + " " + attributes.city[0];
}
}
}
return resultToReturn;
} else if (geocodedLocation.type === "StreetAddress") {
return (attributes.housenumber ? attributes.housenumber + " " : "") + attributes.street + " " + (attributes.postcode ? attributes.postcode + ", " : "") + attributes.city;
} else if (geocodedLocation.type === "CadastralParcel") {
Expand Down
10 changes: 4 additions & 6 deletions src/OpenLayers/Controls/LayerImport.js
Original file line number Diff line number Diff line change
Expand Up @@ -1227,9 +1227,8 @@ var LayerImport = (function (Control) {
vectorSource = new VectorTileSource({
attributions : _glSource.attribution,
format : vectorFormat,
// INFO
// on supprime la grille pour forcer l'utilisation par defaut des tuiles en 512
// sur du vecteur tuilé
// INFO
// surcharge : grille en 256 sur du vecteur tuilé
tileGrid : olCreateXYZTileGrid({ // TODO scheme tms ?
extent : _glSource.bounds, // [minx, miny, maxx, maxy]
maxZoom : _glSource.maxzoom || 22,
Expand Down Expand Up @@ -1295,9 +1294,8 @@ var LayerImport = (function (Control) {
vectorSource = new VectorTileSource({
attributions : vectorTileJson.getAttributions() || _tileJSONDoc.attribution,
format : vectorFormat,
// INFO
// on supprime la grille pour forcer l'utilisation par defaut des tuiles en 512
// sur du vecteur tuilé
// INFO
// surcharge : grille en 256 sur du vecteur tuilé
tileGrid : olCreateXYZTileGrid({ // TODO scheme tms ?
extent : _glSource.bounds, // [minx, miny, maxx, maxy]
maxZoom : _glSource.maxzoom || 22,
Expand Down
2 changes: 1 addition & 1 deletion src/OpenLayers/Controls/SearchEngine.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ var SearchEngine = (function (Control) {
// merge with user options
Utils.mergeParams(this.options, options);
if (this.options.resources.geocode === "") {
this.options.resources.geocode = "poi";
this.options.resources.geocode = "address,poi";
}
if (this.options.resources.autocomplete.length === 0) {
this.options.resources.autocomplete = ["PositionOfInterest", "StreetAddress"];
Expand Down

0 comments on commit 3174df0

Please sign in to comment.