473,782 Members | 2,436 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dynamic Maps with php??

I have a little php application to store day hiking trips and to keep a
running total of their yearly trips for a few users. Currently they
select their hiking routes using drop lists or checkboxes containing the
names and numbers of the trails. If the route is simple the form takes
1-2 minutes to fill in, if it involves lots of tiny sections it can
become tedious to search for every trailname and may take 20 minutes.
Because of this they have asked for a map, rather than lists, and want
to open the application to the public. Hmmm..

So I'm looking to create an application where users can select their
routes, by somehow selecting lines on a map, then somehow pass this to a
php script to process.

Suggestions on how to do this are invited. I hope it's trivial, I fear
it isn't.

Craig
Jul 17 '05 #1
7 3729
On Tue, 12 Apr 2005 15:12:02 -0400, Craig Storey <cr*********@nr c.ca> wrote:
I have a little php application to store day hiking trips and to keep a
running total of their yearly trips for a few users. Currently they
select their hiking routes using drop lists or checkboxes containing the
names and numbers of the trails. If the route is simple the form takes
1-2 minutes to fill in, if it involves lots of tiny sections it can
become tedious to search for every trailname and may take 20 minutes.
Because of this they have asked for a map, rather than lists, and want
to open the application to the public. Hmmm..

So I'm looking to create an application where users can select their
routes, by somehow selecting lines on a map, then somehow pass this to a
php script to process.

Suggestions on how to do this are invited. I hope it's trivial, I fear
it isn't.


Sounds like you basically need an image map. The old-style server-side image
maps rather than client-side maps may be the way to go, since these just pass
x/y coordinates of the click to the script. You can then look up the nearest
point or line to the click and add it to the route.

http://www.w3.org/TR/html401/struct/objects.html#h-13.6

Then with the GD functions (http://php.net/image) you should be able to
superimpose a route on a map.

It's a round-trip to the server for each click - this might be a little
annoying but it's simple and safe. You could get fancy with
JavaScript/XMLHTTPRequest type things to avoid roundtrips, but you probably
want to save that for version 2 :-)

--
Andy Hassall / <an**@andyh.co. uk> / <http://www.andyh.co.uk >
<http://www.andyhsoftwa re.co.uk/space> Space: disk usage analysis tool
Jul 17 '05 #2
Craig Storey wrote:
I have a little php application to store day hiking trips and to keep a
running total of their yearly trips for a few users. Currently they
select their hiking routes using drop lists or checkboxes containing the
names and numbers of the trails. If the route is simple the form takes
1-2 minutes to fill in, if it involves lots of tiny sections it can
become tedious to search for every trailname and may take 20 minutes.
Because of this they have asked for a map, rather than lists, and want
to open the application to the public. Hmmm..

So I'm looking to create an application where users can select their
routes, by somehow selecting lines on a map, then somehow pass this to a
php script to process.

Suggestions on how to do this are invited. I hope it's trivial, I fear
it isn't.


Not really trivial, but may be easier than you think... hope you know
Flash & ActionScript... .

Flash can send/retrieve values from PHP scripts in the background by
using the getURL/loadVariables methods (as well as using XML and the
like). Since Flash uses vector art, you can use it to zoom in-and-out of
parts of a map and such. I'd go into all the details here, but that's
the kind of thing I get paid for at work... ;)

That should be enough information to allow you to find the correct stuff
on Google to help you out. I won't plug my employer's name here, I'm not
fishing for projects right now, but if you need services, email me.

--
Justin Koivisto - ju****@koivi.co m
http://koivi.com
Jul 17 '05 #3
Craig Storey wrote:
I have a little php application to store day hiking trips and to keep a
running total of their yearly trips for a few users. Currently they
select their hiking routes using drop lists or checkboxes containing the
names and numbers of the trails. If the route is simple the form takes
1-2 minutes to fill in, if it involves lots of tiny sections it can
become tedious to search for every trailname and may take 20 minutes.
Because of this they have asked for a map, rather than lists, and want
to open the application to the public. Hmmm..

So I'm looking to create an application where users can select their
routes, by somehow selecting lines on a map, then somehow pass this to a
php script to process.

Suggestions on how to do this are invited. I hope it's trivial, I fear
it isn't.

Craig


You could try to do this with SVG graphics. If you can get your maps in an
SVG format. This also means you're visitors need an SVG plugin.
But it would be a kick-ass solution...

http://www.carto.net/papers/svg/links/
http://www.webreference.com/authoring/languages/svg/
http://kartoweb.itc.nl/public_examples/SVG/
http://www.w3.org/2004/Talks/1211-Twente-
http://www.adobe.com/svg/community/external.html

