This topic is locked
[SOLVED]

 Lat and Long not saving

2/6/2019 7:51:53 AM
PHPRunner General questions
Tandy author

I am having a few problems with my geo-locations
I have followed everything I seen on the forums about the latitude/longitude.

1st and main problem:The lat and lng are not saving to the database. I have made those decimal 10 and 6 and stays blank. I have also trying the double and still stays blank.In Pages. I clicked on geocoding. Checked the checkbox to use. Then in my fields I have lat and lng as on my database.For the fields below I add address, city, state, zip, and country

With it not saving to the database I will end up getting charged by Google..
2nd Problem I am having:The maps are working for the list page but not the view page.

If anyone else had these problems, Please let me know how you fixed them..

Thank You.James Tandy

admin 2/6/2019

Check for any error messages in Javascript developers console just in case.

Tandy author 2/7/2019

Sorry took so long to reply. Looking at it in Google this is a warning I get on the list page:

Google Maps JavaScript API warning: SensorNotRequired https://developers.google.com/maps/documentation/javascript/error-messages#sensor-not-required'>https://developers.google.com/maps/documentation/javascript/error-messages#sensor-not-required

Then in the view page I get this:

util.js:220 Google Maps JavaScript API warning: SensorNotRequired https://developers.google.com/maps/documentation/javascript/error-messages#sensor-not-required'>https://developers.google.com/maps/documentation/javascript/error-messages#sensor-not-required

mw.m @ util.js:220

(anonymous) @ js?key=AIzaSyAJwv8wM34_bau7tDMOTfHNjvLKHZeGRf0&sensor=false&language=en&callback=Runner.globalGmapLoader.mapsLoaded&libraries=visualization,geometry:140

Promise.then (async)

(anonymous) @ js?key=AIzaSyAJwv8wM34_bau7tDMOTfHNjvLKHZeGRf0&sensor=false&language=en&callback=Runner.globalGmapLoader.mapsLoaded&libraries=visualization,geometry:140

setTimeout (async)

Bh @ js?key=AIzaSyAJwv8wM34_bau7tDMOTfHNjvLKHZeGRf0&sensor=false&language=en&callback=Runner.globalGmapLoader.mapsLoaded&libraries=visualization,geometry:140

google.maps.Load @ js?key=AIzaSyAJwv8wM34_bau7tDMOTfHNjvLKHZeGRf0&sensor=false&language=en&callback=Runner.globalGmapLoader.mapsLoaded&libraries=visualization,geometry:21

(anonymous) @ js?key=AIzaSyAJwv8wM34_bau7tDMOTfHNjvLKHZeGRf0&sensor=false&language=en&callback=Runner.globalGmapLoader.mapsLoaded&libraries=visualization,geometry:229

(anonymous) @ js?key=AIzaSyAJwv8wM34_bau7tDMOTfHNjvLKHZeGRf0&sensor=false&language=en&callback=Runner.globalGmapLoader.mapsLoaded&libraries=visualization,geometry:229



**
Don't know what all that means.. I have my key in right or the list page would not show the map.**

Tandy author 2/13/2019

Will the above errors stop the Lat and Lng from being placed into the database? Some of my maps show up and others don't. But if I edit and save it. The map show but still does not place the lat or lng in the database?In Firefox web developer I have this as well:

14:48:13.287 unreachable code after return statement[Learn More] RunnerAll.js:38885:2

14:48:13.287 unreachable code after return statement[Learn More] RunnerAll.js:50425:2

14:48:18.733 Google Maps JavaScript API warning: SensorNotRequired https://developers.google.com/maps/documentation/javascript/error-messages#sensor-not-required util.js:219:12


Thank you again for helping out on this..James Tandy

lefty 2/14/2019



Will the above errors stop the Lat and Lng from being placed into the database? Some of my maps show up and others don't. But if I edit and save it. The map show but still does not place the lat or lng in the database?In Firefox web developer I have this as well:

14:48:13.287 unreachable code after return statement[Learn More] RunnerAll.js:38885:2

14:48:13.287 unreachable code after return statement[Learn More] RunnerAll.js:50425:2

14:48:18.733 Google Maps JavaScript API warning: SensorNotRequired https://developers.google.com/maps/documentation/javascript/error-messages#sensor-not-required util.js:219:12


Thank you again for helping out on this..James Tandy


