Sign up ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have a GPX-Track containing LatLon coordinates based on WGS84. The track should be drawn on a cropped map, and for this, I need the pixel coordinates. The map tiles are from OSM

I'm not quite sure how to do this, but I figured out a way (without implementing it yet, since I don't have the formulars right now).

  1. Convert LatLon to Spherical Mercator which is used by OSM
  2. Linear transformation spherical mercator -> pixel coordinates. For step 2., 2 identical points are needed. I guess I can use the map's corner points.

Is there a better way to do this?

share|improve this question

1 Answer 1

up vote -1 down vote accepted

Solved the Problem. Code here:

share|improve this answer

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

The link is broken, and in any event, link-only answers are of limited use, so I recommend including the solution in your answer. – PolyGeo Oct 8 at 22:29

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.