-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add documentation about OSM adapter or some examples #3
Comments
Here https://github.com/tyrasd/osmtogeojson is JS library, that do this "magic", and it is used on Overpass Turbo frontend. |
Now I've solved this task via launching Node.js script from PHP via subprocess: use Symfony\Component\Process\Exception\ProcessFailedException;
use Symfony\Component\Process\Process;
function osmToGeojson(object $element) {
// Needs the `yarn global add osmtogeojson` system action.
$process = new Process(['osmtogeojson']);
$process->setInput(json_encode($element));
try {
$process->run();
$output = $process->getOutput();
$elementGeojson = json_decode($output);
}
catch (ProcessFailedException $exception) {
throw new \Exception('Error converting OSM element to GeoJSON using osmtogeojson executable', 0, $exception);
}
return $elementGeojson;
} But this is disgusting solution :( |
OSM adapter was an initial attempt, which I never completed. Beyond that I really like OSM, converting its data is full of difficulties. I mean for example the closed way conversion which depends on tagging. Unfortunately I have less and less time for my OSS projects, but if someone would work on improving OSM adapter, I would happy to help. I don't remember the details about the completeness, but I left comments in OSM.php:
But you can give it a try. Just use the usual |
In PR phayes#125 you've described the OSM adapter feature, can you please explain what it is and how to use it?
I'm searching the way to convert OSM relation object (from Overpass reply with
geom
) to GeoJSON or WKT, to get boundary polygon - is it possible with your improvements? If not, can you recommend me other PHP libs, that can do this? Thanks!The text was updated successfully, but these errors were encountered: