How to display stored locations from a database on a map?



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








-1















I want to build an app which will display restaurants stored in a database (name, lat, long etc...) on a map within certain radius from the user. The user can then click on a particular restaurant to view more information or add a review about that restaurant. I know how to fetch the name of restaurants from the database using JSON and PHP and display them in a list view. But I want to be able to display them on a map. Could someone please point me in the correct direction on how to get this done?










share|improve this question



















  • 2





    Please post your efforts for SO members to help you better.

    – RussellB
    Nov 15 '18 at 9:39











  • See this project on Github. It does something like you say. It Locates car instead of restruants.

    – Sayok Majumder
    Nov 15 '18 at 10:12











  • @SayokMajumder sir, can you please share .sql file.

    – Abhilash Karanth
    Nov 15 '18 at 11:11











  • @AbhilashKaranth I don't have any specific sql files for the project. The database are hosted online and details are put inside webfiles.

    – Sayok Majumder
    Nov 15 '18 at 11:27


















-1















I want to build an app which will display restaurants stored in a database (name, lat, long etc...) on a map within certain radius from the user. The user can then click on a particular restaurant to view more information or add a review about that restaurant. I know how to fetch the name of restaurants from the database using JSON and PHP and display them in a list view. But I want to be able to display them on a map. Could someone please point me in the correct direction on how to get this done?










share|improve this question



















  • 2





    Please post your efforts for SO members to help you better.

    – RussellB
    Nov 15 '18 at 9:39











  • See this project on Github. It does something like you say. It Locates car instead of restruants.

    – Sayok Majumder
    Nov 15 '18 at 10:12











  • @SayokMajumder sir, can you please share .sql file.

    – Abhilash Karanth
    Nov 15 '18 at 11:11











  • @AbhilashKaranth I don't have any specific sql files for the project. The database are hosted online and details are put inside webfiles.

    – Sayok Majumder
    Nov 15 '18 at 11:27














-1












-1








-1








I want to build an app which will display restaurants stored in a database (name, lat, long etc...) on a map within certain radius from the user. The user can then click on a particular restaurant to view more information or add a review about that restaurant. I know how to fetch the name of restaurants from the database using JSON and PHP and display them in a list view. But I want to be able to display them on a map. Could someone please point me in the correct direction on how to get this done?










share|improve this question
















I want to build an app which will display restaurants stored in a database (name, lat, long etc...) on a map within certain radius from the user. The user can then click on a particular restaurant to view more information or add a review about that restaurant. I know how to fetch the name of restaurants from the database using JSON and PHP and display them in a list view. But I want to be able to display them on a map. Could someone please point me in the correct direction on how to get this done?







android phpmyadmin latitude-longitude android-maps-v2






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 15 '18 at 13:03









Fantômas

32.9k156491




32.9k156491










asked Nov 15 '18 at 9:38









Abhilash KaranthAbhilash Karanth

23




23







  • 2





    Please post your efforts for SO members to help you better.

    – RussellB
    Nov 15 '18 at 9:39











  • See this project on Github. It does something like you say. It Locates car instead of restruants.

    – Sayok Majumder
    Nov 15 '18 at 10:12











  • @SayokMajumder sir, can you please share .sql file.

    – Abhilash Karanth
    Nov 15 '18 at 11:11











  • @AbhilashKaranth I don't have any specific sql files for the project. The database are hosted online and details are put inside webfiles.

    – Sayok Majumder
    Nov 15 '18 at 11:27













  • 2





    Please post your efforts for SO members to help you better.

    – RussellB
    Nov 15 '18 at 9:39











  • See this project on Github. It does something like you say. It Locates car instead of restruants.

    – Sayok Majumder
    Nov 15 '18 at 10:12











  • @SayokMajumder sir, can you please share .sql file.

    – Abhilash Karanth
    Nov 15 '18 at 11:11











  • @AbhilashKaranth I don't have any specific sql files for the project. The database are hosted online and details are put inside webfiles.

    – Sayok Majumder
    Nov 15 '18 at 11:27








2




2





