Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Geo-ShapeFile CPAN distribution.

Report information
The Basics
Id: 49054
Status: resolved
Priority: 0/
Queue: Geo-ShapeFile

People
Owner: SLAFFAN [...] cpan.org
Requestors: rgsave [...] hotmail.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: 2.54



Subject: Geo::Shapefile - Caching
Hi, I have a list of million points, which I need to match against a big shapefile of polygons. For starters I tried just 2000 points. The job took me above 17 hrs. In the hopes of some improvements, I looked through the source code and found that the author has already though about Caching, but it didn't seem to be working. I did a small fix (locally) in the "cache" method and the same 2000 points matching too just 15 mins. # # In the following if condition .. replace (@_) instead of ($@) # clearly a typo. # if($@) { $self->{_object_cache}->{$type}->{$obj} = shift; } Thanks for the module, it has helped me a big time. - Saver ---------------------------------------------------- Original code: package Geo::ShapeFile; sub cache { my $self = shift; my $type = shift; my $obj = shift; if($self->{_change_cache}->{$type} && $self->{_change_cache}->{$type}->{$obj}) { return $self->{_change_cache}->{$type}->{$obj}; } return unless $self->caching($type); if($@) { $self->{_object_cache}->{$type}->{$obj} = shift; } return $self->{_object_cache}->{$type}->{$obj}; }
Hello saver, This typo will be fixed in the next release. https://github.com/shawnlaffan/Geo-ShapeFile/issues/4 If you are able to add some tests then that would be much appreciated. Development is at https://github.com/shawnlaffan/Geo-ShapeFile (I have not worked through the caching logic yet). Regards, Shawn. On Wed Aug 26 22:58:55 2009, saver wrote: Show quoted text
> Hi, > > I have a list of million points, which I need to match against a big > shapefile of polygons. For starters I tried just 2000 points. The job > took me above 17 hrs. > > In the hopes of some improvements, I looked through the source code and > found that the author has already though about Caching, but it didn't > seem to be working. > > I did a small fix (locally) in the "cache" method and the same 2000 > points matching too just 15 mins. > > # > # In the following if condition .. replace (@_) instead of ($@) > # clearly a typo. > # > > if($@) { > $self->{_object_cache}->{$type}->{$obj} = shift; > } > > Thanks for the module, it has helped me a big time. > > - Saver > > ---------------------------------------------------- > Original code: > > package Geo::ShapeFile; > > sub cache { > my $self = shift; > my $type = shift; > my $obj = shift; > > if($self->{_change_cache}->{$type} && > $self->{_change_cache}->{$type}->{$obj}) { > return $self->{_change_cache}->{$type}->{$obj}; > } > > return unless $self->caching($type); > > if($@) { > $self->{_object_cache}->{$type}->{$obj} = shift; > } > return $self->{_object_cache}->{$type}->{$obj}; > }
Fixed in 2.54. On Sun Feb 09 03:28:32 2014, SLAFFAN wrote: Show quoted text
> Hello saver, > > This typo will be fixed in the next release. > > https://github.com/shawnlaffan/Geo-ShapeFile/issues/4 > > If you are able to add some tests then that would be much appreciated. > Development is at https://github.com/shawnlaffan/Geo-ShapeFile (I have > not worked through the caching logic yet). > > > Regards, > Shawn. > > > On Wed Aug 26 22:58:55 2009, saver wrote:
> > Hi, > > > > I have a list of million points, which I need to match against a big > > shapefile of polygons. For starters I tried just 2000 points. The job > > took me above 17 hrs. > > > > In the hopes of some improvements, I looked through the source code > > and > > found that the author has already though about Caching, but it didn't > > seem to be working. > > > > I did a small fix (locally) in the "cache" method and the same 2000 > > points matching too just 15 mins. > > > > # > > # In the following if condition .. replace (@_) instead of ($@) > > # clearly a typo. > > # > > > > if($@) { > > $self->{_object_cache}->{$type}->{$obj} = shift; > > } > > > > Thanks for the module, it has helped me a big time. > > > > - Saver > > > > ---------------------------------------------------- > > Original code: > > > > package Geo::ShapeFile; > > > > sub cache { > > my $self = shift; > > my $type = shift; > > my $obj = shift; > > > > if($self->{_change_cache}->{$type} && > > $self->{_change_cache}->{$type}->{$obj}) { > > return $self->{_change_cache}->{$type}->{$obj}; > > } > > > > return unless $self->caching($type); > > > > if($@) { > > $self->{_object_cache}->{$type}->{$obj} = shift; > > } > > return $self->{_object_cache}->{$type}->{$obj}; > > }