Posts: 339
Threads: 42
Joined: Apr 2010
Reputation:
2
May 4th, 2010, 3:50 PM
(This post was last modified: May 4th, 2010, 9:02 PM by alexh.)
I have created a form that accepts addresses and intersections. Has anyone figured out a way call the database info from a google map?
The problem I see is that my web form gets an address from the user, but google needs latitude/longitude. I haven't been able to find anything that will parse the address into latitude/longitude and place it into the database.
It would be nice to have a module that allows someone map their "views" or filters, all submissions, or individual submissions.
Any ideas anyone?
-Alex
Posts: 2,456
Threads: 39
Joined: Dec 2008
Reputation:
6
Hi Alex,
Cool! I'm actually working on something pretty similar right now - I'm adding a section to this site where people can say hello and say where they're using Form Tools. All Google Maps based. This is something I've been meaning to add for... ooh, 4 years?
The standard way to do it is have some Ajax code running on page load that calls a PHP page on your site. That PHP file queries the database and returns the info in XML or JSON format, which is then loaded into your map.
For the PHP side of things, you'll probably just want to use some custom SQL. I looked over the functions within the API & core code and they're all kind of custom. Plus you really want something fast that runs with no overhead - the existing functions do LOTS of stuff that you probably don't need. However, check out ft_search_submissions() (found in /global/code/submissions.php). It's pretty useful, but it requires figuring out what information to pass it as parameters.
Failing that, I'd stick with a simple SQL query to return those results you want.
Sorry I couldn't be more help. Good luck with it!
- Ben
Posts: 339
Threads: 42
Joined: Apr 2010
Reputation:
2
May 8th, 2010, 5:33 PM
(This post was last modified: May 8th, 2010, 5:39 PM by alexh.)
(May 8th, 2010, 10:19 AM)Ben Wrote: Hi Alex,
Cool! I'm actually working on something pretty similar right now - I'm adding a section to this site where people can say hello and say where they're using Form Tools. All Google Maps based. This is something I've been meaning to add for... ooh, 4 years?
The standard way to do it is have some Ajax code running on page load that calls a PHP page on your site. That PHP file queries the database and returns the info in XML or JSON format, which is then loaded into your map.
For the PHP side of things, you'll probably just want to use some custom SQL. I looked over the functions within the API & core code and they're all kind of custom. Plus you really want something fast that runs with no overhead - the existing functions do LOTS of stuff that you probably don't need. However, check out ft_search_submissions() (found in /global/code/submissions.php). It's pretty useful, but it requires figuring out what information to pass it as parameters.
Failing that, I'd stick with a simple SQL query to return those results you want.
Sorry I couldn't be more help. Good luck with it!
- Ben
Thanks Ben,
I think I understand what you are saying. I've been doing a bit of research, and that's pretty much what has been explained to me by everyone else.
Have you seen any existing Ajax code out there that does this? I'm pretty good at getting existing scripts working and adjusting them a bit to work with my needs, but starting from scratch is a little overwhelming! This google API stuff is not the easiest to understand though.
Keep me updated on what you get going, I'd be curious to see if I can make it work for my application!
Thanks again,
Alex
Posts: 7
Threads: 3
Joined: May 2010
Reputation:
0
May 13th, 2010, 9:34 PM
(This post was last modified: May 13th, 2010, 9:39 PM by prometheus.)
Howzabout this:
http://maps.google.com/maps?q=1600%20Pen...ve%2020500
Just insert a '%20' in each space, and create a string/variable with the address in the format '###StreetHere%20AveStDrEtcHere%20ZipCodeHereIe12345
Pretty slick.
Merge in your street address and zipcode after the string 'http://maps.google.com/maps?typeaddresshere'
Hope that helps a little bit.
::: p
Posts: 2,456
Threads: 39
Joined: Dec 2008
Reputation:
6
And here's a first draft of my own Google Maps script:
http://hello.formtools.org/
You can view the JS here:
http://hello.formtools.org/global/scripts/maps.js
It's NOT very pretty (!!), but it may give you a few ideas. The server side code being loaded via an Ajax request just creates a JSON object containing the website info for showing on the map.
As soon as there are lots more websites listed for the map, I'll need to refactor it to load the content better. Still, it's a first step.
- Ben
Posts: 36
Threads: 12
Joined: Mar 2009
Reputation:
0
This is incredible! I am blown away by Form Tools 2.1. I especially love the google maps module. I am hoping to implement it on a website that I am doing for a construction company but I am having a bit of trouble with the map.
I currently have an internal form where the client manages each project and it is diplayed dynamically on the website ( http://www.carverconstruction.ca/cc_projects.php). However, the client would like the added feature of a map that shows each location and when they click on each starred location it brings up the information below. Furthermore, they want to be able to edit this right from formtools. I have experimented with Map Channels but it just isn't what I am looking for.
After seeing the new google map module, ( http://hello.formtools.org/) it is exactly what they had in mind. I just don't know how to display it on the webpage. Is there anyone who can write a customized script for me? If so, how much would it cost?
(May 14th, 2010, 6:24 PM)Ben Wrote: And here's a first draft of my own Google Maps script:
http://hello.formtools.org/
You can view the JS here:
http://hello.formtools.org/global/scripts/maps.js
It's NOT very pretty (!!), but it may give you a few ideas. The server side code being loaded via an Ajax request just creates a JSON object containing the website info for showing on the map.
As soon as there are lots more websites listed for the map, I'll need to refactor it to load the content better. Still, it's a first step.
- Ben
Posts: 415
Threads: 0
Joined: Mar 2009
Reputation:
3
Hey Sogreen,
Thanks so much for the feedback. We've put a lot of thought into 2.1 and hope that it will make everyone's lives a bit easier.
I'll PM you in regards to the customization work. Just to give you a heads up things are pretty crazy at the moment with the release of our Facebook form builder module. Our schedule is booked pretty solid at the moment but we'll do our best to help you out.
Cheers,
Joe
|