GPS Location on custom map - iphone

Is there a way to map the user's current location on an image view?
I have an map image of small area, and want to display the current location on it. Is there a way to calculate location on image from GPS coordinates?
Thanks

You need lat/long references on the image to do it. Either two corners or edges. Then you interpolate the user coordinates onto the image using the references.

Related

Detect when an image touch a building

How can I solve that I put an image on a certain coordinate and send message to console if the image touch any building?
Interesting question. I think you can achieve this as follows:
Use a Marker to add the image to a location (see https://docs.mapbox.com/mapbox-gl-js/example/custom-marker-icons/ )
Given the HTML element for the marker, el, use getBoundingClientRect() to find the pixel positions of it, relative to the viewport.
Do some maths to find those positions relative to the map.
Call map.queryRenderedFeatures() with those positions, to detect if there is any building within the area of the marker image.

Apply Masking in Bing Map AJAX

I am trying to overlay an image in bing map and then mask certain parts of the image.I tried the below link and I could overlay the image. However my next step is to mask.I want the image of a particular region and not a entire rectangular image.
http://blogs.bing.com/maps/2013/05/22/image-overlays-with-bing-maps-javascript/
Any inputs on this? Does Bing Map have coordinate based masking.
Thanks!

draw route on static image map iphone

I'm developing a campus navigation app.
I have an image which displays building on the campus.
I want draw a route from the user location to destination building the use wants to go.
Wondering how to draw a route on static custom image.
Been searching on internet but cannot find any clue how to develop.
All documentation on internet are about drawing route on Google map.
any hint will be much much appreciated.
You'll have to manually collect latitude and longitude information for each of your map image's four corners. You'll also have to manually specify, in terms of co-ordinates on the image, the position of every possible turning point in the building's corridors, stairs etc. Then you can get the device's current latitude and longitude (see the Location Awareness Programming Guide), translate it into a position on your image, and overlay a transparent view with a red line on it stopping at each of your manually collected waypoints. There remains the graph theory problem of finding the shortest route through the network of waypoints. I suggest the A* algorithm.

How to check user is located in between the coordinates, MKMapview

I had userlocation and a boundary.
And the boundary has 8 oordinates.
I need to check wether the user is in the boundary or not.
Am using mapview in iPhone.
Thanks in advance.
A way to do this using some built-in functions in Map Kit are to add your boundary as an MKPolygon overlay to the map view. Keep a reference to the overlay as an ivar.
Then whenever you want to check if user is inside the boundary (for example when user's location changes), convert the user coordinates to a CGPoint and retrieve the CGPath for the boundary and call CGPathContainsPoint. There are Map Kit functions to do these conversions.
This previous answer of mine gives an example of how to add an MKPolygon overlay and this one has an example of the CGPathContainsPoint part.
You can use the Point Inclusion in Polygon Test to check whether the users location is inside or outside the boundary (polygon).

Putting GPS current location and pin annotations on a UIImageView

I am making an iPhone app for a local college. I am currently trying to take a drawn map of the campus and put pin annotations on it. I also want to be able to show the users current location on this map image. Right now I just have a UIImageView inside of a UIScrollView. It can currently scroll and zoom in/out. How would I go about accomplishing this? I have searched everywhere for an answer and can't seem to find a solution (or have overlooked it). Am I going in the right direction? Thanks for your help.
You would have to come up with a function to translate latitude and longitude into pixel offsets in the image. Assuming the campus is relatively small compared to the Earth (so you can ignore the planet's curvature), this should be a simple matter of determining the coordinates of the four corners of the image and interpolating.