Your Javascript errors : are just a warning from the google API still should work see below.
Looking at the above posts , there is something not right here . Are you referring to the small maps that come in on the list page ? You will only get like 10 maps before google cuts you off. As a workaround . To make it faster only have minimum fields on the list page while you do this ? Then change back to your needs to the list page after the following . this is the built in way to get lng / lng updated to your database with phprunner . See this link for more reference specifically option 3 at the bottom . I may be wrong here but the above does not state anything I am posting.You need to select all the records on the list page inline edit , then click edit selected and SAVE ALL. This will update the lng / lat fields in your records/database. I usually do about 100 records at a time . You can only do this for about a couple of thousand records every 24 hours . This will update your database with lat /lng as long as you have the fields there. They don't need to be on the list page but need to be setup under the geocoding button on the pages screen .As far as the view page you have to insert a map somewhere on the view page then add your parameters in the geocoding button. Since it is only one record it should show that is why my posting above is listed as there is a setup problem.





If you use the same table to import every month then I have a solution to avoid doing this every month . Just reply with your output requirements. More complicated!

Tandy author 2/15/2019



Your Javascript errors : are just a warning from the google API still should work see below.
Looking at the above posts , there is something not right here . Are you referring to the small maps that come in on the list page ? You will only get like 10 maps before google cuts you off. As a workaround . To make it faster only have minimum fields on the list page while you do this ? Then change back to your needs to the list page after the following . this is the built in way to get lng / lng updated to your database with phprunner . See this link for more reference specifically option 3 at the bottom . I may be wrong here but the above does not state anything I am posting.You need to select all the records on the list page inline edit , then click edit selected and SAVE ALL. This will update the lng / lat fields in your records/database. I usually do about 100 records at a time . You can only do this for about a couple of thousand records every 24 hours . This will update your database with lat /lng as long as you have the fields there. They don't need to be on the list page but need to be setup under the geocoding button on the pages screen .As far as the view page you have to insert a map somewhere on the view page then add your parameters in the geocoding button. Since it is only one record it should show that is why my posting above is listed as there is a setup problem.





If you use the same table to import every month then I have a solution to avoid doing this every month . Just reply with your output requirements. More complicated!



Thank You John for your reply,
I have the map on list and view.. Some of the maps show on the list as you said 10. But the map does not show on view page at all..

I have Lat and Lng and did everything I could find on the site. The Lat and Lng does not save to the database on my server. I know the Key is right because some of the maps do show. Just the Lat and Lng does not save so all the maps are not showing right unless I edit that post and save it again. Then that map shows right but still does not save the Lat and Lng to my database.. So every time I go to the list page only half the maps show again..

Thank you againJames Tandy

Tandy author 2/15/2019

I am starting to think it is my server. Maybe missing something on the php settings? But don't even know what it all calls or needs.. Off again to Google I go(more Reading)..

lefty 2/15/2019



I am starting to think it is my server. Maybe missing something on the php settings? But don't even know what it all calls or needs.. Off again to Google I go(more Reading)..


A screen shot of the view page would help . Also a screenshot of the list page while you are editing and saving all the records would help too. It should turn green as it save all the records on the list page and update the lng/lat in the database. Make sure the geocoding is using the lat / lng fields in the pages setup and they match the same spelling in the database.

Tandy author 2/15/2019



A screen shot of the view page would help . Also a screenshot of the list page while you are editing and saving all the records would help too. It should turn green as it save all the records on the list page and update the lng/lat in the database. Make sure the geocoding is using the lat / lng fields in the pages setup and they match the same spelling in the database.



Ok I have attached different images I think you are asking for.. Let me know if it was something else..

Thank YouJames







Please let me know if something else..

Thank YouJames

lefty 2/15/2019



Ok I have attached different images I think you are asking for.. Let me know if it was something else..

Thank YouJames






Please let me know if something else..

Thank YouJames


Okay first think i see is , You have to insert the map field in the view page I usually put at the top above all the other records . In view page add the map field ( make sure it is set to view as a map)

. Right click hit properties and set up geocoding options as you need.
Secondly on the list page . Setup your fields as Edit Inline Temporarily take out Lat / Lng and Map on the list page . Now you have just the address information etc... . Build project. hit check mark for all records. Click Edit Selected Records Option in the gear . Then Click Save ALL . It should start automatically saving each record to the end of page . Then Continue for next page and so on. Then check regular edit page for lat / lng fields to see if they filled in and view page to see if map filled in.
Now go back to your project and add all the fields back in you need for the list page.

Only issue there may be here is I see you have details setup . Never tried it on a list page with details records setup.

Tandy author 2/15/2019



Okay first think i see is , You have to insert the map field in the view page I usually put at the top above all the other records . In view page add the map field ( make sure it is set to view as a map)

