jonasstein / scanaerial

Fuzzy Select plugin for JOSM
44 stars 12 forks source link

Support of EPSG:3301 (inverted coordinates) #9

Open OverQuantum opened 11 years ago

OverQuantum commented 11 years ago

Need support of projection EPSG:3301 For tracing trace Maaamet map from kaart.maaamet.ee, it works only in projection EPSG:3301

My attempt to add support by myself failed on inverted tile order. 1) Set up scanaerial.cfg: wms_server_url = http://kaart.maaamet.ee/wms/kaart?FORMAT=image/png&VERSION=1.1.1&SERVICE=WMS&REQUEST=GetMap&LAYERS=MA-KAART&STYLES=& projection = EPSG:3301 tile_sizex = 500 tile_sizey = 500

2) Added following to projections.py: "EPSG:3301":{ "proj": pyproj.Proj("+proj=lcc +lat_1=59.33333333333334 +lat_2=58 +lat_0=57.51755393055556 +lon_0=24 +x_0=500000 +y_0=6375000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs"), "bounds": (57.5700, 21.8400, 59.7000, 28.0000), }, 3) Changed a<=>c in bbox forming in canvas.py into: return self.wms_url + "width=%s&height=%s&srs=%s&bbox=%s,%s,%s,%s" % (self.tile_width, self.tile_height, self.proj, c, b, a, d)

4) Result look like this: Clip031 I assume, tiles needed to be mirrored horizontally.

jonasstein commented 11 years ago

something strange seems to happen with the decimals. You could try to print() the variables in the calculation.

OverQuantum commented 11 years ago

Actually, I have managed to mirror tiles by tile_data = tile_data.transpose(Image.FLIP_LEFT_RIGHT)

but looks like requested tiles are very tall, here is log with added printing of remote var: c:\Python26\python.exe d:\Tools\JOSM\scanaerial\scanaerial.py 59.5026057047151 26.512555010267505 15 loading tile: http://kaart.maaamet.ee/wms/kaart?FORMAT=image/png&VERSION=1.1.1&SERVICE=WMS&REQUEST=GetMap&LAYERS=MA-KAART&STYLES=&width=200&height=200&srs=EPSG:3301&bbox=642263.403282,6598751.61279,642277.641735,6598800.07988 Download took 0.22230920063 sec could not be loaded, blanking tile could not be loaded, blanking tile loading tile: http://kaart.maaamet.ee/wms/kaart?FORMAT=image/png&VERSION=1.1.1&SERVICE=WMS&REQUEST=GetMap&LAYERS=MA-KAART&STYLES=&width=200&height=200&srs=EPSG:3301&bbox=642273.974168,6598751.61283,642288.212891,6598800.07984 Download took 0.187359594308 sec could not be loaded, blanking tile

And result looks like following: Clip035