Jump to content

PHP CreateElement('Polygon'); Help please


ThunderAI

Recommended Posts

Does someone have a PHP script that will create a polygon for a KML file?

 

For the life of me I can't seem to get the cost to work so it shows up in Google Earth.  Something is very wrong with the code and there are no samples on the internet I can find that show a completed polygon in PHP.

 

Thanks

 

 

 

 

Link to comment
Share on other sites

This "works", but its certainly not correct:  Does someone have a polygon that has a defined color style in the correct format?

 

Thanks.

 

//Create a Placemark and append it to the document

$node = $dom->createElement('Placemark');

$placeNode = $docNode->appendChild($node);

$placeNode->setAttribute('id',$tmpid);

$nameNode = $dom->createElement('name','PolygonName');

$placeNode->appendChild($nameNode);

$descNode= $dom->createElement('description', 'test');

$placeNode->appendChild($descNode);

$lineNode = $dom->createElement('Polygon');

$placeNode->appendChild($lineNode);

$exnode = $dom->createElement('extrude', '100');

$lineNode->appendChild($exnode);

 

$outerboundnode = $dom->createElement('outerBoundaryIs');

$lineNode = $lineNode->appendChild($outerboundnode);

$ringnode =$dom->createElement('LinearRing');

$lineNode = $lineNode->appendChild($ringnode);

 

 

 

$almodenode =$dom->createElement(altitudeMode,'relativeToGround');

$lineNode->appendChild($almodenode);

 

$coorNode = $dom->createElement('coordinates',$locationstring);

$lineNode->appendChild($coorNode);

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.