Importing official administrative boundaries

We’ve got raster image of the administrative boundaries.

The data is here: http://www.wisdom.weizmann.ac.il/~dmitryb/moin/
http://www.wisdom.weizmann.ac.il/~dmitryb/moin/gvulot_shiput_OSM.jpg : the raster
http://www.wisdom.weizmann.ac.il/~dmitryb/moin/gvulot_shiput_OSM.jgw : the geographical calibration
These two files are what was originally sent by the MoIn.

http://www.wisdom.weizmann.ac.il/~dmitryb/moin/shiput.tiff : I merged the two above into GeoTIFF and added the spatial reference (Israel Grid EPSG:2039)
Source: Ministry of Interior
Updated: August 2010
Terms of use: unrestricted.

Before starting to trace, I see several issues which should be settled.

  1. How to overlay? From my experience, the only feasible way to have this raster in JOSM is by installing a local WMS server and pointing JOSM to it. Importing the image directly into JOSM (via ImportImage plugin) eats up all the memory and eventually causes a crash.
    I am still looking for a way to make the TIFF transparent.

  2. How to tag? First, it’s about time to settle the admin_level values. My proposition:

2 - National border
3 -
4 - District (Mahoz)
5 - Sub-district (Nafa)
6 - Natural Region (Ezor Tiv’i)
7 - Metropolitan Area? - there are only three of those: Tel-Aviv (Gush Dan), Beersheva and Haifa
8 - Cities/regional councils. This is what appears in the raster.
9 -
10 - Municipal subdivision (Shkhuna)

Now we trace the lines from the raster and tag them:

  • boundary=administrative
  • admin_level=8 (except when this is also a higher-level boundary, such as a District or state border)
  • source: MOIN
  • date: 08/2010

Then we create a boundary relation with admin_level=8 for each named area in the raster. Select its “outer” members, optional “inner” members and an optional “admin_centre” node. Add name:* tags.

3). Higher-level boundaries. An approximate district and sub-district boundaries can be found here. The district borders are exactly on top of what we have from MOIN (they confirmed this), so there should be no problem having these as well. This is not the case for sub-districts, so perhaps we should leave them for now.

dimka

Wow!!!
That’s GREAT news!
Hopefully, this is only the first in many donations.

There are several ways of doing it.
I think the easiest is to have it as a background, e.g. in Potlatch2.
Need to cut the whole image into 256x256 pixels squares, and align them.

The easiest is to decide on a zoom level, say 14, and look at some key tiles, and align according to them.

Then we need to name the tiles according to the standard (zoom level, x, y)
Actually, only one dimension. The other 2 are directories, or using underscores and put it all in the same directory.

And then it would be easy to have as a custom background.

talkat.

I can do the graphical cutting. Will not take that much time I think.
Maybe the source image needs to be zoomed before cutting, so you will have a higher zoom level?

Another option is to set up a WMS server. It’s really easy with Geoserver, takes 10 minutes and works out of the box. I have already done this on my local machine, unfortunately I am behind a firewall so it’s no good for others.
Then you would point Potlatch to something like “http://localhost:8080/geoserver/wms?

  1. I’ve added an entry for Israel here.
  2. I’ve added Northern District here: http://www.openstreetmap.org/browse/relation/1375620

It seems that Potlatch doesn’t support WMS, so that’s not an option.

I’m now trying to generate tiles automatically using Geoserver. If successful, I will put them online.

I would like to point again on the Palestine authority border issue:
=> http://forum.openstreetmap.org/viewtopic.php?id=8475

Please discuss there how to continue with that issue.
we have to solve that one day.

Good luck!

I can try and write some script that creates these tiles.
This script would be reusable if/when we get an updated version of this file.
I know this file change once in a while, when municipalities are formed or merged one into another.

If jpg/jgw combination is the standard, then we could use this script in future imports as well.

talkat.

My biggest problem right now is: what is the naming scheme for tiles which Potlatch understands?
I managed to produce beautiful tiles which can be overlayed on Google Maps, but not in Potlatch.

Slippy map tilenames

talkat.

OK, here goes:
set in Potlatch a custom background with the following:
http://www.wisdom.weizmann.ac.il/~dmitryb/moin/tiles/!/!/!.png

You can also browse the whole thing via SlippyMap:
http://www.wisdom.weizmann.ac.il/~dmitryb/moin/tiles/openlayers.html

I’ve generated up to zoomlevel 13 in the meanwhile, I will set up my laptop to generate L14 during the night :slight_smile:

Enjoy!

Wow! Thank you!

Here are the instructions for use in Potlatch2:

Click on the arrow next to “Background”
Click on the “Edit…” button. You’ll get a “Background imagery” popup window.
Click on “Add” (bottom right), a new line will be added, and edit it as follows:

(new name) => MOIN (or any other name you like)
(new URL) => http://www.wisdom.weizmann.ac.il/~dmitryb/moin/tiles/$z/$x/$y.png

Close the window.

Now you can choose this background on the “Background” drop-down menu.

talkat.

Now we also have zoom 14. Please tell me if you need more.

dimka

Zoom Level 14 is great. Thank you!

talkat.

I have played a little with automatic vectorising before and I decided to try my old vectoriser on the .jpg file with the borders. The results are very bad, probably useless, but if you’re curious, I have put up some files to look at:

http://openstreetmap.pl/balrog/borders-no-labels.png ← this is the input bitmap I supply to the vectoriser, note that I filled all the labels with orange colour to avoid artifacts.

http://openstreetmap.pl/balrog/b0.osm ← this is the result with orange colour treated like white.
http://openstreetmap.pl/balrog/b1.osm ← this is the result with orange colour treated like blue.

These results are so bad because the parameters are adjusted for a different task (I had building outlines at very very high resolution, so the vectoriser ignores short segments, and tries to find right angles everywhere, even if there aren’t any). I will play with the parameters a little tomorrow, today I spent all the time trying to get the EPSG:2039 projection right.

Thank you very much for your effort! It would be interesting to compare your automatic results (when successful) with our manual tracing.

Thank you balrog-kun!

Dimka, could you ask MOIN for an image file without the names?
Sometimes the names are in the way, like in Abu Gosh / Kiryat Yearim.
We could trace on the nameless file, and use the names from the named file, switching between the2 overlayes.

The nameless file could be used by balrog-kun to get better results.

talakt.

Thanks for your comments.

I now basically removed all of the building-related postprocessing and now the results are a little better, I don’t think it’s possible to do this better except for manual tracing.

Note that the blue lines have a width of 7 pixels, so they are polygons and it’s difficult to calculate only the centrelines (I think it’s impossible).

http://openstreetmap.pl/balrog/b2.osm ← this is all of the blue lines traced.
http://openstreetmap.pl/balrog/b3.osm ← same as above with a 3.5pixel offset added.
http://openstreetmap.pl/balrog/b4.osm ← same with a -3.5px offset (the detection of “in” and “out” is not always working, so some shapes get offset in the wrong direction… in effect for some areas this file is better and in some areas the previous file is better)

When the administrative borders run along streams (e.g. Beit Gamliel). What is more accurate, the borders based on the raster image you got, or the natural borders. And if the latter is true, should we correct them?