I am trying to use Mapbox mobile SDK to shows my information.
I just confused for How to select a POI on map,
Here is my problem:
I am using my style map, which had been combined my data inside. I wish to show the detail of the POI point by touch the point.
I have implemented this feature on my website version.
Now, I want to apply this feature on my mobile version.
and I have no idea that how to select a POI point from the map....
anyone can help me to workout It, please???
Also, my POI points are over 600000+. It is not possible to query a GEOJSON from a server. Especially, I have got so many points, and the GEOJSON file is extremely large than any other project (800MB). I can not make the POI like a simple "Annotation".
You should be able to use query feature at to get the selected GeoJSON marker and add additional information. Check out this indoor map example that i'm currently working on. I add a GeoJSON source to the map and have an onMapClickListener. Inside of it I query the GeoJSON layer to determine which room the user selected. You should be able to do the same with a circle layer.
This features coming in both the next Android 4.2.0 and iOS releases (you can use the Android beta.3 for now). For more examples check out the Demo app. Let me know if I need to clarify anything.
Related
I spent several hours looking for simple solution and still haven't found one.
MapBox style editor uses this simple feature. That you can hover and click over map, and it shows small popup stating all terrain classes you enabled in your map.
Question, how to do it in Android version of MapBox given I have installed my style. Now I want click on any place in the map and get the same popup stating, for example, that this is building, woods, background here. Or other place would satte, that this is major road.
This IS doable as MapBox studio itself shows. i can't believe it uses some API not available for anyone, as this is one API no map provider gives, while still able correctly draw terrain. What so complex to add this API?
And NO I am not interested in address. I am interested exactly on terrain, for simple task - distinguiosh water from non-water, road from non-road, building, from non-building, don't care where it is by address, so reverse geolocation does not work. Or simpler - I need SIMPLER geolocation, than address.
Your questions kind of confusing but I'll try and help. If I'm reading correctly, you are trying to create an Android app that uses an API similar to Mapbox Studio that allows the user to select/distinguish the difference between objects on the map such as buildings, water, forest, etc.
If this is the case, then first you must understand that Mapbox Studio is using OpenStreetMap data to distinguish between objects. These objects are stored in a database with tags. It's tough to explain so i'll just leave a brief reading wiki page that might help.
To my knowledge, there isn't any API's specific to Android that will give you the kind of information you're looking for. However, if I was in your dilemma I'd take a look at the Overpass API as it's a complex query tool that allows you to send coordinates to it and it will return all the tags (such as building or water) at that location within a JSON object. From there you can parse and use the data in your app. It is very powerful so I suggest reading up on how to use it and test using a website called Overpass Turbo, that's if you decide to use it.
Nevertheless, I hope this helps and I understood your question correctly.
Alongside with my friends I am about to develop an android application. The application will use maps a lot, finding routes, placing markers, drawing predefined routes, stuff like that.
There is this Google Maps APIv2. So I tried it, write some code and looks good. I am able to place markers and draw polylines, however my application will have some predefined routes. One route is set of LatLng points. So I just add these points to PolylineOptions and add it to map. Great, it works.
But these predefined routes will be created in web-based application also using Google Maps APIv2 or similar api/library. Some streets are not straight they are curved so you need to create a lot of LatLng points to get it look nice which is very important. I can do this but I want to put only two LatLng points - at the beginning of the street and at the end.
Here is the image:
On the left, route has only two LatLng points (red dots) and that is desired shape of line. On the right same route with 2 LatLng points gives me route coloured in light blue, and this is what actually happens if I just add polyline to GoogleMap object. In order to create same effect as in left image, I need to create many LatLng (red dots) points which is not appropriate for those who will create these routes. So this leads us to routing problem which can be solved by using Google Directions API. Which solves the problem of drawing routes with less markers. Basically what I understood, this API for directions actually creates a lot of these LatLng points that I draw using for-each loop as seen on right part of picture above. And I need to contact Google Web Service for this so I need to have Internet connection - and this is the problem.
Sometimes internet will not be available hence I need some alternative solution. I've heard of Open Street Maps, but I am not sure how to use it and does it needs internet connection for creating these routes.
Is there any free library that offers offline routing and showing maps offline? Basically all map interactions must be done without use of internet.
But it is understandable if internet connection is needed only for the first run of application as it is needed for Google Maps APIv2, well application crashes until I turn on internet, after which any next run I do not need internet..
A web based application will be made for creating these routes and routes will be created by users for whom we develop this application. And as users can be very annoying they will demand some user-friendly and easy interface for creating routes. Telling them that they need to create 100 to 500 points for each route, and if there is 60-70 routes they will gladly say NO to our application.
Any advice? If it is possible, I can write my own routing algorithm for Google Maps to work offline, I am very skilful at "Algorithms and Data Structures" - any guides/tutorials for this? But I guess this map is just set of tiles, and does not have necessary information for finding route.... So please correct If I am mistaken for anything.
You can use the Scout SDK (provides a free usage quota) as it offers full offline maps, routing & navigation.
Have a look into the open source projects GraphHopper, Mapsforge and OpenScience-VTM which can do routing and/or maps offline. And all use OpenStreetMap data. Other projects exists of course, have a look here and here.
Also have a look into the GraphHopper map matching component which could be interesting for your specific use case and can work offline too.
(Note I'm the author of GraphHopper)
If it is possible, I can write my own routing algorithm for Google Maps to work offline
No you can't, the data is not open nor you can buy the data to my knowledge.
Another option is OsmAnd. The OSM wiki also has some information about OsmAnd and even more information about OSM on Android in general as well as pages about rendering and routing.
do you know how can we create our map and show the ways from a certain locations to destinations ? Without using google map , just using a picture of a map , is there any way to draw routes on it?I am not asking projects or codes , just need some suggestions related to drawings and considering the obstacles in the way ?Thank you
You should have your way points in somewhere(maybe in db or in xml file etc) and also for getting map base you should have a map provider like yahoo, bing, google or openstreetmap(which is free to use - no api key needed considering others)
after having these two sources you can use Geoserver(which is opensource map data manipulater and provider) to put these sources together and get them as map base image.
considering your "just using a picture of a map" is an owerwellming issue. Because you will have to do some calculation to find where to put your points programatically. So Geoserver does that automatically.
also I suggest you to hava a look at osmdroid and osmbonuspack they may help.
I want to mark historical 'points of interest' across the globe on a mapping solution such as Google Maps (or something else).
I'll be getting an Android app created in which I want to be able to provide the users the ability to search for and locate the nearest such 'point of interests' around their current location.
Should I be using Google Maps or something else like OSM?
How should I be marking them on Google or elsewhere?
(a) I want to be able to mark these places with pictures as well and
(b) I want to store them at my end in a generic format as well, just in case!
How should the Android app search for the closest such points?
As I understand, Google Maps can show its own map overlaid with my data when I provide a KML file (http://code.google.com/apis/kml/documentation/kmlSearch.html). Can that be shown "within an Android app"? (ie, I know it can be shown on a webpage, but can it be shown in a native app?)
I will suggest google maps. Reason is google maps is updated often and part
of the maps from osm is not as latest.
Probably store this marking in your own datastore called point_of_interest.
The info window is also a special kind of overlay for displaying content
(usually text or images) within a popup balloon on top of a map at a given
location. read here for more information.
your android app should detect current user location and send the information
such as latitude and longitude to your server. Hence the query to search
for point of interest is done by the server and process the data and send
back to user android app. For example, the query would be something like
select * from point_of_interest where distance < 10km limit 5;
yes, read this link
Ok, for an app I built for a customer, we had a similar requirement. Basically, I needed to display the locations of interest withing 200miles of my current location. The way this worked for me was that I took my current location and made a Web Services call to their servers where they did the Geographic calculation and returned a list of results to me.
I would have the Android app just use the MapView and then user Overlays to display icons on the map. The problem with displaying the items using kml is that they will not be clickable by the user so their will be no interactivity. If you do choose to do it with kml, there is some example code located in this project: https://github.com/sunlightlabs/congress
I prefer google maps. Google maps SDK looks good and the sdk performs well. I don't know a SDK that has something like a OSMMapView that offers the same performance and features like google maps does (please correct me). But OSM can be as visual appealing as google maps. Cloudmade has tons of different styles for OSM data.
If you want to display maps by google, you have to use the Maps Library that ships with the Android SDK.
You can display any Views on top of the google maps. I.e. use mapviewballoons on github.
If you have lots of POIs that you want to display you should definitely persist you data with a spatial index. So that nearest neighbour searches are fast. One solution would be to use sqlite R*Trees. I did not use them on android and they work not out of the box you have to build sqlite-android yourself (see this question). Or use Perst, or ...
If you have few data, that fits into the phone memory you can use a Quadtree. This would be even faster than the db when searching it. You will find lots of examples when you google it. You could store the data as xml, json or even serialize the whole quadtree with the java Serializable interface.
There are tons of possibillities this question is way too broad. Some random ideas:
Create a server that responds to bounding box searches over HTTP and store the POIs in a Quadtree.
Deliver all your POIs with the app. As database, xml, json or a serialized Quadtree.
I don't have experience with kml on Android.
iam a newbie for this kind of development. im trying to create an android application which involves GPS tracking. i am using Nutiteq because i have to use openstreetmap as the default map. please help me.
What do you mean by GPS tracking? If it is showing GPS location on map, then Nutiteq sample project (https://github.com/nutiteq/hellomap3d/) has several samples:
a) Simpler HelloMap3D demo has line-based animated GPS display, this is easier to use
b) AnimatedLocationActivity in AdvancedMap3D shows OpenGL-based animation for more advanced requirements
If you want to save locations and show tracks as lines or points, then you need a bit extra work. I would save data to Spatialite database. Same hellomap3d project has Spatialite layer for viewing, but there is also SpatialLiteDbHelper.java which has method insertSpatiaLiteGeom() which enables to save data persistently to the database, this is something you need to implement in your app. For viewing lines and points there is existing sample code: see VectorFileMapActivity.java.
GPS tracks tend to become long and slow to render. For this there is special method to simplify data: use something like in VectorFileMapActivity:
dataSource.setAutoSimplify(2, metrics.widthPixels);
This tells that line data (it does not apply to points) will be simplified based on map zoom, while after zoom in you will see full data (for smaller map area). This will enable to show GPS trakcs if you have many of them visible with thousands of points.
The Open GPS Tracker project uses open street map. Have a glance on their sources.