. Right click hit properties and set up geocoding options as you need.
Secondly on the list page . Setup your fields as Edit Inline Temporarily take out Lat / Lng and Map on the list page . Now you have just the address information etc... . Build project. hit check mark for all records. Click Edit Selected Records Option in the gear . Then Click Save ALL . It should start automatically saving each record to the end of page . Then Continue for next page and so on. Then check regular edit page for lat / lng fields to see if they filled in and view page to see if map filled in.
Now go back to your project and add all the fields back in you need for the list page.

Only issue there may be here is I see you have details setup . Never tried it on a list page with details records setup.


Hello John,

It is in the view page. On the 5th picture you can see I have it checked. But I did have it at the bottom. So I moved it up. Just in case.. All properties are set right on geocoding last image in above post. Here is what I have for my map settings..

I took all fields out but the address on list page. Then I re-uploaded to the server. Went to the list page, Selected all and clicked on gear. Clicked on update all. Only have 4 records on that page so took no time..After it complete. I hit edit for a record. Still no Lat and Lng in. As well as no map on view page.I will take out the details and try again. Maybe that is messing it up..

Thank You very much for trying to help me on this..

James

Tandy author 2/15/2019

Nope.. Still same thing. Took out the details. Delete all in output folder. Then re-built the program full. Up loaded it.





lefty 2/15/2019



Nope.. Still same thing. Took out the details. Delete all in output folder. Then re-built the program full. Up loaded it.




I just ran a test and it worked fine. Do you have an API key setup? for google maps? Make sure Lat and Lng are setup as number in field properties. I don't know if it has something to do with Enterprise or what. The only other thing I can suggest is make a small project with just one table for address etc.... see if that work then you know , it is something with this project.

Tandy author 2/16/2019



I just ran a test and it worked fine. Do you have an API key setup? for google maps? Make sure Lat and Lng are setup as number in field properties. I don't know if it has something to do with Enterprise or what. The only other thing I can suggest is make a small project with just one table for address etc.... see if that work then you know , it is something with this project.



I have the API key in. The map works on the List Page. Only a few unless you go in and edit them. Then more maps will show up. It is just not saving Lat and Lng to the database or the maps show on the view page..

I have other accounts on that server. Will try what you said and make a test with just that..

Thank You very much for trying to help me out on this..

James

Tandy author 2/16/2019

Ok, I made up on the same server but new site. With just contact table. I added the map in only the view and that worked. But the Lat and Lng still is not saving to the database. Then added the map to the view page and it works there as well..
https://tandyservices.net
Thank YouJames

lefty 2/16/2019



Ok, I made up on the same server but new site. With just contact table. I added the map in only the view and that worked. But the Lat and Lng still is not saving to the database. Then added the map to the view page and it works there as well..
https://tandyservices.net
Thank YouJames


At this point I would remove the Lat / Lng from the database on that table in your main project. Then in pages section geocoding create new Lat/Lng fields on the dropdown add your address fields . This will add new Lat/Lng fields to the database table automatically . Then go through the setup again.

Only thing I noticed here is my lat/lng fields are 20,10 not 10,6 in MySQL . But really should not matter.

Tandy author 2/16/2019



At this point I would remove the lat / lng from the database on that table in your main project. Then in pages section create new Lat/Lng fields on the dropdown. This will add new fields to the database table automatically . Then go through the setup again.



That is how I made the fields.. I did not put in myself. I let the system put them in. I will try again..

Thank You

James..

Tandy author 2/16/2019

Just re-did the test and edited what is there. Still no Lat or Lng. I also made up a new record and added same as Google Maps. Still no Lat or Lng. Edited and put in the country and still nothing..Map shows fine though..

I am thinking it might need a setting on the server.. If everyone else has no problems with it and saves the Lng and Lat on their server but mine does not. Who have to be a setting on server I would think.. I am using a API Key with every MAP API enabled nothing else.. Not a Server Key at Google? Would that be the problem?

Thank You.James

Edit.. Just tried the server key and can not even get maps to show..

lefty 2/16/2019



Just re-did the test and edited what is there. Still no Lat or Lng. I also made up a new record and added same as Google Maps. Still no Lat or Lng. Edited and put in the country and still nothing..Map shows fine though..

I am thinking it might need a setting on the server.. If everyone else has no problems with it and saves the Lng and Lat on their server but mine does not. Who have to be a setting on server I would think.. I am using a API Key with every MAP API enabled nothing else.. Not a Server Key at Google? Would that be the problem?

Thank You.James

Edit.. Just tried the server key and can not even get maps to show..


