json or xml for creating markers from database?

225 views
Skip to first unread message

thindery

unread,
Oct 10, 2011, 1:12:05 PM10/10/11
to google-map...@googlegroups.com
I wanted to get opinions on what is the best way to allow a user to input their location and retrieve a map with markers of my database locations.

I found the tutorial here: http://code.google.com/apis/maps/articles/phpsqlsearch_v3.html that uses xml to create the markers.

However many other tutorials I find use a .json file to load markers, yet I can't ever find a database tutorial to create the markers using the json_encode function in php.

I'm currently working with the xml version, as it was the best tutorial I could find for querying a database.  But I am finding issues with IE and the way it parse's xml.  I'm also finding for some reason that the more nodes I have the xml generate, the more likely the application doesn't work.  Kind of weird?

Any thoughts on this topic would be helpful in deciding my further development!


thindery

unread,
Oct 11, 2011, 10:45:03 AM10/11/11
to google-map...@googlegroups.com
anybody have anything on this?

Andrew Leach

unread,
Oct 11, 2011, 10:59:43 AM10/11/11
to google-map...@googlegroups.com
On 10 October 2011 18:12, thindery <thin...@gmail.com> wrote:
>
> I'm currently working with the xml version, as it was the best tutorial I
> could find for querying a database.  But I am finding issues with IE and the
> way it parse's xml.  I'm also finding for some reason that the more nodes I
> have the xml generate, the more likely the application doesn't work.  Kind
> of weird?

Not weird. The more nodes you have, the greater the opportunity to
introduce an error.

XML is the one instance where you *should* code for IE. IE's XML
parsing is far more strict and standards-compliant than other
browsers'.

If you don't like XML, you could just write out JSON directly. You
don't *have* to use a function to do it (just as there is an example
for writing XML directly). There may be examples out there which will
help with markers; I don't know of any. Searching might find something
useful: http://www.google.co.uk/search?q=example+json_encode+php

thindery

unread,
Oct 11, 2011, 11:15:00 AM10/11/11
to google-map...@googlegroups.com, andrew....@gmail.com
Thanks for the heads up.  I think I am going to switch to JSON since my markers are going to have many nodes. 

I appreciate the feedback!

Berry Ratliff

unread,
Oct 11, 2011, 11:40:17 AM10/11/11
to Google Maps JavaScript API v3
Good choice. JSON is much faster. It is ready for interpretation
directly by the browser without extra code to parse it. It is much
smaller without the verbosity of beginning tags & ending tags for
every element. It avoids cross domain limitations.

Berry Ratliff

unread,
Oct 11, 2011, 11:44:37 AM10/11/11
to Google Maps JavaScript API v3
On Oct 11, 3:15 pm, thindery <thind...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages