Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Google Map runs well only if...

the following SET Parameters are set:

SET ThousandSep=',';

SET DecimalSep='.';

Result i.e.: 100,000,000.00 which is the U.S. related format - Google Map runs!

In European environments this setting is used to be set vice versa.

SET ThousandSep='.';

SET DecimalSep=',';

Result i.e.: 100.000.000,00 which is the European related format. But: Google Map does not work correct any more now.

1st Reason: Google needs geodata like this Lat 7.234262342  and Long 24.4564677

and NOT Lat 7,234262342  and Long 24,4564677.

This I checked already. But nevertheless geodata shows up not correctly in my google map.

Question: How to use the European format for digits together with Google Maps?

Many Thanks

Josi

I've added expected and current results, when using different settings....Message was edited by: Jörg Simon

5 Replies
whiteline
Master II
Master II

Hi.

The easiest way is Replace(Lat, ',', '.')

Or change text format of your data with a num() function.

Not applicable
Author

Hi,

"The easiest way is Replace(Lat, ',', '.')" > did that already.

"Or change text format of your data with a num() function." did that already too.

Lat and Long Format exist as Google Maps expects it:

LOAD

    ..

    num(latitude, '#.#############', '.' , ',' ) as latitude,

    num(longitude, '#.#############', '.' , ',' ) as longitude,

    ...

FROM...

Nevertheless, there seem to be some functions  somewhere in the standard load script for Google Maps (see below) that might need the "." as the decimal parameter to work correctly (see script):

gmap_key = 'XX';

max_zoom_level = 15; //maximum value 17

// Variables required for calculating map

// No need to change these

var_pi180=        '=pi()/180';

var_lat_offset=    '0';

var_mc2=        '=256*pow(2,$(var_zoom))';

var_mc1=        '=256*pow(2,($(var_zoom)-1))';

var_mid_lat=    '=min(latitude)+(1+var_lat_offset)*((max(latitude)-min(latitude))/2)';

var_mid_long=    '=min(longitude)+(max(longitude)-min(longitude))/2';

var_zoom=        '=max(aggr(if(max( round(256*pow(2,(_zoom_level -1)))+( longitude  *((256*pow(2,_zoom_level ))/360)) )-min( round(256*pow(2,(_zoom_level -1)))+( longitude  *((256*pow(2,_zoom_level ))/360)) ) <map_size_x AND max((256*pow(2,(_zoom_level-1)))+((0.5*log((1+(sin((latitude)*pi()/180)))/(1-(sin((latitude)*pi()/180)))))*((-256*pow(2,_zoom_level))/(2*pi()))))-min((256*pow(2,(_zoom_level-1)))+((0.5*log((1+(sin((latitude)*pi()/180)))/(1-(sin((latitude)*pi()/180)))))*((-256*pow(2,_zoom_level))/(2*pi()))))<map_size_y,_zoom_level,1),_zoom_level))';

var_maptype=    '=if(isnull(only(maptype)),fieldvalue( '&chr(39)&'maptype'&chr(39)&', 1 ),maptype)';

map_size_x=        '400';

map_size_y=        '400';

...or in the MAP-Object the "." as the decimal Paramenter is needed:

for the Longitude:

=sum( round (256*pow(2,($(var_zoom)-1)))+( longitude *((256*pow(2,$(var_zoom)))/360)) )

for the Latidude:

=sum( 

((256*pow(2,($(var_zoom)-1)))+((0.5*log((1+(sin((latitude)*pi()/180)))/(1-(sin((latitude)*pi()/180)))))*((-256*pow(2,$(var_zoom)))/(2*pi()))))

)

If the " SET DecimalSep=',';  " is changed to " SET DecimalSep='.'; " in the loading script, things work.

Problem is, we can't use this US number format.

Many Thanks for any help.

Regards

Josi

whiteline
Master II
Master II

Hi.

You're missing that longitude and latitude should be the numbers, while in your case it seems it's just strings.

When you change the SET ThousandSep=','; and SET DecimalSep='.'; QV converts them  implicitly.

The num() function doesn't convert string to number, it changes the text format of a numeric value. To convert your strings to numbers use num#().

I thought you're talking about http get string request (it's used to load dynamic map image, look at chart properties).

I think you could also check it so that the expression creates the right string.

Not applicable
Author

Hi there,

this is a part of the geodata.xls:

60000FrankfurtGroße Bockenheimer8,674682450,1144288
20000HamburgGroße Freiheit9,957382753,550093
40212DuesseldorfKönigsallee6,779262351,2223383
80000MuenchenMaximilienstraße11,583635148,1384535
8032ZuerichTalstraße8,5380326

47,3690239

10365BerlinPotsdamer Platz13,375843352,5092892

The problem is NOT to have strings for longitude and latitude (i.e. one can add numbers in the columns 3 and 4).

It we use: SET DecimalSep='.' or if we use SET DecimalSep=',';  AND if we select ONE city only everything is fine with both settings. The bubble in our chart, that is, the city is shown in the right place on the map!

If more than one City is selected the bubbles in the chart are NOT set correctly if  SET DecimalSep=','; is set.

If more than one City is selected the bubbles in the chart are set correctly if  SET DecimalSep=','; is set.

Why?

Josi

whiteline
Master II
Master II

Could you post a sample that works incorrectly ?