Code Monkey home page Code Monkey logo

xutil's People

Contributors

cmitchell avatar xvill avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

xutil's Issues

find a bug


// MercatorToBd09 墨卡托坐标转百度经纬度坐标
func MercatorToBd09(x, y float64) (float64, float64) {
	cF := []float64{}

> tempY := math.Abs(y)

	for cE := 0; cE < len(_mcband); cE++ {
		if tempY >= _mcband[cE] {
			cF = _mc2ll[cE]
			break
		}
	}
	return yr(x, y, cF)
}

// Bd09ToMercator 百度经纬度坐标转墨卡托坐标
func Bd09ToMercator(lng, lat float64) (float64, float64) {
	getLoop := func(lng float64, min, max float64) float64 {
		for lng > max {
			

> lng = lng - math.Abs(max-min)

		}
		for lng < min {

>lng = lng +  math.Abs(max-min)

		}
		return lng
	}
	getRange := func(lat float64, min, max float64) float64 {
		return math.Min(math.Max(lat, min), max)
	}

	cE := []float64{}
	lng = getLoop(lng, -180.0, 180.0)
	lat = getRange(lat, -74.0, 74.0)
	for i := 0; i < len(_llband); i++ {
		if lat >= _llband[i] {
			cE = _ll2mc[i]
			break
		}
	}

> 	if len(cE) == 0 {

		for i := len(_llband) - 1; i >= 0; i-- {
			if lat <= -_llband[i] {
				cE = _ll2mc[i]
				break
			}
		}
	}
	return yr(lng, lat, cE)
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.