Rutger
--
Rutger Claes rg*@rgc.tld
Replace tld with top level domain of belgium to contact me pgp:0x3B7D6BD6
Do not reply to the from address. It's read by /dev/null and sa-learn only

Jul 17 '05 #4
"Craig Storey" <cr*********@nr c.ca> wrote in message
news:d3******** **@nrc-news.nrc.ca...
I have a little php application to store day hiking trips and to keep a
running total of their yearly trips for a few users. Currently they
select their hiking routes using drop lists or checkboxes containing the
names and numbers of the trails. If the route is simple the form takes
1-2 minutes to fill in, if it involves lots of tiny sections it can
become tedious to search for every trailname and may take 20 minutes.
Because of this they have asked for a map, rather than lists, and want
to open the application to the public. Hmmm..

So I'm looking to create an application where users can select their
routes, by somehow selecting lines on a map, then somehow pass this to a
php script to process.

Suggestions on how to do this are invited. I hope it's trivial, I fear
it isn't.


If you know Flash, then it's trivial. If not, then Javascript is probably a
easier option, as Flash is tricky, especially when you have to deal with
remoting.

I would do it like this:

1. Create two transparent gifs per trail, one showing it as selectable and
the other as selected. These images should be of the same size as the map.
2. Overlay all these images on the map, with the CSS visibility of the
selected ones set to hidden. The HTML will look something like this:

<div style="position : relative">
<img src="map.gif">
<img src="trail1_gra y.gif" id="trail1"
style="position : absolute; left: 0; top: 0;">
<img src="trail1_red .gif" id="trail1_sel "
style="position : absolute; left: 0; top: 0; visibility: hidden">
<img src="trail2_gra y.gif" id="trail2"
style="position : absolute; left: 0; top: 0;">
<img src="trail2_red .gif" id="trail2_sel "
style="position : absolute; left: 0; top: 0; visibility: hidden">
.... etc ...
</div>

3. On top of all these, overlay a blank transparent gif of the same size as
the map. This will be used for the image map.
4. Create a client-side image map for users to click on. Use polygon regions
to define clickable area near each trail. Attach an onclick handler to each
area. The HTML will look something like the following:

<map name="trails">
<area shape="polygon" coords="123,23, 32,434,45,342"
onclick="return ToggleTrail(1)" title="Trail 1">
<area shape="polygon" coords="231,232 ,332,34,35,142"
onclick="return ToggleTrail(2)" title="Trail 1">
.... etc ...
</map>
5. In the Javascript handler toggle between the selectable and selected
image by setting the CSS visibility to hidden/visible. Save the selection
somewhere. The code will look something like this:

function ToggleTrail(num ) {
if(selected[num]) {
document.getEle mentById('trial ' + num).style.visi ble = 'visible';
document.getEle mentById('trial ' + num + '_sel').style.v isible =
'hidden';
selected[num] = false;
}
else {
document.getEle mentById('trial ' + num).style.visi ble = 'hidden';
document.getEle mentById('trial ' + num + '_sel').style.v isible =
'visible';
selected[num] = true;
}
}
6. When the user press submit, saved the selections into a hidden element
and post the form.

Obviously you will need to add code that checks whether the trails are
actually connected.
Jul 17 '05 #5
Craig Storey wrote:
I have a little php application to store day hiking trips and to keep a
running total of their yearly trips for a few users. Currently they
select their hiking routes using drop lists or checkboxes containing the
names and numbers of the trails. If the route is simple the form takes
1-2 minutes to fill in, if it involves lots of tiny sections it can
become tedious to search for every trailname and may take 20 minutes.
Because of this they have asked for a map, rather than lists, and want
to open the application to the public. Hmmm..

So I'm looking to create an application where users can select their
routes, by somehow selecting lines on a map, then somehow pass this to a
php script to process.

Suggestions on how to do this are invited. I hope it's trivial, I fear
it isn't.

Craig

Hi,
Thanks for all the great ideas!

Craig
Jul 17 '05 #6
Hi,

I have been working on a GIS for several years. I was using a ready-made
framework for it. The learning curve of a framework is often seen as a
downside, but imho if you actually need to learn about something as
complex as GIS, the opportuninty the framework offers you to learn by
looking into existing code and trying out the examples rather is an
advantage. Without the framework i would have needed much more time to
get into GIS programming.

Unfortunately this framework was Smalltalk, so it won't be much good for
php. So I agree with Rutger that you should try out SVG. Mainly because
i think it is the eayest way to learn about the graphics technology you
will need to handle those x, y coordinates from clickable maps. I don't
think SVG is ALL you need, i think you will need to build some sort of
server side representation of those graphics and things like 'trails' in
php too. I suggest you use an object oriented domain model, like the
ones used by phpPeanuts. But to know what these models should actually,
well, MODEL, SVG is a great place to start.

