Hi All,

After offline discussion with Tharindu, we identified this was a data
import issue. After using below commands to import data from CSV, we could
get the country without any issue.

*mysqlimport -u root -p --ignore-lines=2 --fields-terminated-by=,
--fields-optionally-enclosed-by='"' --local GEO_LOCATION_DATA
/Users/Lakshman/Downloads/GeolocationData/data/LOCATION.csv *

*mysqlimport -u root -p --ignore-lines=2 --fields-terminated-by=,
--fields-optionally-enclosed-by='"' --local GEO_LOCATION_DATA
/Users/Lakshman/Downloads/GeolocationData/data/BLOCKS.csv*

In that case, we need to check data imported properly or not, we can use
below query,

*SELECT loc.country_name,loc.subdivision_1_name FROM BLOCKS block ,
LOCATION loc WHERE block.network_blocks = '203.94' AND 3411959556 BETWEEN
block.network AND block.broadcast AND block.geoname_id=loc.geoname_id;*

It should return following result set

+--------------+--------------------+

| country_name | subdivision_1_name |

+--------------+--------------------+

| Sri Lanka    |                    |

+--------------+--------------------+

1 row in set (0.02 sec)

@Doc Team: Note that This was not mentioned in docs[1], we should clear
about how data import and check whether data imported or not properly.
Please include this in docs.

[1]
https://docs.wso2.com/display/AM210/Configuring+Geolocation+Based+Statistics

Thanks,

Lakshman





On Tue, Jun 6, 2017 at 10:13 PM, Lakshman Udayakantha <[email protected]>
wrote:

> Hi Megala,
>
> No. That is not the issue. When I use online services [1] I can see the
> country.
>
> [1] https://www.iplocation.net/
>
> Thanks,
> Lakshman
>
> On Tue, Jun 6, 2017 at 10:04 PM, Megala Uthayakumar <[email protected]>
> wrote:
>
>> Hi Lakshman,
>>
>> "getCountry" method will return empty value if we have used an internal
>> ip address. We need to give the public ip address as the parameter. We can
>> get the public ip address using following command,
>>
>> *dig +short myip.opendns.com <http://myip.opendns.com>
>> @resolver1.opendns.com <http://resolver1.opendns.com>*
>>
>> Thanks
>>
>> Regards,
>> Megala
>>
>>
>> On Tue, Jun 6, 2017 at 4:36 PM, Lakshman Udayakantha <[email protected]>
>> wrote:
>>
>>> Hi Tharindu,
>>>
>>> I tried this feature [1] with the instructions given [2], [3]. Note that
>>> I need to check only getCountry method. Below is the steps I have done
>>>
>>> 1. Created a data source called GEO_LOCATION_DATA and imported CSV files
>>> downloaded from given location in [2].
>>> 2. Installed following features in DAS 3.1.0.
>>>
>>>    - Analytics Spark Geolocation UDF
>>>    - Analytics Spark scripts Common
>>>    - Analytics Spark Useragent
>>>
>>> 3. Invoked the getCountry method from analytics console in DAS 3.1.0.
>>> But it returns an empty country in the console. What am I missing here?
>>> Or any hint to troubleshoot. According to the code, it searches for an
>>> entry in IP_LOCATION table. but we are not importing data to that table as
>>> specified in the doc?
>>>
>>> [1] https://github.com/wso2/shared-analytics/tree/v1.0.0/com
>>> ponents/spark-udf/org.wso2.carbon.analytics.shared.geolocation.udf
>>> [2] https://docs.wso2.com/display/AM200/Configuring+Geolocat
>>> ion+Based+Statistics
>>> [3] http://blog.rukspot.com/2016/10/configure-wso2-das-310-for-w
>>> so2-apim.html
>>>
>>> Thanks,
>>> Lakshman.
>>>
>>> --
>>> Lakshman Udayakantha
>>> WSO2 Inc. www.wso2.com
>>> lean.enterprise.middleware
>>> Mobile: *0717429601*
>>>
>>>
>>> _______________________________________________
>>> Dev mailing list
>>> [email protected]
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>>
>> --
>> Megala Uthayakumar
>>
>> Software Engineer
>> Mobile : 0779967122
>>
>
>
>
> --
> Lakshman Udayakantha
> WSO2 Inc. www.wso2.com
> lean.enterprise.middleware
> Mobile: *0717429601*
>
>


-- 
Lakshman Udayakantha
WSO2 Inc. www.wso2.com
lean.enterprise.middleware
Mobile: *0717429601*
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to