1

I'm developing an indoor map app. it's for ipad devices. I'm using objective-c.

I have an overlay inside a boundingMapRect, it’s an image (floorplan) from a PDF File.

It’s shown with the correct size.

but one issue for me is the origin for the rectangle.

i want the rect to be rotated a little bit because It’s not shown on top of the building i wanted.

Here is how it’s shown :

Current overlay

here is how i want it:

rotatedOverlay

is there a way to rotate the overly with a specific angle?

or can i rotate the mapView before adding the overlay to it so it can fit the overlay

Thank you,

miss h
  • 133
  • 1
  • 2
  • 15

1 Answers1

2

You can rotate the mapview before fitting an overlay to it using this code line:

self.mapView.transform = CGAffineTransformMakeRotation(x);

where x is float value of the angle.

I don't think this would solve your problem as the boundingMapRect property of MKOverlay protocol would still be getting the same latitude, longitude values. The best approach to solving this problem would be to create a complete image of the region to be shown in the map view.

Like this image from: http://www.raywenderlich.com/wp-content/uploads/2013/01/overlay_park.png

In this tutorial: Overlay Images and Overlay Views with MapKit Tutorial by Cesare Rocchi

source: https://www.raywenderlich.com/30001/overlay-images-and-overlay-views-with-mapkit-tutorial

a similar approach is used by the author.

I'm assuming here that you're trying to overlay the rectangle image on a map area which is not exactly rectangular in shape. You can check that from your latitude, longitude values (It's a rectangle only if the bottom right value can be derived from top right and bottom left latitude, longitude values).

Thirteenth
  • 41
  • 1
  • 10