P1-3.7,40.4,0
P2-3.6,40.5,0
';
$g = SpatialFileConverter::convertToGeoJson($this->uploadedKml($kml));
$this->assertNotNull($g);
$this->assertCount(2, $g['features']);
$this->assertEquals('Point', $g['features'][0]['geometry']['type']);
}
public function test_kml_with_google_earth_namespace_still_yields_features(): void
{
// Este era el bug: xpath //kml:Placemark fallaba con este xmlns.
$kml = '
Pilar 1-3.7,40.4
';
$g = SpatialFileConverter::convertToGeoJson($this->uploadedKml($kml));
$this->assertNotNull($g);
$this->assertCount(1, $g['features']);
$this->assertEquals('Pilar 1', $g['features'][0]['properties']['name']);
}
public function test_kml_without_namespace_still_yields_features(): void
{
$kml = '
Muro
-3.7,40.4 -3.6,40.5
';
$g = SpatialFileConverter::convertToGeoJson($this->uploadedKml($kml));
$this->assertNotNull($g);
$this->assertCount(1, $g['features']);
$this->assertEquals('LineString', $g['features'][0]['geometry']['type']);
}
}