In my application I can draw an overlay (PolyLine) on my map (MKMapView). This overlay however, is not bounded to actual roads. Is there a way (some API or others) to adapt the overlay so that it covers/overlays a real road.
The application is run on mobile devices (iPod Touch & iPhone), so to not make my app a very battery consuming one, I would set the Core Location Accuracy not to the highest. As a result, the location will be a bit next to the road where you are. Then I would still like my program to adjust this error...
To get an overlay that matches actual roads, I used Google Maps API Webservices. I already had an array of all points forming a route and I used these points (coordinates) to easily create an overlay that maps on real roads.
I used the first and last point to create a navigation between and set all the other points as 'waypoints', see Directions API
To find the nearest address of a point, I used the Geocoding API
Google Maps API Webservices: http://code.google.com/intl/nl-NL/apis/maps/documentation/webservices/
Related
I am using react-native-maps in my React Native project and I want the map to show only Germany and dhe user should zoom in and out up to a certain level but always withing Germany. I don't want the user to be able to navigate to other countries.
I checked the documentation but I didn't find anything related to my problem. Is there any way to achieve this? Thanks!
As far as I'm aware, you'll really need to 'bodge' this as it's not really true functionality of native maps.
You can limit the maxZoom level, to ensure that they cannot zoom passed a certain point - this will help with zooming. As for scrolling outside of a certain area - you can hitch onto the onDrag event, and check the lat and lon object. If the coordinates are outside a specific boundary, you can take the user back to a specified location - or present a user error? Geo fencing seems like it could be a part of this also.
Apart from theoretical - I'm afraid I've never done this, so cannot show you any implementation.
I'm working on an application for Android & iOS to show points of interest over the camera. ARkit & ARcore has poor compatibility nowdays.
Could you recommend me some library to do this? If it comes with an example, better! I know viro-media, but I don't understand how to do this using that library.
I don't want 3D models, just markers over the camera, similar to the attachment image.
To do this with Viro React -- and in AR in general -- the trick is to recognize that there are two coordinate systems:
The local coordinate system of your device, which we'll call 'AR space'. In Viro, this is centered at the user's initial position when the application starts, and is in meters.
Geographic coordinates (latitude and longitude).
To position the overlays, you have to convert your content from geographic coordinates into AR space. This is a two-step process. First project the spherical geographic coordinates onto a 2D plane -- the Web Mercator is great for this. Then translate the projected coordinates by the device's initial projected position.
The device's initial projected position can be derived by projecting its initial geographic position. In Viro React, you can use the Geolocation module to grab this when the user starts the app.
Finally, you'll need to do a similar transformation for the user's bearing: converting from compass direction to device orientation in AR space.
For this to work well you'll likely have to figure out how handle inaccurate geolocation lookups (e.g. what happens if the location retrieved from the device is inaccurate), and may also have to account for drift: over time the two coordinate systems may start to fall out of sync.
The last part, creating the info cards, is easy with Viro -- you either pre-bake the images with text and use ViroImage, or if the cards need to be more dynamic you can use a ViroFlexView.
I am also interested in this one and I'm trying out ViroReact!
I find a bit difficult to understand how to make this work when the lat's and long's have been converted to x-y-values. What should the z-value be?
Let's say you have the lat-lon coordinates [59, 10] as the user location you want to show where [59, 11] is relative to your location. How to you build that in a ViroARScene?
<ViroNode position={ **userLocationFromLatLonCartesian** }>
<ViroBox position={ **poiLocationFromLatLonToCartesian** }/>
</ViroNode>
So how do you calculate the scale, position and rotation, so that the object will be visible?
Seem like https://github.com/proj4js/proj4js is a library that could provide conversions from latlon to x-y values
I found that both android and ios AR sdk support location base AR View refererence:
https://developers.google.com/ar/develop/ios/geospatial/quickstart and https://developer.apple.com/documentation/arkit/argeoanchor
I am using Google maps in iOS using iOS SDK, letting users mark an area using few markers, creating a polygon.
I want to highlight that area and gray out the rest of the map, something like this:
Is this possible somehow?
You have to draw your own UIImage where you create the gray area, clear area, and polygon borders. After that add it as an overlay tile using GMSGroundOverlay. This will fix it in place for when the user scrolls.
https://developers.google.com/maps/documentation/ios/overlays
This is similar to how radar overlays are drawn for weather apps.
I would approach this problem using several steps.
1) collect your points from the user that will define your polygon.
2) send the collection of points to your server.(ajax post)
3) server side, dynamically create a grey image with a transparent hole in it that is your polygon.
4) store image on server, send back response with info telling browser how to retrieve it(url,id,whatever).
5) using javascript + google maps api, apply an overlay referencing your newly created image.
each step may have its challenges but the problem becomes manageable if you focus on the different steps.
1) and 2) will involve using javascript, capturing 'clicks' and having feedback to the user in the form of a line or something on the map. Once finished, the server call can be initiated by the user or by your programming.
3) I would use python with an image library(skimage, etc.) and a mapping library (gdal). Making an image is not hard but combining it with GIS and getting the right projection, etc. will take some fiddling.
4) shouldn't be a problem once you've got that far.
5) using zimmryan's comment about creating a ground overlay could be helpful for this step.
good luck!
I'm creating a simple Map application in Titanium Appcelerator, right now focusing only on iOS. I have 2 Annotations specified by the latitude and longitude. I want to draw the directions between the 2 points on the Map.
I see the
mapview.addRoute();
method on the MapView object, but it requires you to input all the points in the route to draw it properly?! That doesn't sound right at all - why would it require me to find all the points when the Google Map can do that already.
Is there a way that I'm missing to simply say "here's point A, here's point B, draw the route between the 2 points on the map".
Drawing routes on the map is nothing more than a vector drawing. The same does the mapsapp on your phone.
You will have to interrogate the maps apis for directions,get the directions (points) and use it in your code to draw the route.
If you don't want to do it yourself there is a free module in the marketplace that can help
https://marketplace.appcelerator.com/apps/2580?87150712
If you want to get your hands dirty, this post might help you:
http://developer.appcelerator.com/question/74221/mobile-map-route-from-google-server
I know that it's pretty complicated in earlier version, is there any new way around in ios 5.Regarding this i can get locations by using Core locations GEOCoder, But wanted to draw the route between them, also iOS 5 has the ability to show alternate routes for a single destination from the source.
Hope Some One Help Me
Note:I'm using Map kit and core location not UIWebView with Google API.
My Problem : Draw the route between two end location ( origin and destination ).
Development needs: iOS 5 sdk(which has the features to do so),Xcode 4.2.
UI Design : In my case it's very simple design. Two Input text fields and one button then MKMapView.
Frameworks : Map kit framework and Core Location frame work
Development Steps :Get Two Input locations Here i used the method geocodeAddressString: completionHandler: of Geo Coder class(from Core Location Framework) for getting the coordinates for the given location string(Available in iOS5)Used MkPoint Annotation object for creating annotation on the locations in mapThen sent a request to the google API for getting the Direction between two locationAs of the google API Response (Available in both JSON & XML) You would have overview_polyline object , which has the array of location coordinates. But they were encoded, you have to use the correct decoding module to get the latitude and longitude. with the decoded location coordinates you can create the poly lines using MKPolyline instance method. MKPolyline *polyLine = [MKPolyline polylineWithCoordinates:coordinates count:[overlayPoints count]];
[mapView addOverlay:polyLine]; Now the polyline have been drawn over the map still it will not be visible As the final go we have to override the viewForOverlay method for displaying the poly line view.
Hope this may be help full for you guys, if anything you may not understand then let me know.Cheers,Arun
There is no route function in iOS 5 SDK.
So to make a route you need to parse data from route providers, such as Google Maps API or use SDK from CloudMade Maps. Then you use MKPolyline to connect parsed points to show route on MKMapView.
Probably there are existing open-source projects with routes, try to search on github.com.