#๐Ÿ”’ Pixel coordinates to GeoCoordinates transformation

17 messages ยท Page 1 of 1 (latest)

vale igloo
#

Hi guys!

I'm working with on an application that leverages the mapbox Static Images API and the Datasets API. My application will perform inferncing on the static images received to generate bounding boxes that will correspond to various locations on the map.

My goal is to convert the pixel positions (e.g., the center of each bounding box) into latitude and longitude coordinates so I may create a dataset from it. I know the pixel coordinates of the image's four corners, zoom level and dimensions.

What would be an appropriate way to do this conversion? Are the any libraries/SDKs by Mapbox or third-parties in the Python language that can help me apply this kind of pixel-to-GPS mapping with Mapbox static images?

lethal shadowBOT
#

@vale igloo

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

dapper pond
#

center_x = l + ((r - l) // 2)
center_y = t + ((b - t) // 2)

You'll have to be more specific about how zoom comes into play.

vale igloo
#

Although there are some approaches that do not use zoom

dapper pond
#

You're going to need to back up and explain the entire problem

#

I've got a few ideas, one I think you'll like

#

But I need to make sure I understand

vale igloo
#

yeah sure what are you confused about?

dapper pond
#

So you have some area which corresponds to your world space

#

Your entire coordinate system (presumably 2D)

#

And you want to be able to overlay an image at arbitrary size and determine which coordinates are being covered by the image?

vale igloo
#

umm. Essentially I use mapbox static images api. This link can help you better visualize https://docs.mapbox.com/playground/static/.
I get an image from a satellite view of some relatively small area. This api already gives me the lon/lat of the center point in that image. Then in that image, through a model bounding boxes are generated for particular objects. Now I want to find out the lon/lat of the center of each of those bounding boxes.

Mapbox

Generate an image of a map using the Mapbox Static Images API. Specify the map style, coordinates, zoom level, image size, and more.

#

hopefully that gives you a better understanding

lethal shadowBOT
#
Python help channel closed for inactivity

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.