Page 1 of 2   1 2 > last >>
Bookmark this page: Add advice needed  efficient approach to find streets that are close to a given point to Yahoo MyWeb Add advice needed  efficient approach to find streets that are close to a given point to Google Bookmarks Add advice needed  efficient approach to find streets that are close to a given point to Windows Live Add advice needed  efficient approach to find streets that are close to a given point to Del.icio.us Digg advice needed  efficient approach to find streets that are close to a given point! Add advice needed  efficient approach to find streets that are close to a given point to Netscape
  •  
  • Subject
  • Author
  • Date
If you were  Registered and logged in, you could reply and use other advanced thread options
Posted by busnet on July 12, 2007, 7:57 am
Hi.
I've got the following problem: I have a huge xml-file that represents
a street map of a city. Each street is stored as a couple of
coordinates (start, end and all the turns).
I process that file and try to find those streets that are close to a
given point. So what I do is calculate the distances to EACH street
segment (using linear algebra algorithms, that is, constructing the
vector from two points and computing the distance from the given point
to this vector).
Do you have any ideas how to speed up the process of finding the
nearest street(s)?
I tried to consider only those streets whose endpoints are within a
certain range from the given marker-point, but it was not considerably
faster and if there was a street thats very long and straight the
endpoints may be far away, but the street itself could be quite near.

Any help is appreciated!


Posted by Uffe Kousgaard on July 12, 2007, 10:03 am

> Do you have any ideas how to speed up the process of finding the
> nearest street(s)?

Pre-process the data and create a spatial index. Then you will be able to do
the spatial searches a lot faster. But that requires either writing lots of
code or using other software - any capable GIS should be able to do this.

Regards
Uffe Kousgaard



Posted by busnet on July 12, 2007, 1:05 pm
> > Do you have any ideas how to speed up the process of finding the
> > nearest street(s)?
> Pre-process the data and create a spatial index. Then you will be able to do
> the spatial searches a lot faster. But that requires either writing lots of
> code or using other software - any capable GIS should be able to do this.

Unfortunately I have to use php to do this, as I'm interacting with
google maps. I'm afraid its out of my scope to write a spatial
database in php ;-)
Thanks for the help anyway.
Anybody any idea on how to generally speed up the process without a
spatial database?


Posted by ujaval@gmail.com on July 16, 2007, 3:07 am
> > > Do you have any ideas how to speed up the process of finding the
> > > nearest street(s)?
> > Pre-process the data and create a spatial index. Then you will be able to do
> > the spatial searches a lot faster. But that requires either writing lots of
> > code or using other software - any capable GIS should be able to do this.
> Unfortunately I have to use php to do this, as I'm interacting with
> google maps. I'm afraid its out of my scope to write a spatial
> database in php ;-)
> Thanks for the help anyway.
> Anybody any idea on how to generally speed up the process without a
> spatial database?

I am not sure why you can't use a spatial database. You don't have to
write one, just use the php interface to access the database.
Postgresql should suffice your requirements for building spatial index
and I have used to it with php to build google maps applications.

-Ujaval
http://spatialthoughts.com


Posted by busnet on July 17, 2007, 11:39 am
> I am not sure why you can't use a spatial database. You don't have to
> write one, just use the php interface to access the database.
> Postgresql should suffice your requirements for building spatial index
> and I have used to it with php to build google maps applications.

Well, I'm using mysql as the database and it spatial database parts
lacks the distance-function, which I need most. I didn't know that
postgresql has this extension already. I now use the serialize
function to store and load some preprocessed (i.e. stripped) data. Its
not a professional solution, but it works for now and does not need a
database, which is a bit pro for local deployment. But thank you for
the hint towards postgresql, I will keep it in mind.


Page 1 of 2   1 2 > last >>