ThunderAI Posted March 24, 2012 Share Posted March 24, 2012 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 Quote Link to comment https://forums.phpfreaks.com/topic/259606-php-createelementpolygon-help-please/ Share on other sites More sharing options...
ThunderAI Posted March 24, 2012 Author Share Posted March 24, 2012 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); Quote Link to comment https://forums.phpfreaks.com/topic/259606-php-createelementpolygon-help-please/#findComment-1330675 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.