JSON is much easier to work with in JavaScript, and much faster too.

Since JSON is the native JavaScript object/array format, you don't need to
make a bunch of complicated and inefficient DOM calls to access the data you
download, simply use ordinary JavaScript object and array references.

JSON is also easy to generate from PHP. If you have PHP 5.2 or greater, you
can use the built-in json_encode():
http://php.net/manual/en/function.json-encode.php

I'm not sure what you mean by running the extract to make a session-based
XML file. With either XML or JSON, you can either generate static files or
generate the HTTP response dynamically for each user. Static files can give
you less load on your database (since there's no database access when they
are downloaded); dynamically generated data requires a database access but
can give you a smaller download to the client if you only need a subset of
the data. This issue isn't really a Maps API question, but feel free to
explain further what you're talking about and we can kick it around.

Whatever you do, though, save yourself a lot of work and use JSON instead of
XML.

-Mike

On Mon, Jun 28, 2010 at 6:28 AM, doug <[email protected]> wrote:

> Hi,
> I'm just getting started on adding a Google map element to our
> website. Reading through all of the posts the perceived wisdom seems
> to be to write a PHP function to extract all of the marker info from a
> database table and build an XML file. To display the map the data can
> then read back in from the XML through a JS function.
>
> If the database gets updated should the XML file be recreated and
> users only see the pre-prepared XML? Or should I run the extract to
> create an session based XML file? Doing it this way makes it almost
> real-time and allows me to filter the data down to what's appropriate
> for the user.
>
> One of the systems I've seen runs the SQL and creates a JS module from
> it. It's really cumbersome but is this the best way?
>
> Your guidance would be most appreciated.
>
> Regards
> Doug
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Maps API" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-maps-api%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-maps-api?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-api?hl=en.

Reply via email to