Please post your efforts for SO members to help you better.

– RussellB
Nov 15 '18 at 9:39





Please post your efforts for SO members to help you better.

– RussellB
Nov 15 '18 at 9:39













See this project on Github. It does something like you say. It Locates car instead of restruants.

– Sayok Majumder
Nov 15 '18 at 10:12





See this project on Github. It does something like you say. It Locates car instead of restruants.

– Sayok Majumder
Nov 15 '18 at 10:12













@SayokMajumder sir, can you please share .sql file.

– Abhilash Karanth
Nov 15 '18 at 11:11





@SayokMajumder sir, can you please share .sql file.

– Abhilash Karanth
Nov 15 '18 at 11:11













@AbhilashKaranth I don't have any specific sql files for the project. The database are hosted online and details are put inside webfiles.

– Sayok Majumder
Nov 15 '18 at 11:27






@AbhilashKaranth I don't have any specific sql files for the project. The database are hosted online and details are put inside webfiles.

– Sayok Majumder
Nov 15 '18 at 11:27













1 Answer
1






active

oldest

votes


















0














Try this.. it will show the marker for that location

MarkerOptions mp = new MarkerOptions();
LatLng newLatLng = new LatLng(lat, lng); // latitude and longitude
mp.position(newLatLng);
mp.icon(BitmapDescriptorFactory.fromResource(R.drawable.your_icon));
mp.title("Title");
mp.snippet(location); // location
googleMap.addMarker(mp);





share|improve this answer























  • sir, latitude and longitude of that location should be reflected from mysql database. Suppose a restaurant registered with us and we have to show their details if it is nearer to user while he is searching. I am looking for this kind of code

    – Abhilash Karanth
    Nov 15 '18 at 11:09












  • Okay Sir, You have list of restaurants details with location in your db. if user going to search restaurant means at the time you can the get current location of the user. Now calculate the distance with restaurant locations, filter out the restaurant list send to app. app will show all the restaurants on map.

    – veerendran
    Nov 15 '18 at 11:34












  • yes sir, i am trying to find out solution for above task. But still didn't get the desired output

    – Abhilash Karanth
    Nov 15 '18 at 11:39











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53316398%2fhow-to-display-stored-locations-from-a-database-on-a-map%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














Try this.. it will show the marker for that location

MarkerOptions mp = new MarkerOptions();
LatLng newLatLng = new LatLng(lat, lng); // latitude and longitude
mp.position(newLatLng);
mp.icon(BitmapDescriptorFactory.fromResource(R.drawable.your_icon));
mp.title("Title");
mp.snippet(location); // location
googleMap.addMarker(mp);





share|improve this answer























  • sir, latitude and longitude of that location should be reflected from mysql database. Suppose a restaurant registered with us and we have to show their details if it is nearer to user while he is searching. I am looking for this kind of code

    – Abhilash Karanth
    Nov 15 '18 at 11:09












  • Okay Sir, You have list of restaurants details with location in your db. if user going to search restaurant means at the time you can the get current location of the user. Now calculate the distance with restaurant locations, filter out the restaurant list send to app. app will show all the restaurants on map.

    – veerendran
    Nov 15 '18 at 11:34












  • yes sir, i am trying to find out solution for above task. But still didn't get the desired output

    – Abhilash Karanth
    Nov 15 '18 at 11:39















0














Try this.. it will show the marker for that location

MarkerOptions mp = new MarkerOptions();
LatLng newLatLng = new LatLng(lat, lng); // latitude and longitude
mp.position(newLatLng);
mp.icon(BitmapDescriptorFactory.fromResource(R.drawable.your_icon));
mp.title("Title");
mp.snippet(location); // location
googleMap.addMarker(mp);





