Skip to content

Instantly share code, notes, and snippets.

@tomscholz
Last active August 13, 2016 00:15
Show Gist options
  • Save tomscholz/defaa75b7bcb3f2b21b5f047acdd8f77 to your computer and use it in GitHub Desktop.
Save tomscholz/defaa75b7bcb3f2b21b5f047acdd8f77 to your computer and use it in GitHub Desktop.
Remove specific properties easily
<?php
$raw = json_decode(file_get_contents('map.geojson'));
$output = new stdclass;
$output->type = "FeatureCollection";
$output->features = array();
foreach($raw->features as $item) {
$item->properties->id = 0;
$new = new stdclass;
$new->properties = $item->properties;
$new->type = "Feature";
$new->geometry = $item->geometry;
$output->features[] = $new;
}
file_put_contents('without-spezefic-property.geojson', json_encode($output));
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment