From maps to multimaps

⇠ Back to Blog:Hacks

I am migrating from Evan Miller's extension of Google Maps, which is now archived (obsolete) to Pavel Astakhov's version, MultiMaps.

This means that entries previously of the type:

(F) 51.491904,-3.172421, [[Cardiff]], {{thisday|24|February|2011}}.
47.997672,11.338183, Starnberg, {{thisday|26|February|2011}}.
47.972783,11.351294, Berg, {{thisday|26|February|2011}}.

should now read instead:


When you have 847 entries as we do on Our visits of the World page, a script is necessary to do that. The following regexp makes this translation:

cat list.txt | perl -pe 's/(\([EF]\))?\s*([+-]?\d+(\.\d+)?),\s*([+-]?\d+(\.\d+)?),\s*([^,]*),\s*(.*),*(\{\{.*\}\})(.*)/\2,\4~\6~\7\8\9~icon=\1.png;/g;' | sed 's/~icon=.png//g;' | perl -pe 's/\~icon\=\(F\)\.png/\~icon=F\.png/g;' | perl -pe 's/\~icon\=\(E\)\.png/\~icon=E\.png/g;'

where list.txt contains the list in the original format. It allows for an optional (E) or (F) before the coordinates and assume that a E.png E.pngand F.png F.pngicons are set for these locations, that are specific to Elena and Fabrice, respectively.

This otherwise assumes that the format is:

coord_x, coord_y, title, more text, {{thisday|day|month|year}} and more text.

with "more text" on the left of the date and "and more text" on the right optional.

Other type of entries can be hacked in one way or the other, for instance, without the date present, use this instead:

cat list.txt | perl -pe 's/(\([EF]\))?\s*([+-]?\d+(\.\d+)?),\s*([+-]?\d+(\.\d+)?),\s*([^,]*),*\s*(.*),*(.*)*\./\2,\4~\6~\7\8~icon=\1.png;/g;' | sed 's/~~/~/g;' | sed 's/~icon=.png//g;' | perl -pe 's/\~icon\=\(F\)\.png/\~icon=F\.png/g;' | perl -pe 's/\~icon\=\(E\)\.png/\~icon=E\.png/g;'