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
https://forums.phpfreaks.com/topic/259606-php-createelementpolygon-help-please/
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);

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.