I am writing a twitter scraper and I am getting the geo-point from each tweet and they are being mapped fine. The only thing I am not getting is the location name itself like '101 North 4th Street'. I know that there's a reverse geocoding module in the documentation, but I'm not sure how to use it exactly. Does anyone know what to do with this?
When in doubt, read the docs. It seems like the reverse geocoder takes in
the point as an argument and returns the block information for the given
point.
On Thu, Aug 9, 2012 at 2:10 PM, Peter <pwb...@mail.missouri.edu> wrote:
> Hi all,
> I am writing a twitter scraper and I am getting the geo-point from each
> tweet and they are being mapped fine. The only thing I am not getting is
> the location name itself like '101 North 4th Street'. I know that there's a
> reverse geocoding module in the documentation, but I'm not sure how to use
> it exactly. Does anyone know what to do with this?
> Thanks,
> Peter
> --
> You received this message because you are subscribed to the Google Groups
> "eb code" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/ebcode/-/VnVpMt0iTZUJ.
> To post to this group, send email to ebcode@googlegroups.com.
> To unsubscribe from this group, send email to
> ebcode+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/ebcode?hl=en.
On Thu, Aug 9, 2012 at 2:10 PM, Peter <pwb...@mail.missouri.edu> wrote:
> Hi all,
> I am writing a twitter scraper and I am getting the geo-point from each
> tweet and they are being mapped fine. The only thing I am not getting is
> the location name itself like '101 North 4th Street'. I know that there's a
> reverse geocoding module in the documentation, but I'm not sure how to use
> it exactly. Does anyone know what to do with this?
Here's how it works in the shell for some of my data:
>>> from ebpub.geocoder.reverse import reverse_geocode
>>> from ebpub.db.models import NewsItem
>>> rni =
On Thu, Aug 09, 2012 at 02:36:32PM -0400, Karen Tracey wrote:
> On Thu, Aug 9, 2012 at 2:10 PM, Peter <pwb...@mail.missouri.edu> wrote:
> > Hi all,
> > I am writing a twitter scraper and I am getting the geo-point from each
> > tweet and they are being mapped fine. The only thing I am not getting is
> > the location name itself like '101 North 4th Street'. I know that there's a
> > reverse geocoding module in the documentation, but I'm not sure how to use
> > it exactly. Does anyone know what to do with this?
> Here's how it works in the shell for some of my data:
> >>> from ebpub.geocoder.reverse import reverse_geocode
> >>> from ebpub.db.models import NewsItem
> >>> rni =
> NewsItem.objects.filter(schema__slug='restaurants',location__isnull=False)[ 0]
> >>> block, distance = reverse_geocode(rni.location)
> >>> block
> <Block: 25952-26230 Andrew Jackson Hwy E.>
> >>> distance
> 0.0
> >>> rni.location_name
> u'26133 Andrew Jackson Hwy'
Thanks for posting that!
> So you can get to the closest block, but I don't know that there is any way
> to have it guess about what number on the block you might be closest to...
Thanks everyone! now I'm trying to strip the string that it returns. The string I am getting is '(<Block: 344-599 E. Stadium Blvd.>, 0.00115576433658708)' and all I want to display is '344-599 E. Stadium Blvd.'. I've tried doing this by using this code:
test = reverse_geocode(item.location) block, address = test.split(':') item.location_name = address
And I would think that would give me block = (<Block: and address = 344-599 E. Stadium Blvd.>, 0.00115576433658708). and then I could split it again, but the first split didn't work. Am I using split incorrectly?
On Thu, Aug 09, 2012 at 02:36:34PM -0700, Peter wrote:
> Thanks everyone! now I'm trying to strip the string that it returns. The > string I am getting is '(<Block: 344-599 E. Stadium Blvd.>, > 0.00115576433658708)' and all I want to display is '344-599 E. Stadium > Blvd.'. I've tried doing this by using this code:
> And I would think that would give me block = (<Block: and address = 344-599 > E. Stadium Blvd.>, 0.00115576433658708). and then I could split it again, > but the first split didn't work. Am I using split incorrectly?
The problem is that reverse_geocode doesn't return a string;
it returns a pair of objects, the first of which is a block instance.