iOS : How to load Hebrew map? - ios

I am working on an app where i need to load hebrew map and also update map as location change and draw path from initial location to change location.
I have worked on apple map and google map. But i find some difficulty in loading israel country map on it. Is it possible to load such map on iOS? Any suggestions are most welcome!

To load hebrew map
Based from this SO question, Google Maps iOS SDK uses the system region/language settings but doesn't expose any way to manually force any particular language. Geocoding responses (using the SDK classes) and the map labels both reflect these device settings, thankfully.
Draw path from initial location to change location
You can use Polylines to draw lines on the map. A GMSPolyline object represents an ordered sequence of locations, displayed as a series of line segments. You can set the color of a polyline with GMSStrokeStyle.
To create a polyline, you'll need to specify its path by creating a corresponding GMSMutablePath object with two or more points. Each CLLocationCoordinate2D represents a point on the Earth's surface. Line segments are drawn between points according to the order in which you add them to the path. You can add points to the path with the addCoordinate: or addLatitude:longitude: methods.
Example:
GMSMutablePath *path = [GMSMutablePath path];
[path addCoordinate:CLLocationCoordinate2DMake(-33.85, 151.20)];
[path addCoordinate:CLLocationCoordinate2DMake(-33.70, 151.40)];
[path addCoordinate:CLLocationCoordinate2DMake(-33.73, 151.41)];
GMSPolyline *polyline = [GMSPolyline polylineWithPath:path];
You can check this related SO thread.
Loading israel country map
Check these links:
How to get country specific result with Google autocomplete place api ios sdk?
Is there a way to display a single country in Google map? It should be only one country, not parts from other countries included
Hope this helps!

Related

Customize GoogleMap from IOS API

I'm looking to customize the display of a Google map. Currently I'm using the 1.13.2 ios API but I'm fairly stuck. I need something close to mapType = kGMSTypeNormal but I must get rid of shaded areas, road names, and road numbers.
Can anyone tell me where I can get the source code for the ios API or suggest a strategy for removing these layers/views on the fly without modifying the source?
If someone knows anything better that Gmaps I'm open to suggestions. I must have building shapes and road icons as the app is designed to work with the building shapes. I'd use the Apple Map framework but it doesn't show the building outlines. Think Pokémon Go, but you are cataloging buildings.
The Google Maps SDK for iOS offers some simple ways for you to add shapes to your maps. You are able to modify the appearance of each shape in a number of ways.
The following shapes are supported:
A polyline is a series of connected line segments that can form any shape you want and can be used to mark paths and routes on the map.
A polygon is an enclosed shape that can be used to mark areas on the map.
A circle is a geographically accurate projection of a circle on the Earth's surface.
Polylines allow you to draw lines on the map. A GMSPolyline object represents an ordered sequence of locations, displayed as a series of line segments. You can set the color of a polyline with GMSStrokeStyle.
To customize a polylin, use GMSPolyline. It provides several properties to control the appearance of the line. It support the following options:
strokeWidth
strokeWidth
geodesic
spans
strokeColor
You can customize your map with one of several map types. A map's type governs the overall representation of the map. The Google Maps SDK for iOS offers the following types of maps:
Normal Value: kGMSTypeNormal
Hybrid Value: kGMSTypeHybrid
Satellite Value: kGMSTypeSatellite
Terrain Value: kGMSTypeTerrain
None Value: kGMSTypeNone
To set the type of a map, assign a new value to the GMSMapView.mapType property. For example, to display a satellite map type:
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.8683
longitude:151.2086
zoom:6];
GMSMapView *mapView = [GMSMapView mapWithFrame:CGRectZero camera:camera];
mapView.mapType = kGMSTypeSatellite;

Move a GMSPolyline in iOS

I have a requirement that in some cases a GMSPolyline be moved from one location to another. Here is the scenario:
A user opens a GMSMapView and creates a GMSPolyline feature.
Then the user changes the map position
The user taps a button to center the newly created polyline in the new view position, that is, the newly created line feature is moved to the center of the new camera view.
So far I can find no resources for how to do this. There are plenty of examples for creating and editing GMSPolyline features, but not finding one for moving the entire feature. Can anyone point me to an example for doing this?
Thanks!
You have to change the coordinates of all the locations that make the GSMPath that is the base of your GMSPolyline. For each location you can calculate the new point using GMSGeometryOffset, then you draw a new polyline.
Or you can use -(instancetype) pathOffsetByLatitude:longitude: of GMSPath on the GMSPath that describes your polyline.
You use one or the other according the data that you have available (as an example the start and end target of the GMSCameraPosition after a pan)

Drawing polyline in realtime

I'm fairly new to ios and I would like to know what would be the best approach to draw polyline on google map while user is on the move. So it would only show the path the user has traveled. I'm thinking about using current location as the destination and redraw the polyline as user moves.
EDIT : I'm not even sure if google map is the way to go for this particular scenario since this app is free and there will be fee for API call over 2500 times/day. Is it better to go with Apple Map?
Following these guidelines:
You need to create a GMSMutablePath and add the current user location. As the user moves you add more coordinates to the GMSMutablePath.
When you need to draw the line just instantiate a new GMSPolyline object and set the map property of the GMSPolyline removing the previously drawn polyline setting it's map property to nil.

Draw path in MKMapView using Google Map

I implement MKMapView in my application to draw a path between two place,i found all lat long between two point using google map API but it shows the path through road.
My problem is that i want to show the path in building,
For example:
I want to draw path between the gate1 to gate 2 of Building, i pass the "to and from" lat-long in to the google MAP API, it shows the path through road so it shows the wrong distance.
I tried the indoor map also but it works only in register buildings.

Google maps iOS SDK level of detail polylines

I am using the Google Maps iOS SDK to draw a list of polylines. The polylines come from a server, and for each next polyline, the starting point corresponds with the end point of the previous polyline.
I notice that Google Maps changes the level of detail of the polylines at different zoom levels, probably an optimisation thing. This results in small gaps between the several polylines at lower zoom levels.
The reasons behind splitting a polyline up in several smaller lines are not up to me, this is what the system defines for me. I know I may be able to combine the several polylines into one single large polyline, but I was wondering: does the SDK allow the setting for this level of detail? Or is there maybe another fix?
Zoomed out, notice the gaps:
Almost fully-zoomed in, the gaps are nearly gone:
I have found no answer so far, so what I did, was traversing all geo-coordinates in-order (luckily my data-structure allows this), collect them in an array, encode this array to a Google Encoded Polyline (GEP) as per https://gist.github.com/mmdumi/3999640, and then display this on the map using [GMSPolyLine polylineWithPath:]. As far as I can tell, there is no way to instantiate a GMSPolyLine other than using a GEP.
I have found no answer too, but, there are two ways :
You can draw the entire line like a for sentence and draw, for example :
path.add(CLLocationCoordinate2D(latitude: latitude_,longitude: longitude_))
let polyline = GMSPolyline(path: path)
polyline.strokeColor = .red
polyline.map = mapView
polyline.strokeWidth = 2
or
https://github.com/raphaelmor/Polyline

Resources