proj icon indicating copy to clipboard operation
proj copied to clipboard

I need register more epsg code and string?

Open pampa0629 opened this issue 4 years ago • 4 comments

In the source of "Convert.go", the default epsg codes just have three, including EPSG3395, EPSG3857 and EPSG4087. I need use more. so I add Register function, the source code like :

func Register(dest EPSGCode, projString string) { cacheLock.Lock() projStrings[dest] = projString cacheLock.Unlock() }

pampa0629 avatar Mar 11 '21 03:03 pampa0629

I will add WGS84 support first, can you add it like your code?

roggen-yang avatar Jul 21 '21 09:07 roggen-yang

WGS84 support is already available:

https://github.com/go-spatial/proj/blob/7d903f0bc4374936d721348601c42ad2930b20df/Convert.go#L25-L34

ARolek avatar Jul 21 '21 22:07 ARolek

var projStrings = map[EPSGCode]string{ EPSG3395: "+proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +datum=WGS84", // TODO: support +units=m +no_defs EPSG3857: "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0", // TODO: support +units=m +nadgrids=@null +wktext +no_defs EPSG4087: "+proj=eqc +lat_ts=0 +lat_0=0 +lon_0=0 +x_0=0 +y_0=0 +datum=WGS84", // TODO: support +units=m +no_defs }

in this map, there are only three codes support

roggen-yang avatar Jul 22 '21 01:07 roggen-yang

Yep, you're right. I think the conversion support is from 4326 to these codes, but not the other way around.

ARolek avatar Jul 22 '21 23:07 ARolek