[OpenLayers-Users] ISO-8859-1

Bart van den Eijnden (OSGIS) bartvde at osgis.nl
Thu Nov 29 04:54:32 EST 2007


You can use an iframe and set it's source (src) to the GetFeatureInfo URL.

Best regards,
Bart

--
Bart van den Eijnden
OSGIS, Open Source GIS
http://www.osgis.nl


--------- Oorspronkelijk bericht --------
Van: R. Ortner <reinhard.ortner at edu.fh-kaernten.ac.at>
Naar: users at openlayers.org <users at openlayers.org>
Onderwerp: Re: [OpenLayers-Users] ISO-8859-1
Datum: 29/11/07 07:52

> 
> that will work basically. Now i can open the info in a new window and it
will
> diplayed correctly.
> 
> but i need to find out a way to disply it within the application. maybe
not
> with innerHTML but with something different. Can i use something else
except
> innerHTML to place it e.g. in the top right corner?
> 
> ----
> 
> Bart van den Eijnden (OSGIS)-2 wrote:
> &gt; 
> &gt; ResponseXML will only work if the content-type (set in the http
headers)
> &gt; is
> &gt; text/xml. Then ofcourse you won't be able to set it to the innerHTML
since
> &gt; it is not a string.
> &gt; 
> &gt; I tend to believe you can only get this done using (UTF-8 and HTML)
or
> &gt; (ISO8859 and XML) if you use AJAX.
> &gt; 
> &gt; What happens if you just popup a new window with the url:
> &gt; 
> &gt; So instead of:
> &gt; 
> &gt; OpenLayers.loadURL(request, '', this, setHTML);
> &gt; 
> &gt; try:
> &gt; 
> &gt; window.open(request);
> &gt; 
> &gt; Best regards,
> &gt; Bart
> &gt; 
> &gt; --
> &gt; Bart van den Eijnden
> &gt; OSGIS, Open Source GIS
> &gt; http://www.osgis.nl
> &gt; 
> &gt; 
> &gt; --------- Oorspronkelijk bericht --------
> &gt; Van: R. Ortner &lt;reinhard.ortner at edu.fh-kaernten.ac.at&gt;
> &gt; Naar: users at openlayers.org &lt;users at openlayers.org&gt;
> &gt; Onderwerp: Re: [OpenLayers-Users] ISO-8859-1
> &gt; Datum: 29/11/07 06:37
> &gt; 
> &gt;&gt; 
> &gt;&gt; Heres my code for the getfeatureinfo part:
> &gt;&gt; 
> &gt;&gt; function checkinfo(imgid,url,title){
> &gt;&gt; 
> &gt;&gt; if (infobox == 0) {infobox = 1;}
> &gt;&gt; if (imgid == oldimgid) {infobox = 0;}
> &gt;&gt; id = imgid.substring(3,imgid.length);
> &gt;&gt; 	 if(infobox == 1 &amp;amp;&amp;amp;
document.getElementById(id).checked==true) {
> &gt;&gt; 	 					document.getElementById('map').style.cursor = 'crosshair';
> &gt;&gt; 						document.getElementById(imgid).src =
> &gt; &amp;quot;img/treemenu/identify_2.gif&amp;quot;;
> &gt;&gt;         		if (oldimgid != null)
document.getElementById(oldimgid).src =
> &gt;&gt; &amp;quot;img/treemenu/identify_1.gif&amp;quot;; 
> &gt;&gt;         		oldimgid = imgid;
> &gt;&gt;         		document.getElementById('nodeList').style.visibility =
> &gt; 'visible';
> &gt;&gt; 
> &gt;&gt;     map.events.register('click', map, function (e) {
> &gt;&gt; 				if(infobox == 1 &amp;amp;&amp;amp;
document.getElementById(id).checked==true)
> &gt; {
> &gt;&gt; 	 					document.getElementById('map').style.cursor = 'crosshair';
> &gt;&gt;             OpenLayers.Util.getElement('nodeList').innerHTML =
> &gt; &amp;quot;Loading...
> &gt;&gt; please wait...&amp;quot;;
> &gt;&gt;             var request =  window[id].getFullRequestString({
> &gt;&gt;                             REQUEST:
&amp;quot;GetFeatureInfo&amp;quot;,
> &gt;&gt;                             EXCEPTIONS:
> &gt; &amp;quot;application/vnd.ogc.se_xml&amp;quot;,
> &gt;&gt;                             BBOX:
window[id].map.getExtent().toBBOX(),
> &gt;&gt;                             X: e.xy.x,
> &gt;&gt;                             Y: e.xy.y,
> &gt;&gt;                             INFO_FORMAT: 'text/html',
> &gt;&gt;                             QUERY_LAYERS:
window[id].params.LAYERS,
> &gt;&gt;                             WIDTH: window[id].map.size.w,
> &gt;&gt;                             HEIGHT: window[id].map.size.h});
> &gt;&gt;             OpenLayers.loadURL(request, '', this, setHTML);
> &gt;&gt;             OpenLayers.Event.stop(e); 
> &gt;&gt; 				}
> &gt;&gt;       });
> &gt;&gt; 		}
> &gt;&gt; else {		
> &gt;&gt; 	 					document.getElementById('map').style.cursor = 'auto';
> &gt;&gt; 			 			document.getElementById('nodeList').style.visibility =
'hidden';
> &gt;&gt; 			 			if (imgid == oldimgid) { oldimgid = null; } else {
oldimgid =
> &gt; imgid;
> &gt;&gt; }
> &gt;&gt; 						document.getElementById('nodeList').innerHTML =
&amp;quot;&amp;quot;;
> &gt;&gt; 			 			infobox = 0; 
> &gt;&gt; 						document.getElementById(imgid).src =
> &gt; &amp;quot;img/treemenu/identify_1.gif&amp;quot;;
> &gt;&gt; 						}
> &gt;&gt; }		
> &gt;&gt; 
> &gt;&gt; function setHTML(response) { 
> &gt;&gt;    OpenLayers.Util.getElement('nodeList').innerHTML =
> &gt; response.responseText;
> &gt;&gt; }
> &gt;&gt; 
> &gt;&gt; 
> &gt;&gt; I tried to change the response.responseText to responseXML as u
told, but
> &gt;&gt; than the Info is not displayed any more. (after mouseclick i see
short
> &gt;&gt; the
> &gt;&gt; Loading... please wait... and than nothing!)
> &gt;&gt; do i have then to change something about my template to, maybe
with the
> &gt;&gt; responseXML the template is not correct anymore?
> &gt;&gt;  
> &gt;&gt; 
> &gt;&gt; ----
> &gt;&gt; 
> &gt;&gt; 
> &gt;&gt; 
> &gt;&gt; Bart van den Eijnden (OSGIS)-2 wrote:
> &gt;&gt; &amp;gt; 
> &gt;&gt; &amp;gt; Can you explain code-wise how you perform the
GetFeatureInfo
> &gt;&gt; request?
> &gt;&gt; &amp;gt; 
> &gt;&gt; &amp;gt; If the code uses responseText instead of responseXML, it
can only
> &gt; work in
> &gt;&gt; &amp;gt; UTF-8.
> &gt;&gt; &amp;gt; 
> &gt;&gt; &amp;gt; See also some threads in september titled loading XML
problem, e.g.:
> &gt;&gt; &amp;gt; 
> &gt;&gt; &amp;gt;
http://openlayers.org/pipermail/users/2007-September/003001.html
> &gt;&gt; &amp;gt; 
> &gt;&gt; &amp;gt; Best regards,
> &gt;&gt; &amp;gt; Bart
> &gt;&gt; &amp;gt; 
> &gt;&gt; &amp;gt; --
> &gt;&gt; &amp;gt; Bart van den Eijnden
> &gt;&gt; &amp;gt; OSGIS, Open Source GIS
> &gt;&gt; &amp;gt; http://www.osgis.nl
> &gt;&gt; &amp;gt; 
> &gt;&gt; &amp;gt; 
> &gt;&gt; &amp;gt; --------- Oorspronkelijk bericht --------
> &gt;&gt; &amp;gt; Van: R. Ortner
&amp;lt;reinhard.ortner at edu.fh-kaernten.ac.at&amp;gt;
> &gt;&gt; &amp;gt; Naar: users at openlayers.org
&amp;lt;users at openlayers.org&amp;gt;
> &gt;&gt; &amp;gt; Onderwerp: Re: [OpenLayers-Users] ISO-8859-1
> &gt;&gt; &amp;gt; Datum: 29/11/07 06:00
> &gt;&gt; &amp;gt; 
> &gt;&gt; &amp;gt;&amp;gt; 
> &gt;&gt; &amp;gt;&amp;gt; Hi again,
> &gt;&gt; &amp;gt;&amp;gt; 
> &gt;&gt; &amp;gt;&amp;gt; i tried to set the charset by adding
&amp;amp;lt;meta
> &gt;&gt; &amp;gt; http-equiv=&amp;amp;quot;content-type&amp;amp;quot;
> &gt;&gt; &amp;gt;&amp;gt; content=&amp;amp;quot;text/html;
charset=ISO-8859-1&amp;amp;quot;
> &gt; /&amp;amp;gt; to the head of
> &gt;&gt; &amp;gt;&amp;gt; the
> &gt;&gt; &amp;gt; template file
> &gt;&gt; &amp;gt;&amp;gt; and by adding it to my OL index.php. I also set
the apache
> &gt; defaultCharset
> &gt;&gt; &amp;gt; to
> &gt;&gt; &amp;gt;&amp;gt; ISO-8859-1 but i still have some special
characters displayed
> &gt; wrong.
> &gt;&gt; &amp;gt;&amp;gt; 
> &gt;&gt; &amp;gt;&amp;gt; So i gess that must be something in the
OpenLayers Code where
> &gt;&gt; the
> &gt; Charset
> &gt;&gt; &amp;gt; is
> &gt;&gt; &amp;gt;&amp;gt; set &amp;amp;quot;wrong&amp;amp;quot;!
> &gt;&gt; &amp;gt;&amp;gt; 
> &gt;&gt; &amp;gt;&amp;gt; If i try to open the template file (template
file for a
> &gt; getFeatrueInfo
> &gt;&gt; &amp;gt;&amp;gt; request the characters displayed correctly! only
wrong when OL
> &gt;&gt; is
> &gt;&gt; &amp;gt; involved)
> &gt;&gt; &amp;gt;&amp;gt; 
> &gt;&gt; &amp;gt;&amp;gt; hope some developer can tell me how to change
the default
> &gt;&gt; charset
> &gt; of OL
> &gt;&gt; &amp;gt;&amp;gt; 
> &gt;&gt; &amp;gt;&amp;gt; thx
> &gt;&gt; &amp;gt;&amp;gt; 
> &gt;&gt; &amp;gt;&amp;gt; ----
> &gt;&gt; &amp;gt;&amp;gt; 
> &gt;&gt; &amp;gt;&amp;gt; 
> &gt;&gt; &amp;gt;&amp;gt; R. Ortner wrote:
> &gt;&gt; &amp;gt;&amp;gt; &amp;amp;gt; 
> &gt;&gt; &amp;gt;&amp;gt; &amp;amp;gt; Hi,
> &gt;&gt; &amp;gt;&amp;gt; &amp;amp;gt; 
> &gt;&gt; &amp;gt;&amp;gt; &amp;amp;gt; where to tell OL to show the
getFeatureInfo request in
> &gt; ISO-8859-1?
> &gt;&gt; &amp;gt;&amp;gt; (i
> &gt;&gt; &amp;gt; need
> &gt;&gt; &amp;gt;&amp;gt; &amp;amp;gt; special character support)
> &gt;&gt; &amp;gt;&amp;gt; &amp;amp;gt; 
> &gt;&gt; &amp;gt;&amp;gt; &amp;amp;gt; so far i get as a result of my
request for every
> &gt;&gt; special
> &gt; character
> &gt;&gt; &amp;gt; like ä
> &gt;&gt; &amp;gt;&amp;gt; &amp;amp;gt; or ö -&amp;amp;gt; � (FF) /? (in
IE).
> &gt;&gt; &amp;gt;&amp;gt; &amp;amp;gt; 
> &gt;&gt; &amp;gt;&amp;gt; &amp;amp;gt; regards
> &gt;&gt; &amp;gt;&amp;gt; &amp;amp;gt; R. Ortner
> &gt;&gt; &amp;gt;&amp;gt; &amp;amp;gt; 
> &gt;&gt; &amp;gt;&amp;gt; 
> &gt;&gt; &amp;gt;&amp;gt; -- 
> &gt;&gt; &amp;gt;&amp;gt; View this message in context:
> &gt;&gt; &amp;gt;
http://www.nabble.com/ISO-8859-1-tf4887822.html#a14021006
> &gt;&gt; &amp;gt;&amp;gt; Sent from the OpenLayers Users mailing list
archive at
> &gt; Nabble.com.
> &gt;&gt; &amp;gt;&amp;gt; 
> &gt;&gt; &amp;gt;&amp;gt; _______________________________________________
> &gt;&gt; &amp;gt;&amp;gt; Users mailing list
> &gt;&gt; &amp;gt;&amp;gt; Users at openlayers.org
> &gt;&gt; &amp;gt;&amp;gt; http://openlayers.org/mailman/listinfo/users
> &gt;&gt; &amp;gt;&amp;gt; 
> &gt;&gt; &amp;gt; 
> &gt;&gt; &amp;gt; 
> &gt;&gt; &amp;gt; 
> &gt;&gt; &amp;gt; _______________________________________________
> &gt;&gt; &amp;gt; Users mailing list
> &gt;&gt; &amp;gt; Users at openlayers.org
> &gt;&gt; &amp;gt; http://openlayers.org/mailman/listinfo/users
> &gt;&gt; &amp;gt; 
> &gt;&gt; &amp;gt; 
> &gt;&gt; 
> &gt;&gt; -- 
> &gt;&gt; View this message in context:
> &gt; http://www.nabble.com/ISO-8859-1-tf4887822.html#a14021264
> &gt;&gt; Sent from the OpenLayers Users mailing list archive at
Nabble.com.
> &gt;&gt; 
> &gt;&gt; _______________________________________________
> &gt;&gt; Users mailing list
> &gt;&gt; Users at openlayers.org
> &gt;&gt; http://openlayers.org/mailman/listinfo/users
> &gt;&gt; 
> &gt; 
> &gt; 
> &gt; 
> &gt; _______________________________________________
> &gt; Users mailing list
> &gt; Users at openlayers.org
> &gt; http://openlayers.org/mailman/listinfo/users
> &gt; 
> &gt; 
> 
> -- 
> View this message in context:
http://www.nabble.com/ISO-8859-1-tf4887822.html#a14022546
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
> 
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
> 






More information about the Users mailing list