Panama/Protected Areas

From OpenStreetMap Wiki
Jump to navigation Jump to search

we have a page offering a summary, here it's for the procedure.

respecting guidelines for organised edits

  • this is about importing limits of protected areas, from the 'gazeta oficial'
  • this activity was discussed in the Panama Telegram Group,
  • hashtag is #panama-ap
  • this activity has no limit date
  • needs Linux, tesseract, some practice with bash and regular expressions, JOSM. all is software libre
  • you better use Debian, or be prepared to interpret instructions

How do I insert the bounds of a Panamanian protected area?

when a protected area gets established, or modified in Panama, this is published in the "gaceta oficial", and this is not only retrievable, but the contained information is put in the public domain. this makes import possible. the following procedure is reasonably repeatable, it assumes you have a unix operating system (GNU/Linux or OSX), it won't work on Windows.

  • get the pdf of the "Gazeta Oficial"
    where is it? copy it to `gaceta.pdf`
  • split the pdf into as many files as the pages
pdfseparate gaceta.pdf /tmp/go-%03d.pdf
  • convert each pdf into tiff
for f in /tmp/go-*.pdf; do convert -density 300 $f -fill white -draw 'rectangle 10,10 20,20' -background white -flatten +matte -depth 8 /tmp/$(basename $f .pdf).tiff; done
  • extract the information in text format
for f in /tmp/go-*.tiff; do tesseract $f /tmp/$(basename $f .tiff); done
  • join all the text files into a single file
cat /tmp/go-*.txt > /tmp/go.txt
  • look for the first point in the text and delete all that precedes.
  • look for the repetition of the first point (closing the loop) and delete all that follows.
    these two last steps leave a /tmp/block.txt file
  • now scan for the Este or Norte coordinates, they may be given in several different formats:
    • WGS 84 UTM 17N.
    • latitude / longitude.
    • initial point, then polar relative (direction / distance).
    • some sections may be given as "follow an existing feature", like a river, a road, or even keep this specified distance from the coast.
  • remove headers and footers, and join all the lines in the document.
  • depending on the format, extract all the relevant information. for exampe, a possible UTM case:
grep -o '\(Punto ...[0-9]*\|\(Este\|Norte\) [0-9][0-9][0-9][0-9][0-9][0-9]\.[0-9][0-9]\)' /tmp/block.txt > /tmp/coordenadas.txt
  • fill in the blanks, adding the missing Point numberings.
  • now convert the coordinates into latitude / longitude.
    there's tools for it.
  • "finally" produce the polygon, a osm file.

we are by far not done yet! we now need to join this information with the existing elements in the OSM map.

this is manual work. you need to grab again the gaceta, and check which segments are straight lines (no action needed) and which should follow natural or man-made elements. these may be already present, or need to be mapped.