Thursday, 5 September 2013

How to convert geospatial Point(lat,lon) hash back to lat lon values?

How to convert geospatial Point(lat,lon) hash back to lat lon values?

My question is related to Solr and facet queries.
I am new to using Solr and using it with tweet records. My aim is to plot
number of tweets originating from a unique Point(Latitude,Longitude). I am
getting individual facet count results for unique Point ("pgeom"), but the
returned value is garbled as it's hash representation of the stored Point
data. How can this hash be converted back to usable Point? Please see the
details below.
Existing fields in the dataset:
pgeom : Point geo spacial. Example: "pgeom":"POINT(13.13735209 -4.2170403)"
lon : Longitude. Example: "lon":13.13735209
lat : Latitude. Example: "lat":-4.2170403}
Example of query parameters:
Here i am trying to get individual tweet counts using facet field query on
all three "lat", "lon" and "pgeom".
?q=%3A&facet=true&fl=lat,lon,pgeom&facet.field=pgeom&facet.field=lat&facet.field=lon
Json Result:
"pgeom" facet query results in hash values of ingested Points with
associated counts. Where as "lat" and "lon" results in individual tweet
counts associated with each of latitudes and longitudes. I would like to
use this "pgeom" hash to represent tweets from a location on google map.
point geo spacial:
"pgeom":[
"s",5931,
"sxp",3465,
"suk5j4vpex0",361,
"sx",336,
.. and so on
longitude:
"lon":[
"9.6017436",361,
"6.807174",195,
"9.28786844",167,
"5.4770747",169,
"9.03439492",112,
.. and so on
latitude:
"lat":[
"4.450025",361,
"9.420721",195,
"1.29138702",167,
"8.6851517",169,
"0.97996991",157,
.. and so on
Response Header:
"responseHeader":{
"status":0,
"QTime":990,
"params":{
"facet":"true",
"fl":"lat,lon,pgeom",
"indent":"on",
"start":"200",
"q":"*:*",
"facet.field":["lat",
"lon",
"pgeom"],
"wt":"json",
"rows":"200"}},
Response:
"response":{"numFound":2034074,"start":200,"docs":[
{
"pgeom":"POINT(13.13735209 -4.2170403)",
"lon":13.13735209,
"lat":-4.2170403},
{
"pgeom":"POINT(18.284989 -8.731565)",
"lon":18.284989,
"lat":-8.731565},
{
.. and so on
How to convert values like "s", "sxp", "suk5j4vpex0" to readable/usable
format say Point(9.6017436, 4.450025) for "suk5j4vpex0"?
Thanks a lot for your time. lalan

No comments:

Post a Comment