[GIS] How to get bounding box coords

georeferencinggoogle mapsjavascriptweb-mapping

How to get coords for NW and SE if we have about 4-5 pixels on the image with assigned latit/longit? I'm working on javascript app which would overlay that image on Google Map then.

Thanks.

Best Answer

Man, you show no own effort... when I read your previous question I knew you would ask this... based on the restrictions you make (e.g. no rotation, just scaling and shifting), you have to write set of equations for the 4-5 corresponding points, using the scale and shift parameters. Then you have the parameters for which the reference points fit best. For this you solve the equations e.g. like regression (if you have more equations than parameters), so minimize the error with least squares estimation. You can use some statitistics library for it but in javascript I doubt it exists. I would solve it manually by putting second derivation of all parameters as zero. This would give me another set of equations to solve. When you have the parameters it is easy to compute the NW and SE coords. This is quite simple math but if you don't have the background to do this, ask on https://math.stackexchange.com/

Related Question