Two questions in one (Autocomplete and background)

Added by Lasserre Mathieu about 2 years ago

Hello
First question:
I would set up an auto completion system that would allow , for example, center the view of a map on a point ( a layer ) which could have informed the name in a text box .
Is it possible with a getfeature?

Second question:
My background OSM fails, the tiles are pink.
I have version 4.3 and visible link in the mysql database is:http://openstreetmap.org/
My background Google fails too, by browsing the map , funds are shifted relative to the data.

thanks for your help.

Mathieu


Replies (7)

RE: Two questions in one (Autocomplete and background) - Added by Blatti Yves about 2 years ago

Hi Mathieu !

First question:

I'm not a big user of MAP component, but there's a WFS location tool in MAP, and I think it does have the autocomplete feature.
  • In a MAP go to "tools" tab , you should find a sub-tab name "location" or "localisation"
  • It needs a WFS service, + some config
  • Once activated and configured, it will display a new field on top of the MAP to search :

Second question:

The problem my simply be the coordinate system, I think Google and OSM only support EPSG:3857.
Can you check you map ? sample:

The layer should be simple as this:

You can add the "Mouse position tool" (also available in the map tools), to ensure that the coordinates of your data and/or the background layers are good.

HIH, Regards

Yves

WFS_search.png (129 KB)

WFS_search_admin.png (7.99 KB)

map.png (13 KB)

layer.png (24.8 KB)

RE: Two questions in one (Autocomplete and background) - Added by Lasserre Mathieu about 2 years ago

Hi Yves,
thank you for your held!

first topic
my map is in 3857. My statement in the WMS map is ok too.
Everything seems te be ok , I do not understand ..

Second topic:
it works ok thank you !
You know if it is possible to make multiple autocomplete on a map? And is it possible to do a search on multiple fields (without having to create a concatenated ) ?
Another problem is that the zoom is at maximum when the location is done. Can it be set?

thanks :)

Mathieu

RE: Two questions in one (Autocomplete and background) - Added by Lasserre Mathieu about 2 years ago

In fact if i change the projection, my data are shifted but coordinated on the bottom right rest on 3857 (and the BING bacbkground is well projected).

RE: Two questions in one (Autocomplete and background) - Added by Blatti Yves about 2 years ago

Hi,

For the WFS locator:

You know if it is possible to make multiple autocomplete on a map?

Do you mean multiple search fields ? If so, I don't think this is supported. (One instance of each tool per map, which seems to also be the most user friendly)

And is it possible to do a search on multiple fields (without having to create a concatenated ) ?

As the component comes from GXP unchanged, it does currently not support this.
See : http://gxp.opengeo.org/styler/src/script/widgets/form/AutoCompleteComboBox.js
But having an aggregated dataset (and concatenate the fields we want to search on) makes sense, since most people want to search on multiple feature types (State, City, Parcel, Addresses...)

Another problem is that the zoom is at maximum when the location is done. Can it be set?

Looking at the code:

listeners: {
    select: function(list, record) {
        var extent = new OpenLayers.Bounds();
        extent.extend(record.data.feature.geometry.getBounds());
        window.appname.mapPanel.map.zoomToExtent(extent);
    }
},

It will zoom to the extent of the features. So it's good for polygons. But if the feature is a point, it will zoom, to map maxZoom I guess.
This could be an easySDI enhancement. (Need a new parameter in config of WFS locator: "Max zoom on search", then propagate it to the whole JS app. Currently not planned).

For the MAP and SRS :

In fact if i change the projection, my data are shifted but coordinated on the bottom right rest on 3857 (and the BING bacbkground is well projected).

I think this is some kind of conflict: easySDI's MAP doesn't have re-projection enabled. So having different projections on the map will be an issue (And OSM+Google are EPSG:3857 only)

Is your map visible online ? (You can direct-mail me if the URL can't be public).

Have a look at working map's codes to compare with your:
https://www.geoplateforme17.fr/nos-services/portail-carto
https://www.tigeo.fr/visualiser-des-geodonnees
(Minor changes may appear since they're on easySDI < 4.3.0)

Regards

RE: Two questions in one (Autocomplete and background) - Added by Lasserre Mathieu about 2 years ago

Hi Yves,
thank you again!

WFS LOCATOR

You know if it is possible to make multiple autocomplete on a map?

Do you mean multiple search fields ? If so, I don't think this is supported. (One instance of each tool per map, which seems to also be the most user friendly)

I mean multiple search data. I wish to propose two searsh on two different table. But ok, i have to create two map.

It will zoom to the extent of the features. So it's good for polygons. But if the feature is a point, it will zoom, to map maxZoom I guess.
This could be an easySDI enhancement. (Need a new parameter in config of WFS locator: "Max zoom on search", then propagate it to the whole JS app. Currently not planned).

Yes it could be an good enhancement, because when zoom is at the maximum on a point, it 's difficult to localise it and some background could not be displayed.
Is it possible to change the listeners directly?

MAP AND SRS

I think this is some kind of conflict: easySDI's MAP doesn't have re-projection enabled. So having different projections on the map will be an issue (And OSM+Google are EPSG:3857 only)

I dont understand. Does it meen when i use a physical service (WMS) wich use EPSG 2154, i will necessarily have a projection problem? If yes, how can i connect my IDS (like geo17, or tigeo) on french geoservice which are not in 3857?
In addition , some of my internal data is 3857 , and there is a projection problem with google background too.

Is your map visible online ?

No, its for an intranet. but can i send you source code or print of my back end?

RE: Two questions in one (Autocomplete and background) - Added by Blatti Yves about 2 years ago

Hi !

WFS LOCATOR
What people usually do is merge datasets in one table, or using a database view. This gives more flexibility for your search.
This also gives the ability to search on a lot of featuretypes in the same box, and you can prefix the name shown to user in the results.

If you search for "125", results can be:

Postal code: 1254 La Ville
Postal code: 1256 Le Bled
Parcel : 12598-B
Parcel : 12599-A
Address : Rue de la gare 125, la Ville
Address : Rue de la poste 125b, le Bled

MAP AND SRS
The problem comes from the background tiles you use (and the projection they are restricted to).
The WMS and WFS services normally support a lot of projections, and will be requested with the map projection (that has to match the background projection).
You can post here you html output.

RE: Two questions in one (Autocomplete and background) - Added by Lasserre Mathieu about 2 years ago

Hi Yves,
ok thanks.
Here the source code

CodeSource.html Magnifier (16.2 KB)

(1-7/7)