Click here to get back home

advice needed: efficient approach to find streets that are close to a given point

 HomeNewsGroups | Search | About
 comp.infosystems.gis    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
advice needed: efficient approach to find streets that are close to a given point busnet 07-12-2007
Posted by busnet on July 12, 2007, 7:57 am
Please log in for more thread options
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
Please log in for more thread options

> 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
Please log in for more thread options
> > 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
Please log in for more thread options
>
> > > 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
Please log in for more thread options
> 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.


Similar ThreadsPosted
advice needed: efficient approach to find streets that are close to a given point July 12, 2007, 7:58 am
GIS Work in Montreal/ Canada- Advice Needed- Role Needed April 3, 2007, 2:19 pm
efficient algorithms for spherical distance buffering? May 24, 2005, 6:43 am
find a city given lat/lon February 11, 2006, 5:21 pm
Where to find Arcview 3.x Macintosh? February 21, 2005, 11:51 am
Find Your Soul Mate May 20, 2006, 12:42 am
How many streets are there in the USA? November 29, 2007, 12:52 am
Where is the best placed to find candidates for GIS postgrad positions? May 29, 2007, 12:27 pm
Need your advice! March 16, 2005, 6:54 am
Redas Cannot find external functions to handle file February 16, 2007, 8:15 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap