[josm-dev] [PATCH] Hack to make TIGER editing easier
Dave Hansen
dave at sr71.net
Sun Dec 2 23:08:27 GMT 2007
Virtually all of the TIGER data has a tag like
"tiger:tlid" = "1234:5678"
including nodes. When I merge nodes, I spend a lot of time combining
the tags like this:
"tiger:tlid" = "1234:5678"
+
"tiger:tlid" = "33:22"
=
"tiger:tlid" = "1234:5678:33:22"
So, here's a quick JOSM hack to do it. Is there a way I could
generalize this so that other people could do similar things? Perhaps
in a plugin?
--- src/org/openstreetmap/josm/actions/MergeNodesAction.java (revision 479)
+++ src/org/openstreetmap/josm/actions/MergeNodesAction.java (working copy)
@@ -169,7 +169,23 @@
Map<String, JComboBox> components = new HashMap<String, JComboBox>();
JPanel p = new JPanel(new GridBagLayout());
for (Entry<String, Set<String>> e : props.entrySet()) {
- if (e.getValue().size() > 1) {
+ if (e.getKey().equals("tiger:tlid")) {
+ TreeMap tlids = new TreeMap();
+ for (String tlid_list: e.getValue()) {
+ for (String tlid_str: tlid_list.split(":")) {
+ Integer tlid = new Integer(tlid_str);
+ tlids.put(tlid, 1);
+ }
+ }
+ String combined = "";
+ for (Object _tlid : tlids.keySet()) {
+ Integer tlid = (Integer)_tlid;
+ if (combined.length() > 0)
+ combined += ":";
+ combined += tlid;
+ }
+ newNode.put(e.getKey(), combined);
+ } else if (e.getValue().size() > 1) {
JComboBox c = new JComboBox(e.getValue().toArray());
c.setEditable(true);
p.add(new JLabel(e.getKey()), GBC.std());
-- Dave
More information about the josm-dev
mailing list