One other tip: The new version of MySQL has GIS extensions. These will
also help you with the server side model, and at the same time they may
boost the performance of your server side code dramatically.

If you need more advice or help, please let me know.

Greetings, succes,

Henk Verhoeven,
www.phpPeanuts.org.

BTW, for the same reason i think the learning curve of phpPeanuts is
actually an advantage if you want to learn somthing as complex as OOP ;-)

Rutger Claes wrote:
Craig Storey wrote:

I have a little php application to store day hiking trips and to keep a
running total of their yearly trips for a few users. Currently they
select their hiking routes using drop lists or checkboxes containing the
names and numbers of the trails. If the route is simple the form takes
1-2 minutes to fill in, if it involves lots of tiny sections it can
become tedious to search for every trailname and may take 20 minutes.
Because of this they have asked for a map, rather than lists, and want
to open the application to the public. Hmmm..

So I'm looking to create an application where users can select their
routes, by somehow selecting lines on a map, then somehow pass this to a
php script to process.

Suggestions on how to do this are invited. I hope it's trivial, I fear
it isn't.

Craig

You could try to do this with SVG graphics. If you can get your maps in an
SVG format. This also means you're visitors need an SVG plugin.
But it would be a kick-ass solution...

http://www.carto.net/papers/svg/links/
http://www.webreference.com/authoring/languages/svg/
http://kartoweb.itc.nl/public_examples/SVG/
http://www.w3.org/2004/Talks/1211-Twente-
http://www.adobe.com/svg/community/external.html

Rutger

Jul 17 '05 #7
Take a look at www.mountainviews.ie which uses dynamic maps built from php,
sql, image-maps, GIS, SRTM data etc.

"Craig Storey" <cr*********@nr c.ca> wrote in message
news:d3******** **@nrc-news.nrc.ca...
I have a little php application to store day hiking trips and to keep a
running total of their yearly trips for a few users. Currently they select
their hiking routes using drop lists or checkboxes containing the names and
numbers of the trails. If the route is simple the form takes 1-2 minutes
to fill in, if it involves lots of tiny sections it can become tedious to
search for every trailname and may take 20 minutes. Because of this they
have asked for a map, rather than lists, and want to open the application
to the public. Hmmm..

So I'm looking to create an application where users can select their
routes, by somehow selecting lines on a map, then somehow pass this to a
php script to process.

Suggestions on how to do this are invited. I hope it's trivial, I fear it
isn't.

Craig

Jul 17 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1421
by: piyush | last post by:
All, Has any one try creating maps with dontnet - dynamically while serving on the web? E.g. if I have maps of different counties and I want to construct a map of the state using county maps - how would that be done programmatically? Is this worth doing or to use any off-the-shelf product if it costs within 200/300 $.
1
1689
by: Steve Bishop | last post by:
I don't know if there is such a thing, but when an image swaps, can you have different image maps on it dynamically? I have product pictures with several part numbers also wihin the picture. I would like the user to be able to click on one of the part numbers next to the image and populate a text box. If I swap the image, I would like to do the same thing, but with diffent mappings. Is this possible?
3
61097
by: Sean | last post by:
Have you ever wanted to add the great features inherent in Google Maps? Here is how you do it. ============== == STEP ONE == ============== Create a new MS Access form called frmGoogleMap. Size the form to your liking...
15
9623
by: WHY | last post by:
Since there's no way to create a c# method with optional, or nullable parameters. And since you can't write an overloaded web method. Is it possible to edit the WSDL in conjunction with a c# method to make the parameter optional, or have a default value at the client consumer? --
1
2053
by: code | last post by:
Hi Grp http://www.books-download.com/?Book=1493-PHP+Hacks+%3a+Tips+%26+Tools+For+Creating+Dynamic+Websites+(Hacks) Description Programmers love its flexibility and speed; designers love its accessibility and convenience. When it comes to creating web sites, the PHP scripting language is truly a red-hot property. In fact, PHP is currently used on more than 19 million web sites, surpassing
1
1717
by: george | last post by:
Hi, I have an app that takes data from a db and maps it to a CSV file. There are multiple maps for different customers which has different formatting rules. For example, some customer wants the data to be short data others want to be long date. Another example is some do not want leading zeros in fields and some allow them. Another example, is how many decimals allowed. I am looking for a way to make this dynamic. Currently, I have...
0
1340
by: Hemanth | last post by:
Hello, I'm generating a dynamic image on a website (using php.net/image library) and I want add hyperlinks to certain locations on the image - similar to HTML image map. Could someone pls suggest me a good way of doing this - with/without having to store the dynamic image. TIA, Hemanth
0
9641
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10146
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9944
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8968
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6735
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5378
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4044
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3643
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.