You just need a API map key from google . You do have google checked in your geocoding correct with a the key below it ? Do you have maps like this working in any other versions of phprunner or tables in this project ?
" [size="2"]I am using a API Key with every MAP API enabled nothing else.. Not a Server Key at Google "[/size]

[size="2"]Not sure what you mean by the above?[/size]

This is where you get the API key. Click Here . On July 11th they changed how to obtain the key , I had mine before that . You have to enable billing but You won't get charged untill you reach 500,000 requests and they remind you also . there is a dashboard once you signup that you can see your requests. " This is according to this page Here but if you already had a key then it should still work as mine does.
Update you just need a browser key not server key.

Tandy author 2/16/2019



You just need a API map key from google . You do have google checked in your geocoding correct with a the key below it ? Do you have maps like this working in any other versions of phprunner or tables in this project ?
" [size="2"]I am using a API Key with every MAP API enabled nothing else.. Not a Server Key at Google "[/size]

[size="2"]Not sure what you mean by the above?[/size]

This is where you get the API key. Click Here . On July 11th they changed how to obtain the key , I had mine before that . You have to enable billing but You won't get charged untill you reach 500,000 requests and they remind you also . there is a dashboard once you signup that you can see your requests. " This is according to this page Here but if you already had a key then it should still work as mine does.
Update you just need a browser key not server key.

Hello John,Yes I have the Google API Key in.. I tried the Server Key but I found out that wont work. So put it back as the browser Key. The maps work fine it is just the Lat and Lng not saving.. That is where I will start getting charged as I understand it.

Thank You

James

lefty 2/16/2019



Hello John,Yes I have the Google API Key in.. I tried the Server Key but I found out that wont work. So put it back as the browser Key. The maps work fine it is just the Lat and Lng not saving.. That is where I will start getting charged as I understand it.

Thank You

James



You don't get charged as you have very few records . That doesn't start till like 500,000. per day as far as I understand. Only if you were to use traffic and directions would you have to pay and even that has a lot of records before you get charged. At this point I would load the project to the demo account and ask support to look at it. I know I can fix it , but can't do it with out the project and I don't have enterprise just regular 10 . You can zip me that test project if you like as long as it is not security sensitive and I will fix it and send it back to you . See my profile to send an email and I will send it back to you so you can zip that one table test and send back to me. That's about all I can do at this point. Had some time today so willing to help you out. Just sitting here watching the xfinity race on my other screen.

Tandy author 2/16/2019



You don't get charged as you have very few records . That doesn't start till like 500,000. per day as far as I understand. Only if you were to use traffic and directions would you have to pay and even that has a lot of records before you get charged. At this point I would load the project to the demo account and ask support to look at it. I know I can fix it , but can't do it with out the project and I don't have enterprise just regular 10 . You can zip me that test project if you like as long as it is not security sensitive and I will fix it and send it back to you . See my profile to send an email and I will send it back to you so you can zip that one table test and send back to me. That's about all I can do at this point. Had some time today so willing to help you out. Just sitting here watching the xfinity race on my other screen.



Soon I will have the whole company using the site. That is when I will get nervous. There are Three different kinds of Directories that they will be using. Would like to know about the traffic weather and directions to add to Google Maps.. Was looking in the forums to see if anyone added but did not find anything..

I have no problem sending you that file at all.. Will do that..

Thank You for all your help and trying to help me out on this..James

Tandy author 2/16/2019

Thank you guys for helping me out on this. It is the Google API Key. There were some restrictions that I had to remove to get Lat and Lng to save to the database.The problem is now solved and it is saving to the database.
Thank Again..

James

R
ramnath 2/25/2019



Thank you guys for helping me out on this. It is the Google API Key. There were some restrictions that I had to remove to get Lat and Lng to save to the database.The problem is now solved and it is saving to the database.
Thank Again..

James



James
Could you share what you did to resolve the restrictions please?
Thanks

Ramsy

lefty 2/25/2019



James
Could you share what you did to resolve the restrictions please?
Thanks

Ramsy


You have to sign the API key to the URL domain you are using when you signup. Localhost does not seem to work without an api for the actual localhost without billing enabled anymore in at least my case click here and try . See newer google documentation on maps. There is some outdated google map api documentation still out there. You would think google would take it down.

Tandy author 2/26/2019



James
Could you share what you did to resolve the restrictions please?
Thanks

Ramsy



At this time I did not figure out what to put in for the domain. So I have no security on that key.. I tried my domain name with https:// and http://. Will not save the lat and lng to database. I even tried https:///domainname/ and https://domainname/* and still will not save to database. But if I leave it blank it does save to database..