Pages: 1
- Sujet précédent - cartoweb: plugin search problème de recentrage sur les données - Sujet suivant
#1 Thu 02 September 2010 13:44
- mila_1881
- Juste Inscrit !
- Date d'inscription: 2 Sep 2010
- Messages: 2
cartoweb: plugin search problème de recentrage sur les données
bonjour tout le monde
Après avoir effectuer une longue recherche sur ce problème j'ai décidé de vous rejoindre pour m'aider car j'ai tout essayé...
je m'explique : j'ai bien suivi le tuto pour faire fonctioner le search plugin, il travaille à merveille except le recentrage sur un gouvernorat sélectionné : en cliquant sur une région j'obtiens une liste de gouvernorats correspondant et en choisissant un gouvernorat (c'est là où la fonction javascript recenter(id) est appelé ) je reçois une alerte qui dit "recenter id canceled, unable to find selected id" et rien ne change
je vous poste mon code fichier par fichier :
le mapfile:
Code:
MAP
NAME "myFirstProject"
EXTENT 3.476 30.0397 15.63879 37.764028
SIZE 1000 748
IMAGETYPE PNG
IMAGECOLOR 168 214 240
STATUS ON
UNITS dd
FONTSET "fonts.txt"
SYMBOLSET "symbols.txt"
SHAPEPATH "data"
CONFIG "MS_ERRORFILE" "/tmp/ms_error.txt"
SIZE 600 400
REFERENCE
IMAGE images/keymap_france.png
SIZE 250 160
EXTENT 3.476 30.0397 15.63879 37.764028
STATUS ON
COLOR -1 -1 -1
OUTLINECOLOR 200 0 0
END
SCALEBAR
STATUS ON
UNITS kilometers
COLOR 0 0 0
OUTLINECOLOR 40 40 40
BACKGROUNDCOLOR 0 0 0
IMAGECOLOR 255 255 255
INTERVALS 2
SIZE 150 5
STYLE 0
POSITION LL
LABEL
SIZE SMALL
OFFSET 0 0
BUFFER 0
MINDISTANCE -1
MINFEATURESIZE -1
COLOR 0 0 0
PARTIALS TRUE
FORCE FALSE
END
END
LEGEND
KEYSIZE 20 15
END
OUTPUTFORMAT
NAME png
DRIVER "GD/PNG"
MIMETYPE "image/png"
IMAGEMODE RGB
EXTENSION "png"
FORMATOPTION "INTERLACE=OFF"
TRANSPARENT OFF
END
OUTPUTFORMAT
NAME png
DRIVER "GD/JPEG"
MIMETYPE "image/jpeg"
IMAGEMODE RGB
EXTENSION "jpg"
FORMATOPTION "INTERLACE=OFF"
FORMATOPTION "QUALITY=80"
END
# LAYERS #
##########
LAYER
NAME "region"
CONNECTIONTYPE oraclespatial
#CONNECTION "sysman/sallouha@TSH1"
#DATA "GEOM FROM (select * from tunisia where nom like '%unis%' ) USING UNIQUE ID SRID 4326 VERSION 10g"
CONNECTION "sysenv8/sysenv8@TSH1"
DATA "GPOLY FROM (select * from ref_region ) USING UNIQUE ID_region SRID 4326 VERSION 10g"
TYPE POLYGON
DUMP TRUE
LABELITEM LIB_region
CLASS
NAME "region"
STYLE
SYMBOL 0
SIZE 12
COLOR 102 249 129
OUTLINECOLOR 55 111 65
END
END
END
LAYER
NAME "gouvernorat"
CONNECTIONTYPE oraclespatial
CONNECTION "sysenv8/sysenv8@TSH1"
DATA "GPOLY FROM (select * from ref_gouvernorat ) USING UNIQUE ID_GOU SRID 4326 VERSION 10g"
TYPE POLYGON
DUMP TRUE
#LABELITEM LIB_gouvernorat
METADATA
"recenter_name_string" 'ID_GOU'
"id_attribute_string" 'ID_GOU|string'
END
CLASS
NAME "gouvernorat"
STYLE
SYMBOL 0
SIZE 12
COLOR 102 124 201
OUTLINECOLOR 55 165 45
END
LABEL
FONT Vera
TYPE truetype
COLOR 51 51 51
SIZE 10
END
END
ENDle Search.ajax.js :
Code:
AjaxPlugins.Search = {
handleResponse: function(pluginOutput) {
if (pluginOutput.htmlCode.region)
$('search_region_div').innerHTML = pluginOutput.htmlCode.region;
if (pluginOutput.htmlCode.gouvernorat)
$('search_gouvernorat_div').innerHTML = pluginOutput.htmlCode.gouvernorat;
}
};
/*
* Search plugin's Actions
*/
AjaxPlugins.Search.Actions = {};
AjaxPlugins.Search.Actions.DoIt = {
buildPostRequest: function(argObject) {
return AjaxHandler.buildPostRequest();
}
};
function initializeRegion() {
$('search_region_div').innerHTML = '';
var myinput = $('search_config');
myinput.value = 'region';
CartoWeb.trigger('Search.DoIt');
}
function initializeGouvernorat() {
$('search_gouvernorat_div').innerHTML = '';
var myinput = $('search_config');
myinput.value = 'gouvernorat';
CartoWeb.trigger('Search.DoIt');
}
function recenter(id)
{
if($('search_config').value == 'gouvernorat'){
$('id_recenter_ids').value = id;
$('id_recenter_layer').value = 'gouvernorat';
$('recenter_doit').value = '0';
CartoWeb.trigger('Location.Recenter');
}
}
Event.observe(window, 'load', initializeRegion, true);le search.ini (côté client) :
Code:
dbType = oci8 dsn = oci8://sysenv8:sysenv8@192.192.2.33/TSH1 encodingContext = searchDb config.region.provider.type = table config.region.provider.table = REF_REGION config.region.provider.id = ID_REGION config.region.provider.columns = LIB_REGION config.region.formatter.type = smarty config.region.formatter.template = region_select config.gouvernorat.provider.type = table config.gouvernorat.provider.table = REF_GOUVERNORAT config.gouvernorat.provider.id = ID_GOU config.gouvernorat.provider.columns = LIB_GOUVERNORAT config.gouvernorat.provider.where = "ID_REGION = '@region@'" config.gouvernorat.formatter.type = smarty config.gouvernorat.formatter.template = gouvernorat_select
le location.ini côté client :
Code:
; if true, shows recenter on id form idRecenterActive = true ; the list of layers which will be shown on the recenter selection list ; if this list is not set, all layers are proposed in the list idRecenterLayers = gouvernorat ;name search configuration dsn = oci8://sysenv:sysenv@192.192.2.33/TSH1
le location.ini coté serveur:
Code:
; seuils de zoom : minScale = 50000 maxScale = 4750000 recenterDefaultScale = 750000
(j'utilise cartoweb 3.5 et mapserver 4.10.5 ) et la structure de ma table au niveau bd ref_gouvernorat(cod_soc, id_gou, id_region, lib_gouvernorat)
à votre avis ça du à quoi ce problème?? y a-t-il une solution???
Dernière modification par mila_1881 (Thu 02 September 2010 13:50)
Hors ligne
#2 Thu 16 September 2010 16:43
- mila_1881
- Juste Inscrit !
- Date d'inscription: 2 Sep 2010
- Messages: 2
Re: cartoweb: plugin search problème de recentrage sur les données
salut!!
Bien que ce framework ne soit plus utilisé par la communauté du SIG je tiens encore à poster la solution à mon problème qui a duré bien longtemps d'une part à cause de la mauvaise documentation et d'autre part je suis sûre que ceux qui ont trouvé la solution n'ont pas pris la peine d'expliquer la cause du bug.. pendant ces deux années de travail j'ai appris (entre autres) le savoir est quelque chose qui se multiplie quand il se divise..
donc voila ce qui me manque dans la définition du layer au niveau mapfile:
"Warning : A layer must be queryable before id recentering works! Add TEMPLATE "ttt" to that layer in the mapfile."
CoUCOu 7amouni ; )
Dernière modification par mila_1881 (Thu 16 September 2010 16:45)
Hors ligne
Pages: 1
- Sujet précédent - cartoweb: plugin search problème de recentrage sur les données - Sujet suivant


