Sunday, April 27, 2014

How to use createLayer method calling MouseClick Event


The usage of createLayer is like the following example.
var layer2 = new ILayer();

 var hcols = "STRING_1,STRING_2,NUMBER_1,NUMBER_2".split(","); 

 var whereCondition = 'IL_ID=34'

 var labelColumn = 'POINT_ID'

 layer2.createLayer(ILayer.USER_POINT, "lyr_2", whereCondition,
 null, 'M.PIN_1', true, mouseClick, labelColumn, null, hcols);
ILayer.USER_POINT is explained at http://www.locationbox.com.tr/web/api_adduserpoint.jsp

Moreover, the function of mouseClick is detailed below.
function mouseClick(pos, info) {

  var html = '';

   html += '  ';

   for( var i = 0; i < info.data.length; i++ ) {

     var data = info.data[i];

     var color = "#ffffff";

     if( (i & 1) != 0 ) color = "#ffffff";

     html += '  ';

   } // for()

 html += '
ID' + info.id + '
' + data.name + '' + data.value + '
'; mapper.displayInfoWindow(pos.y, pos.x, html, 240, 100, "Bilgi: " + info.id); return; } // mouseClick()

For more detailed information and questions, do not hesitate to contact to us.

Wednesday, March 7, 2012

"Request string is too long" Error Using Coloring Analysis

The request string for creating a Coloring Analysis is indeed very long compared to other features. That's why you get this error only when you make a Coloring Analysis request.
The reason that you get this error is, your application is running on a domain that is different from the domain LocationBox is running on. In order to solve this, you should configure a proxy on your server. You will find the directions for configuring proxy on Apache Tomcat and IIS servers.

Apache Tomcat

1. Open the httpd.conf file and uncomment the following lines.

   LoadModule proxy_http_module modules/mod_proxy_http.so
  LoadModule proxy_module modules/mod_proxy.so


2. Add the following lines to httpd.conf
<IfModule mod_proxy.c>
  ProxyRequests Off
<proxy *>
  Order deny,allow
  Deny from 127.0.0.1
  Allow from all
</proxy>
  ProxyPass /mapviewer http://www.locationbox.com.tr/mapviewer
  ProxyPassReverse /mapviewer http://www.locationbox.com.tr/mapviewer
</IfModule>
3. Restart Tomcat.

4. Try accessing //localhost/mapviewer (include the port if Tomcat is not using port 80 (ie. //localhost:xxx/mapviewer)

IIS

1. Install ISAPI_Rewrite to use the proxy service. You can download ISAPI_Rewrite from here:

http://www.helicontech.com/download-isapi_rewrite3.htm

(Note: The Lite version of ISAPI_Rewrite does not have proxy support.)

2. Open ISAPI_Rewrite Manager and click "Edit" on configuration section.


3. Paste the following text to the editor.

# Helicon ISAPI_Rewrite configuration file
# Version 3.1.0.88

RewriteEngine On
RewriteCompatibility2 On
RepeatLimit 32
RewriteBase
# unsupported directive: [ISAPI_Rewrite]

#  3600 = 1 hour
# unsupported directive: CacheClockRate 3600

#  Block external access to the httpd.ini and httpd.parse.errors files
RewriteRule ^/httpd(?:\.ini|\.parse\.errors).*$ / [NC,F,O]
#  Block external access to the Helper ISAPI Extension
RewriteRule ^.*\.isrwhlp$ / [NC,F,O]

RewriteProxy ^/mapviewer(.+)$ http\://www.locationbox.com.tr/mapviewer$1 [NC]



4. Click "Apply" on configuration section.


5. Try accessing //localhost/mapviewer/ . Make sure that you add "/" at the end of your test url. (Include the port if Tomcat is not using port 80. ie. //localhost:xxx/mapviewer/)