--- lifouboy <[EMAIL PROTECTED]> wrote:

> Hey guys, I'm wanting to learn PHP and have an idea for a new 
> project.  I'd like to put up a simple page for my family 
> members / friends to input their address and contact info, 
> and then use a PHP script grab that text and convert it to 
> KML (Google Earth's XML spec.)
> 
> So what i"m looking for is any direction as to which PHP 
> classes will read text from a field and output it to an 
> XML-based file...(if that's the right direction...any further 
> ideas here would be helpful.)
> 
> Thanks,
> Ben


There are two or three approaches to this.  First of all, Google Earth is
presently a Windows-only program.  I don't think a web application should
exclude the Mac and Linux users when it isn't necessary.  Google Maps works on
most modern browsers, including late versions of IE and Firefox and Safari.

You could create a custom Google Maps application to take each address or zip
code or other location type for those outside the US and generate a latitude
and logitude value which can be used in your displayed maps.  There is a free
service which you may wish to employ which does essentially this function
(http://frappr.com) and I think it may meet your needs.

As far as PHP functions and libraries to generate XML (of which KML is a
particular application), you only need a header() function to identify the data
MIME type and print or echo statements.  Knowledge of the XML structure is
required as well.

_____
<?php
  header("Content-type: text/xml\r\r");
  print  "<" . "?xml ... ?" . ">";
  ...

?>

The first line of your program file must be the opening PHP tag and there can
be no spaces in front of the PHP tag.  The reason is that you are working with
HTTP headers which must be sent before any body content.  If you don't do this
carefully, you will get the dreaded "can't modify the headers because the
headers have already been sent" error.

Notice that I have broken up the opening and closing XML tags.  Since PHP uses
similar XML-style tags, it gets confused with the nested XML tags.

There are numerous Google Maps groups on the Google Groups forums.  I would not
be surprised if there are similar Google Earth groups as well but I have not
sought them.  Since I use MacOS X and Linux exclusively, I have not sought out
the Google Earth resources.

To get an idea of what can be done with Google Maps, see the web site
http://www.mapki.com as there are many interesting and valuable examples there.
 Hopefully O'Reilly will publish a Google Maps Hacks book soon to collect and
organize what you can do even further.

James
_____


James D. Keeline
http://www.Keeline.com  http://www.Keeline.com/articles
http://Stratemeyer.org  http://www.Keeline.com/TSCollection

http://www.ITeachPHP.com -- Free Computer Classes: Linux, PHP, etc.
Fall Semester Begins Sep 7 -- New Classes Start Every Few Weeks.


------------------------ Yahoo! Groups Sponsor --------------------~--> 
1.2 million kids a year are victims of human trafficking. Stop slavery.
http://us.click.yahoo.com/.QUssC/izNLAA/TtwFAA/HKFolB/TM
--------------------------------------------------------------------~-> 

Community email addresses:
  Post message: [email protected]
  Subscribe:    [EMAIL PROTECTED]
  Unsubscribe:  [EMAIL PROTECTED]
  List owner:   [EMAIL PROTECTED]

Shortcut URL to this page:
  http://groups.yahoo.com/group/php-list 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-list/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to