Show only polyline - ios

I am working on an activity tracker, at the end of the activity I have a map where I draw the polyline of the users route, I want to show only the polyline or at least draw a shadow in the map like Nike+Run does, anyone know if that's possible?, I already searched but I couldn't find out how to do it.
Edit:
Something like this

What you are looking for is MKPolyline. Here is the documentation https://developer.apple.com/reference/mapkit/mkpolyline and this tutorial might be helpful to implement http://pinkstone.co.uk/how-to-draw-an-mkpolyline-on-a-map-view/. Its in Obj C should be easy enough reimplement in Swift.

Related

Vuforia hide marker

Suppose you have a marker for your Vuforia AR application and when the digital object appears, you want to hide or cover the marker, like so:
https://youtu.be/eTLr8mN3_yw?t=15
Any ideas on how to do it?
You can think of this as one of those coloring book AR examples. Rough explanation would be reading the colors of fingers and wrapping around the target with that color.
Take a look at here https://github.com/maximrouf/RegionCapture

Simple marker clustering on apple map

Hello I want to do Pin point's clustering on apple map. What is the possible solutions of it.Now the apple map with one pin point is display on my screen. What is the code after it for Pin point's grouping. Thanks in advance
A possible (and successful, I'm using it at work) solution for clustering/displaying lots of points on a map is
http://robots.thoughtbot.com/how-to-handle-large-amounts-of-data-on-maps

The best way to create animation diagram

I'm trying to create something like this:
I looked many resources for that, but I still don't have idea how can I do it. Using CoreAnimation, Quartz2d or UIBezierPath I can draw a circle, but how can I draw a nice diagram with touch gesture's aid, using that? Maybe I wrong searched? If any tutorial, or sample code for this issue?
Best and easy library I used to draw pie chart with animation; MIM Chart Library for iOS
https://github.com/ReetuRaj/MIMChart-Library
Open source.
OK, CoreAnimation is not what you're looking for with this.
Anyway...
If you want to make a nice Pie Chart then you should take a look at CorePlot.
It has a lot of graphing functions and pie charts are in there too.
You can still animate with this you just need to update the percentages based on touch. Don't try to animate the sections of the circle. Change the percentages and update the circle.
Looks like you are trying to do some charts & plotting. If that is so, there is something called as
Core Plot
ILGraphics
OVGraphView
Some controls as well
Hope that helps.

Creating a new MKPolygon from two intersecting polygons

I know that there is exactly one specific question that talks about this but its a bit old and I wanted to get a little more technical about it if possible.
First of all take a look at this screenshot: https://www.dropbox.com/s/f94q3qaxrog0ec9/intersections.png
Want I want to have happen is say "I see where they both intersect and where that happens I do not want to draw those 'parts' of the polygon". In this case i would like to draw both polygons but not draw the 'path' of the yellow polygon that is inside the orange polygon. This include not only the line but the fill color as well.
Obviously this gets tricky because you aren't always going to have exact points along the path of each polygon that intersect exactly with other points along another polygon path. As you can see from this screenshot, in order to make this possible, I think, I need to get the points back where they do intersect.
After that and assuming that I can do this, I do not know if there is a way to use the CGPathRef class to do what i need to do. Obviously I am going to have re-create a polygon but according to the docs you cant fill it in unless it is a closed path. So how do you fill in the polygon that is not interesecting without closing the path??
The only thing that i can think of would be to "hide" the parts of the polygon that intersect but unsure how to do this. Can anyone offer any help/insight to this problem??
Here you go. I wrote an Objective-C wrapper around Alan's GPC library. Check out MKPolygon-GPC
Ok guys! well i went off and created my own MKPolygon category to solve what i needed to solve. I hope it is also useful to others!
the github link is: https://github.com/geeksweep/MKPolygon-GSPolygonIntersections
After days of investigation, here is the solution I found for Swift 4:
1) Go here and clone the project
2) Drag and drop the following in your project:
- MKPolygon+GPC.m
- MKPolygon+GPC.h
- gpc232 (folder)
3) Create a bridging header (here is a tutorial)
4) Open your bridging header file and add the following :
#import "MKPolygon+GPC.h"
5) In your View Controller , use this method to union your two Polygons :
let mergedPolygon = polygon1.fromUnion(with:polygon2)
NOTE : there is a crash in the current library, I fixed it but I am waiting my pull request to be reviewed. Thanks to SunGard-Labs for the framework !

How to get MKPolylines follow the roads properly in MKMapView (iOS)?

)
I'm trying to put a direction polyline on a MKMapView in my iOS project, using Google Directions API. I used the code found in this blog : http://iosguy.com/2012/05/22/tracing-routes-with-mapkit/ , which works quite well.
But the problem I find is that the polyline do not follow the roads, instead it draws lines straight from one point to another :-(
Can anyone please help me to make it follow the roads ? Thanks :-)
Instead of using the coordinates of the route steps, you can use the *overview_polyline* element of the Google Directions response to draw a smooth line following the roads. You can use this code to decode the polyline string: https://gist.github.com/3770235
edit: I erroneously made the assumption you where using the steps coordinates, as that is usually the cause of these straight lines, but the link you post already uses the *overview_polyline*. In that case my answer is probably not solving your problem. Decoding the polyline as a category on MKPolyline could be a nice addition to your code though.

Resources