Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

alexcastorena
New Contributor III

I have a city that is showing up on the wrong state.

I have a city that is showing up on the wrong state. For example i have customers in Hollywood CA & Hollywood FL. Though when I select FL on the map, Hollywood CA shows up on the point map. Please Help !

Tags (2)
12 Replies
ogster1974
Honored Contributor II

Re: I have a city that is showing up on the wrong state.

Include city and state in your point selection not just city or you will get these weird behaviours.

Khan_Mohammed
Honored Contributor II

Re: I have a city that is showing up on the wrong state.

What type of map re you using?

Latitude and Longitude?

Manually check the Lat & Long in google if it is giving correct location...

Sometimes having Longitude before and Latitude after would give wrong point.

It should always be ex:  Geomakepoint(Latitude, Longitude) as GeoMap

(-72.5334, 45.89745)

alexcastorena
New Contributor III

Re: I have a city that is showing up on the wrong state.

Im using the geo tagging field when bringing in the data to Qlik Desktop. Though the geo tagging only allows you to associate the city with the country not the state.

According to Qlik you dont need to bring in KML files.

Khan_Mohammed
Honored Contributor II

Re: I have a city that is showing up on the wrong state.

Can you please paste the screen shot of your map and script?

alexcastorena
New Contributor III

Re: I have a city that is showing up on the wrong state.

Here are screenshots, I've also loaded the auto script that Qlik created. As you can see, I selected Florida as the state and Hollywood as the city, though its putting it as California. There is no way to geotag the city to the state.

qlik1.jpg

qlik2.jpg

Set dataManagerTables = '','CustTest';

//This block renames script tables from non generated section which conflict with the names of managed tables

For each name in $(dataManagerTables)

    Let index = 0;

    Let currentName = name;

    Let tableNumber = TableNumber(name);

    Let matches = 0;

    Do while not IsNull(tableNumber) or (index > 0 and matches > 0)

        index = index + 1;

        currentName = name & '-' & index;

        tableNumber = TableNumber(currentName)

        matches = Match('$(currentName)', $(dataManagerTables));

    Loop

    If index > 0 then

            Rename Table '$(name)' to '$(currentName)';

    EndIf;

Next;

Set dataManagerTables = ;

Unqualify *;

__cityAliasesBase:

LOAD

                Alias AS [__City],

                geoKey AS [__geoKey],

                CountryCode AS [__CityCountryCode]

FROM [lib://__GEO_TABLES/cityAliases.qvd]

(qvd);

__cityGeoBase:

LOAD

                geoKey AS [__geoKey],

                geoPoint AS [__GeoPoint]

FROM [lib://__GEO_TABLES/cityGeo.qvd]

(qvd);

__countryAliasesBase:

LOAD

                Alias AS [__Country],

                ISO3Code AS [__ISO3Code]

FROM [lib://__GEO_TABLES/countryAliases.qvd]

(qvd);

__countryGeoBase:

LOAD

                ISO3Code AS [__ISO3Code],

                ISO2Code AS [__ISO2Code],

                Polygon AS [__Polygon]

FROM [lib://__GEO_TABLES/countryGeo.qvd]

(qvd);

__countryCodeAndCityName2Key:

MAPPING LOAD

                __CityCountryCode & __City,

                __geoKey

RESIDENT __cityAliasesBase;

__cityKey2GeoPoint:

MAPPING LOAD

                __geoKey,

                __GeoPoint

RESIDENT __cityGeoBase;

__countryName2IsoThree:

MAPPING LOAD

                __Country,

                __ISO3Code

RESIDENT __countryAliasesBase;

__countryCodeIsoThree2Polygon:

MAPPING LOAD

                __ISO3Code,

                __Polygon

RESIDENT __countryGeoBase;

[CustTest]:

LOAD

                [Customer],

                [Country],

                [State],

                [City],

                [Rev],

                [Profit],

                APPLYMAP( '__cityKey2GeoPoint', APPLYMAP( '__countryCodeAndCityName2Key', APPLYMAP( '__countryName2IsoThree', LOWER([Country])) & LOWER([City])), '-') AS [CustTest.City_GeoInfo],

                APPLYMAP( '__countryCodeIsoThree2Polygon', APPLYMAP( '__countryName2IsoThree', LOWER([Country])), '-') AS [CustTest.Country_GeoInfo]

FROM [lib://Maps/CityCustomersTest.xlsx]

(ooxml, embedded labels, table is CustTest);

TAG FIELD [City] WITH '$geoname', '$relates_CustTest.City_GeoInfo' ;

TAG FIELD [CustTest.City_GeoInfo] WITH '$geopoint', '$hidden', '$relates_City' ;

TAG FIELD [Country] WITH '$geoname', '$relates_CustTest.Country_GeoInfo' ;

TAG FIELD [CustTest.Country_GeoInfo] WITH '$geopolygon', '$hidden', '$relates_Country' ;

DROP TABLES __cityAliasesBase, __cityGeoBase, __countryAliasesBase, __countryGeoBase;

Khan_Mohammed
Honored Contributor II

Re: I have a city that is showing up on the wrong state.

Let me ask you this, do you have Lat & Long for the State/City?

Cus you are building a Bubble map and I see Polygon data in your script.

Where did you Geo Code this data for your map, Is it generic Lat& Long or based on your data?

Why are you doing apply map?

Building this type of map is never hard, all you need is to make geomakepoint from lat&long.

alexcastorena
New Contributor III

Re: I have a city that is showing up on the wrong state.

i do not have lat & long coordinates. it was all generated by Qlik. I could not find a state & city KML.

Khan_Mohammed
Honored Contributor II

Re: I have a city that is showing up on the wrong state.

Use the attached file for your Map.

In script to create a GeoPoint type in,

Geomakepoint(Latitude,Longitude) as GeoPoint

Take Geopoint at Area or Layer in the front end.

alexcastorena
New Contributor III

Re: I have a city that is showing up on the wrong state.

Can you please send it again, i didnt get an attachment.

thanks for your help

Community Browser