473,397 Members | 2,084 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

advise needed: storing huge structure persistent or alternative

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).
When I set a marker in a google map, I want to find all streets that
are near this marker position.
I now parse the whole file as a simpleXML object, and 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).
Up to now it works like this: I set a marker and the gmaps method
"gdownload()" calls a server side php script, which
1. reads the xml file into an simplexml object
2. for every two coordinates that belong to the same street, it
calculates the vector and computes its distance to the point
3. returns the nearest x streets (as polylines) back to the client

It repeats this, when I set the next marker.

Problems/need for ideas:
1) It always reads the XML file anew, when I set another marker. Is
there some way to cache this or a more intelligent approach? I tried
saving the whole Simplexml-object in a session variable, but it was
too huge. I guess I could create some tables in mysql, but I'm not
sure thats the best solution yet.
2) Not php-specific: Do you have any ideas how to speed up the process
of finding the nearest lane(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 is quite near.

Jul 12 '07 #1
4 1255
On 12 Jul, 12:50, busnet <goo...@00l.dewrote:
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).
When I set a marker in a google map, I want to find all streets that
are near this marker position.
I now parse the whole file as a simpleXML object, and 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).
Up to now it works like this: I set a marker and the gmaps method
"gdownload()" calls a server side php script, which
1. reads the xml file into an simplexml object
2. for every two coordinates that belong to the same street, it
calculates the vector and computes its distance to the point
3. returns the nearest x streets (as polylines) back to the client

It repeats this, when I set the next marker.

Problems/need for ideas:
1) It always reads the XML file anew, when I set another marker. Is
there some way to cache this or a more intelligent approach? I tried
saving the whole Simplexml-object in a session variable, but it was
too huge. I guess I could create some tables in mysql, but I'm not
sure thats the best solution yet.
2) Not php-specific: Do you have any ideas how to speed up the process
of finding the nearest lane(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 is quite near.
ISTR this haveing been discussed in comp.databases.mysql recently. Do
a google search over there.

Jul 12 '07 #2
On 12 Jul., 13:56, Captain Paralytic <paul_laut...@yahoo.comwrote:
ISTR this haveing been discussed in comp.databases.mysql recently. Do
a google search over there.
Well, mysql recently added support for geospatial data, but unluckily
the DISTANCE() function is still not emplemented :(

Jul 12 '07 #3
busnet wrote:
On 12 Jul., 13:56, Captain Paralytic <paul_laut...@yahoo.comwrote:
>ISTR this haveing been discussed in comp.databases.mysql recently. Do
a google search over there.

Well, mysql recently added support for geospatial data, but unluckily
the DISTANCE() function is still not emplemented :(
I know, but as I recall the thread talked about how to do it withouy the
DISTANCE() function
Jul 12 '07 #4
On 12 Jul., 22:26, "Paul Lautman" <paul.laut...@btinternet.comwrote:
busnet wrote:
On 12 Jul., 13:56, Captain Paralytic <paul_laut...@yahoo.comwrote:
ISTR this haveing been discussed in comp.databases.mysql recently. Do
a google search over there.
Well, mysql recently added support for geospatial data, but unluckily
the DISTANCE() function is still not emplemented :(

I know, but as I recall the thread talked about how to do it withouy the
DISTANCE() function
I can't find the thread you are referring to. There are only a couple
of threads that seem to contain the search word "DISTANCE" and none of
them is relevant (well, those that are just point out that this
function is not implemented yet).
Can you remember anything else about that thread that would help me
find it?

Thanks!

Jul 12 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: abcd | last post by:
kutthaense Secretary Djetvedehald H. Rumsfeld legai predicted eventual vicmadhlary in Iraq mariyu Afghmadhlaistmadhla, kaani jetvedehly after "a ljetvedehg, hard slog," mariyu vede legai pressed...
14
by: Kevin McBrearty | last post by:
Hello All, I'm looking at implementing DB in my program for analysis of CAD (STL Files). This database will require the basic functionality. Query Sort Delete/Add Records
3
by: Michael Crawford | last post by:
Hi, Where would one start for this type of application: I want to create an vb.net container application that has the gives the end user the ability to install and uninstall plugins or add-in...
1
by: artifact | last post by:
Hello Can anyone tell me what is the best way to persist a complex object across postbacks in ASP.NET eg * I have a Person class with methods to edit the person's info * I navigate to my...
7
by: Arnold | last post by:
I need to read a binary file and store it into a buffer in memory (system has large amount of RAM, 2GB+) then pass it to a function. The function accepts input as 32 bit unsigned longs (DWORD). I...
67
by: Steven T. Hatton | last post by:
Some people have suggested the desire for code completion and refined edit-time error detection are an indication of incompetence on the part of the programmer who wants such features. ...
2
by: Steve K | last post by:
I got a bit of a problem I like some help on. I'm designing an online training module for people that work in food processing plants. This is my target audience. These workers have little or no...
20
by: =?Utf-8?B?ZW1pdG9qbGV5ZXM=?= | last post by:
Hi everyone: i read from the documentation of a dll that there is a struct that uses char for storing an IP address. How can it be? and how come i can get to representate the same value in a...
6
by: Carl Banks | last post by:
I was wondering if anyone had any advice on this. This is not to study graph theory; I'm using the graph to represent a problem domain. The graphs could be arbitrarily large, and could easily...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.