Concepting a MAP script from a huge JPG image

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
aka_eu
Forum Newbie
Posts: 9
Joined: Wed Sep 28, 2005 10:13 am

Concepting a MAP script from a huge JPG image

Post by aka_eu »

Hi,

I'm an old observer of the activity from this forum, but now is the first time I'm posting.

I have to develop a new feature from one of my websites and I am not sure how to concept the project to match my requirements. That's why I'm looking for your suggestions to avoid mistakes before losing some days of developing

I have a huge file for the moment it's in Corel Draw but can be simply exported to any image format, file that contain the MAP of my city.

I want to add this map to my own city portal in a more friendly way

I want users to see at one moment an image (or image collation) for a size of 300x300 px
- zoom possible until a level that I will choose
- move left,right,top,down
- set on the map coordinates for some location ( and that need to be shown as here ( an alistapart.com tutorial http://www.alistapart.com/d/cssmaps/mapfinal/index.html )

I was thinking of generating 7 maps one per each zoom level that I want users to have access.

For each level of images to cut the map in many pieces so at the final when the user want to see some zone at let's say 5th level the user to see actually 9 small images that form that large image of 300x300px (I'm thinking also to pregenerate all the possible combinations for each level of zoom to avoid memory usage when users will browse the map).

For now if I will generate all these images I will have to put into the DB these info for each generated zone.
- starting coordinates (XY from the original TOP LEFT corner)
- ending coordinates
- id of the images that will correspond to left, top, right, bottom movements over the map
- id of the zoom OUT and also for the zoom IN (if applicable)

So what do you thing until now my concept is good or completely wrong ?

Of course that I also have some questions on how to generate all that images for different zooms level

Here I thought to export from CDraw 7 different images with the complete map but for width different resolutions
1: 300x300
2: 600x600
3: 1200x1200
4: 2400x2400
5: 4800x4800 (I'm actually thinking of stopping here actually because of the huge resources that I will need from my server to store the images)
6: 9600x9600
7: 19200x19200

For each image I should make a PHP script of maybe I will write a standalone application in (VB or C++) that will generate all the images

For example
- for the level 3 (1200x1200) I will have to generate
100 images
- for the level 4 (2400x2400) I will have to generate
484 images
....

Any suggestions ?
User avatar
Mordred
DevNet Resident
Posts: 1579
Joined: Sun Sep 03, 2006 5:19 am
Location: Sofia, Bulgaria

Post by Mordred »

Yep, it should work okay.
That's more or less what these guys did: http://bgmaps.com (click on any city name and browse around)
aka_eu
Forum Newbie
Posts: 9
Joined: Wed Sep 28, 2005 10:13 am

Post by aka_eu »

Yes,

just that I have to generate all the possibilities of viewing an area (not showing 4 images at one moment)

Anyway I still wait for 1-2 days before I will write any line. In this way maybe some other people will consider my point of view correct
User avatar
neel_basu
Forum Contributor
Posts: 454
Joined: Wed Dec 06, 2006 9:33 am
Location: Picnic Garden, Kolkata, India

Post by neel_basu »

Are You Trying To Make It Just Like Google Map ??
aka_eu
Forum Newbie
Posts: 9
Joined: Wed Sep 28, 2005 10:13 am

Post by aka_eu »

No I don;t intend to be exactly like google map. I only want to ad some nice functionality to my city portal.

And allways I like it to write the code by my self
User avatar
neel_basu
Forum Contributor
Posts: 454
Joined: Wed Dec 06, 2006 9:33 am
Location: Picnic Garden, Kolkata, India

Post by neel_basu »

I Think Your Stand alone Application Will Take X axis And Y axis Values As Arguments
so In The Page You Can Use hidden Fields to store Curretnt
starting x,ending x,starting y,ending y,
When The User Will Click On Left/Right/Up/Down It Will Send The Following To A Server Side php Script
1.Direction 2.starting x,ending x,starting y,ending y, Through GET/POST
After The php Script Got The Request It Will exec() Your C++ Programm With Those
Data And Get The Location Of The Image Made By The Programm As output
Then It Will Send This Image Location To The Client Side.

I Think If You Use AJAX in Client Side That Would Be The Best
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post by Kieran Huggins »

You shouldn't need to store all that info in a database since it's all predictable.

Start with the zoomed in map, then for each level of de-magnification, multiply the x and y co-ordinates by the resizing ratio to compensate, then serve the appropriate tile. This will make it easier to handle zooming-in properly, since you can use some javascript to relay the pixel offset.

Cheers,
Kieran
Post Reply