You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I experiment some kind of memory leak when converting coordinates for multiple times.
Do you see any issues with this code?
PHP 8.0.6
PHPCoord 4.3
Datapack Europe 1.0
require_once __DIR__ . '/vendor/autoload.php';
use PHPCoord\CoordinateReferenceSystem\Projected;
use PHPCoord\CoordinateReferenceSystem\Geographic2D;
use PHPCoord\ProjectedPoint;
use PHPCoord\UnitOfMeasure\Length\Metre;
function convertCoord($easting, $northing)
{
$crs = Projected::fromSRID(Projected::EPSG_AMERSFOORT_RD_NEW);
$from = ProjectedPoint::createFromEastingNorthing(
new Metre($easting),
new Metre($northing),
$crs
);
$coords = (string) $from->convert(Geographic2D::fromSRID(Geographic2D::EPSG_WGS_84));
$coords = explode(",", trim($coords, '()'));
$lonlat[] = floatval($coords[1]);
$lonlat[] = floatval($coords[0]);
return $lonlat;
}
function getPointLonLat()
{
// of course below will be variables, but I experience the issue even calling this function multiple times.
$x = 94904.701655864;
$y = 467709.4147013;
$lonlat = convertCoord($x, $y);
return $lonlat;
}
The text was updated successfully, but these errors were encountered:
Thanks. I couldn't reproduce the error standalone.
Probably a combination with loading a large file and getting the UnknownConversionException error. Which I could solve by passing the true, to the convert method: $from->convert(Geographic2D::fromSRID(Geographic2D::EPSG_WGS_84), true)
I experiment some kind of memory leak when converting coordinates for multiple times.
Do you see any issues with this code?
PHP 8.0.6
PHPCoord 4.3
Datapack Europe 1.0
The text was updated successfully, but these errors were encountered: