I'm working on a project for college and I'm having great difficulty with part of it.
Simply put, I am looking to do the following 5 things:
download the open street map data for my city
store that data locally on the phone's harddrive.
view that data in my iOS application as a map
place markers on the map.
draw paths along roads between those paths.
I have been working on this particular part of the project for a number of weeks and I'm getting nowhere with it. I haven't even been able to figure out how to store the map on the phone let alone view the map data. I've tried using the "Route-Me" library but cannot get it working (although it seems to be one of the best libraries for using openstreetmap data so I am looking to learn how to use it). I feel pretty goddamned defeated.
If anyone has accomplished any of the tasks I am trying to do could you please link me to tutorials/guides/videos that you have used.
I'm not looking for people to give me code or do the work for me, I want to learn how to do this, but if anyone can point me in the right direction of sites that I could learn off I would be very grateful.
Any advice or feedback would be much appreciated
Here's how I ended up solving the problem.
Since Tilemill doesn't natively read .osm/.o5m/.pbf files I used Osmosis to convert a .osm file into .shp files.
I then created a new project in Tilemill and added the particular .shp files I wanted as layers to the new project. It takes a little bit of tinkering to get the map to look like you want it to but it's very similar to css and pretty easy to pick up as you go.
Once I had the map looking the way I wanted it I exported it as a .mbtiles file. This takes a long time to make and the files can be very large depending on how detailed the tiles are. I did one map of Ireland with zoom levels between 7-14 inclusive and I did one map of just Dublin city with zoom levels of 11-17 inclusive. Even though the map of just the city of Dublin had much less tiles, they were both ~200MB in size.
I then found this tutorial online which explains how to store the .mbtiles file in you application and how to read it: http://martinsikora.com/creating-mbtiles-db-for-ios-mapbox-from-hi-res-map-image
Here are a few other links that I found useful:
http://www.kindle-maps.com/blog/using-tilemill-with-openstreetmap-data.html
http://mapbox.com/developers/mbtiles/
http://mapbox.com/mapbox-ios-sdk/api/
http://mapbox.com/developers/api/#static_api
http://support.mapbox.com/discussions
I hope this is useful to someone
I would suggest trying the MapBox iOS SDK. It is actually forked from the Route-Me library and will allow you to accomplish everything on your list.
A key point to remember is that you have another step in between downloading the OSM data and storing it locally on the iOS device, that is, generating the map tiles and storing them in some sort of database.
Here is an example iOS app using the MapBox SDK that has both online and offline map sources and is a good place to start.
Related
How to get file properties should be GPS(latitude and longitude or location name) and upload a file or image from ionic 4?
This is not really the point of StackOverflow, you are supposed to post when you got stuck, not just request tutorials to be custom written for you.
You have also requested two separate tutorials, and the second one is not clearly defined.
I'll try to help though.
To get latitude and longitude you need to read the EXIF data of an image. There are libraries out there and there are guides that show how to use them to calculate the lat/lon info:
https://awik.io/extract-gps-location-exif-data-photos-using-javascript/
For the uploading a file or image then you might find this tutorial helpful to learn the basics:
https://devdactic.com/ionic-4-image-upload-storage/
But that is just a simple example and you will quickly realise you need more complicated code to secure it and multiple servers to deploy it to, and then there are scaling issues and cdn's and more to think about. This is when people generally turn to something like Firebase Storage which will let you push files into the cloud and gives you all the structure without having to write it. Start here for a tutorial that explains these concepts:
https://blog.smartcodehub.com/how-to-upload-an-image-to-firebase-from-an-ionic-4-app/
I created an indoor map file in JOSM, with different levels and tags for each room etc. Now I have it as a .osm file. How do I make it operational. Like how do I deploy it so that it can be used for indoor navigation. I also need some other features like calculating path from one place t other and search index.
You are basically searching for an offline routing and map drawing solution. This has already been answered multiple times. You could even use a full-featured offline solution such as OsmAnd if you convert your map into a suitable format with the OsmAndMapCreator.
So I figured out a way by converting the given .osm file of my indoor map to GeoJSON using OSM2GEOJSON and then displaying that in awesome leaflet library. It's optimized for phones too. Displaying the map in leaflet was a sort of a hefty task but there are lot of plugins and forum answers that helped me. Reading geojson using ajax in leaflet and creating seperate layers for each floors,filtering those geojson layers based on there features.properties.level and then adding leaflet easy-buttons to display each layer. There are also other plugins which can help.
I'm getting started on Map Kit for my job and I have a IOS project I am working on where it involves Map Kit, I know how to search for a location and pin point it but my issues is that part of my project involves getting the next 10-15 zip codes of the surrounding areas of my central location and receive the cities that are in each zip code, i really don't know how to implement it and I need help. an explanation or a snippet of code would be much appreciated.
Zip codes like this aren't available in MapKit. You need to find a third-party source of zip code data (e.g. codes + bounding geometries), figure out a way to index them (perhaps be using or precalculating the centroid of each), and then figure out what's close to the selected point.
Use Google Places API for this.
You can go for a Radar or NearbyPlaces search and get zip codes of the returned places (you can use a custom location and set the radius for your search as you are wishing to do).
There is a really good iOS library for querying Google Places API which is FTGooglePlacesAPI
Eventually you can also do everything manually using
NSData* data = [NSData dataWithContentsOfURL:YOUR-googleRequestURL];
and handling the fetched data.
Good day,
I was wondering, is it possible to create "indoor" maps with Mapbox for iOS (or does anyone have another suggestion)? I have a PDF of an indoor floor plan. I think I need to convert that to the MBTiles ( http://mapbox.com/developers/mbtiles/ ) format. How could I acchieve this?
Allso, when drawning the "walking route" for the person to certain facilities in the building. "it" should know where the person could walk.
Currently I am trying to create something with CATiledLayers (but I am kinda stuck (I can display the map, using "a tile" format.) and was looking and MapBox might be usefull since it has things like 'drawning' vectors on the map, or icons with information and such. For the walking directions I was thinkin about 'dotting' the walking routes so "Dijkstra's" algorithm" could determine the path. How could I go about this in Mabbox, even if possible?
Any help in the right directions would be greatly appreciated.
Kind regards,
Matthijn Dijkstra
You can likely do this with MapBox. In order to get an image or PDF into MBTiles format, you will want to use TileMill. You basically need to get your imagery into a geographic format. The easiest way would be to export the PDF as a TIFF, then make it a GeoTIFF and follow these instructions. That will let you geo-enable the imagery, get it into TileMill, then export it as MBTiles. Then, you could use the MapBox iOS SDK to bring it to iOS.
You could use a service such as indoor.io to generate the maps. There are a bunch of indoor services out there and more coming on the market.
I'm working with a project its related to Offline map application.Because of that I searched for offline map which shows the defined area. I used MapBox for offline mapping. I can add annotation on this map and draw lines.
But my requirement is offline map with routing. I was fed up to find a offline routing library or offline routing engine to embedded to Xcode.
Appreciate if any of you have any clue or sample project/code to implement this
Note : This question is related to my one. No one replied to this as well
Thanks.
Offline implies no internet, the iPhone is still able in most cases to get the users current location from the GPS. That means that you can be quite confidant that you can find out the current location of the user whilst offline.
The problem with offline routing is that the Phone is dumb, it only remembers the x amount of MB of data in terms of tiles to display.
Routing is something completely different, it takes a point A and B and works out the shortest, fastest, cheapest or all of those between A and B.
This takes a lot more then tiles to accomplish, after all if you think in terms of MVC, tiles are just the dump views, they don't know much about what's around them except what's inside of them. It would be the "controller" who would calculate routes, and for that you would need to be in possession of all the data spanning the desired area for routing.
For each mapping service you will find a different route, maybe not in terms of actual path, but in estimated time, effort etc, what this means is that if you have your own maps (offline in a database), it's up to you to use that data, so you should make your own routing algorithm which I'm sure isn't what you want to do.
So what are your options? At the moment this just isn't possible in the scope you want. Even if you had an offline maps database, you still need a routing algorithm.
In offline case also you can get the current location by using only GPS and you can draw overlay lines from current location to the interesting point for that you have to do some calculations
You can make offline routing by using graphhopper library by making graph data which contains (Street names, routes,edges) . Graph data is taken by .pbf file which can be taken by (Use this:http://download.geofabrik.de) and use commands(in Terminal) that was given by (https://github.com/graphhopper/graphhopper-ios/tree/master/graphhopper-ios-sample) to convert .pbf into graph data. Then we can make offline routing with its instruction (All given in graphhopper iOS sample).please refer that carefully. because i have done and finish my project successfully.