share|improve this answer























  • sir, latitude and longitude of that location should be reflected from mysql database. Suppose a restaurant registered with us and we have to show their details if it is nearer to user while he is searching. I am looking for this kind of code

    – Abhilash Karanth
    Nov 15 '18 at 11:09












  • Okay Sir, You have list of restaurants details with location in your db. if user going to search restaurant means at the time you can the get current location of the user. Now calculate the distance with restaurant locations, filter out the restaurant list send to app. app will show all the restaurants on map.

    – veerendran
    Nov 15 '18 at 11:34












  • yes sir, i am trying to find out solution for above task. But still didn't get the desired output

    – Abhilash Karanth
    Nov 15 '18 at 11:39













0












0








0







Try this.. it will show the marker for that location

MarkerOptions mp = new MarkerOptions();
LatLng newLatLng = new LatLng(lat, lng); // latitude and longitude
mp.position(newLatLng);
mp.icon(BitmapDescriptorFactory.fromResource(R.drawable.your_icon));
mp.title("Title");
mp.snippet(location); // location
googleMap.addMarker(mp);





share|improve this answer













Try this.. it will show the marker for that location

MarkerOptions mp = new MarkerOptions();
LatLng newLatLng = new LatLng(lat, lng); // latitude and longitude
mp.position(newLatLng);
mp.icon(BitmapDescriptorFactory.fromResource(R.drawable.your_icon));
mp.title("Title");
mp.snippet(location); // location
googleMap.addMarker(mp);






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 15 '18 at 10:42









veerendranveerendran

364




364












  • sir, latitude and longitude of that location should be reflected from mysql database. Suppose a restaurant registered with us and we have to show their details if it is nearer to user while he is searching. I am looking for this kind of code

    – Abhilash Karanth
    Nov 15 '18 at 11:09












  • Okay Sir, You have list of restaurants details with location in your db. if user going to search restaurant means at the time you can the get current location of the user. Now calculate the distance with restaurant locations, filter out the restaurant list send to app. app will show all the restaurants on map.

    – veerendran
    Nov 15 '18 at 11:34












  • yes sir, i am trying to find out solution for above task. But still didn't get the desired output

    – Abhilash Karanth
    Nov 15 '18 at 11:39

















  • sir, latitude and longitude of that location should be reflected from mysql database. Suppose a restaurant registered with us and we have to show their details if it is nearer to user while he is searching. I am looking for this kind of code

    – Abhilash Karanth
    Nov 15 '18 at 11:09












  • Okay Sir, You have list of restaurants details with location in your db. if user going to search restaurant means at the time you can the get current location of the user. Now calculate the distance with restaurant locations, filter out the restaurant list send to app. app will show all the restaurants on map.

    – veerendran
    Nov 15 '18 at 11:34












  • yes sir, i am trying to find out solution for above task. But still didn't get the desired output

    – Abhilash Karanth
    Nov 15 '18 at 11:39
















sir, latitude and longitude of that location should be reflected from mysql database. Suppose a restaurant registered with us and we have to show their details if it is nearer to user while he is searching. I am looking for this kind of code

– Abhilash Karanth
Nov 15 '18 at 11:09






sir, latitude and longitude of that location should be reflected from mysql database. Suppose a restaurant registered with us and we have to show their details if it is nearer to user while he is searching. I am looking for this kind of code

– Abhilash Karanth
Nov 15 '18 at 11:09














Okay Sir, You have list of restaurants details with location in your db. if user going to search restaurant means at the time you can the get current location of the user. Now calculate the distance with restaurant locations, filter out the restaurant list send to app. app will show all the restaurants on map.

– veerendran
Nov 15 '18 at 11:34






Okay Sir, You have list of restaurants details with location in your db. if user going to search restaurant means at the time you can the get current location of the user. Now calculate the distance with restaurant locations, filter out the restaurant list send to app. app will show all the restaurants on map.

– veerendran
Nov 15 '18 at 11:34














yes sir, i am trying to find out solution for above task. But still didn't get the desired output

– Abhilash Karanth
Nov 15 '18 at 11:39





yes sir, i am trying to find out solution for above task. But still didn't get the desired output

– Abhilash Karanth
Nov 15 '18 at 11:39



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53316398%2fhow-to-display-stored-locations-from-a-database-on-a-map%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Use pre created SQLite database for Android project in kotlin

Darth Vader #20

Ondo