andrzej zaborowski wrote:

> There's a dummy script at
> http://repo.or.cz/w/ump2osm.git/blob/HEAD:/osm-merge to do that (would
> need to be modified for >2 layers).  

Here is my updated version of osm-merge.sh

I also changed it to process files using double-quotes " " as I get from
shp-to-osm.jar


--------------------------------------------------------------------------

#! /bin/bash
# Copyright (C) 2009  Andrzej Zaborowski
#
# Merge two .osm files without applying fancy logic (JOSM merge layers
# operation tries to be too smart and corrupts data - see bug #2245)
#
# Updated 2010-07-11 by Alan Millar - accept more than two files
#     Process double-quotes

if [ $# -lt 2 ]; then
  echo Usage: $0 a.osm b.osm ... \> new.osm >&2
  exit
fi

echo "<?xml version='1.0' encoding='UTF-8'?>"
echo "<osm version='0.6' generator='$0'>"

FileNumber=0

while [ $# -gt 0 ]
do

  echo "File $FileNumber $1" 1>&2

  cat "$1"      \
  | grep -v -e '<osm' -e '<?xml' -e '</osm'     \
  | sed -e 's/id="-/id="-'$FileNumber'000000/'  \
        -e 's/ref="-/ref="-'$FileNumber'000000/'

  FileNumber=` expr $FileNumber + 1 `
  shift

done

echo "</osm>"

--------------------------------------------------------------------------

- Alan



_______________________________________________
Talk-us mailing list
Talk-us@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk-us

Reply via email to