advise needed: storing huge structure persistent or alternative

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • busnet

    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.

  • Captain Paralytic

    #2
    Re: advise needed: storing huge structure persistent or alternative

    On 12 Jul, 12:50, busnet <goo...@00l.dew rote:
    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.

    Comment

    • busnet

      #3
      Re: advise needed: storing huge structure persistent or alternative

      On 12 Jul., 13:56, Captain Paralytic <paul_laut...@y ahoo.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 :(

      Comment

      • Paul Lautman

        #4
        Re: advise needed: storing huge structure persistent or alternative

        busnet wrote:
        On 12 Jul., 13:56, Captain Paralytic <paul_laut...@y ahoo.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


        Comment

        • busnet

          #5
          Re: advise needed: storing huge structure persistent or alternative

          On 12 Jul., 22:26, "Paul Lautman" <paul.laut...@b tinternet.comwr ote:
          busnet wrote:
          On 12 Jul., 13:56, Captain Paralytic <paul_laut...@y ahoo.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!

          Comment

          Working...