How to generate 3d image like GPS device?

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

How to generate 3d image like GPS device?

Stephen Woodbridge
Hi all,

Sorry for the cross posting. I need to find out how to make mapserver
generate map images that appear like the 3D mode of GPS devices. See
attached image.

Has anyone done this? How?
Any thoughts on how to to hack the code to do this?

Thanks,
   -Steve W

pic1-1.jpg (61K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: How to generate 3d image like GPS device?

Tamas Szekeres
2008/2/27, Stephen Woodbridge <[hidden email]>:
> Hi all,
>
>  Sorry for the cross posting. I need to find out how to make mapserver
>  generate map images that appear like the 3D mode of GPS devices. See
>  attached image.
>
>  Has anyone done this? How?
>  Any thoughts on how to to hack the code to do this?
>

Stephen,

I think we should add a special renderer for doing such things, and it
would require to do some additional coordinate transformations for the
shapes and additional special effects like  drawing the horizon and
use gradient fade out for distant areas etc. I don't think it would be
a scope of instant hack in the code.

I wonder which use case would make this option reasonable though. Are
you planning to utilize a permanent client-server connection with the
mobile application, or compile mapserver to your mobile platform?

Best regards,

Tamas
Reply | Threaded
Open this post in threaded view
|

Re: How to generate 3d image like GPS device?

Stephen Woodbridge
Tamas Szekeres wrote:

> 2008/2/27, Stephen Woodbridge <[hidden email]>:
>> Hi all,
>>
>>  Sorry for the cross posting. I need to find out how to make mapserver
>>  generate map images that appear like the 3D mode of GPS devices. See
>>  attached image.
>>
>>  Has anyone done this? How?
>>  Any thoughts on how to to hack the code to do this?
>>
>
> Stephen,
>
> I think we should add a special renderer for doing such things, and it
> would require to do some additional coordinate transformations for the
> shapes and additional special effects like  drawing the horizon and
> use gradient fade out for distant areas etc. I don't think it would be
> a scope of instant hack in the code.

Tamas,

Thank you for your response.

Yes, you may be right. I think there are a variety of levels of
implementation. Initially just getting mapserver to render a tilted view
without all the special effects would be a start. I was thinking of the
possibility of hacking the projection matrix to achieve this, although
I'm not sure how or if that is possible.

The image also has an implied point of viewer that is used to orient
"up" for the image.

> I wonder which use case would make this option reasonable though. Are
> you planning to utilize a permanent client-server connection with the
> mobile application, or compile mapserver to your mobile platform?

Mobile devices can be Windows/Linux laptops along with those normally
thought of as mobile.

Best regards,
   -Steve W

> Best regards,
>
> Tamas
Reply | Threaded
Open this post in threaded view
|

Re: How to generate 3d image like GPS device?

Steve Lime
In reply to this post by Stephen Woodbridge
An oblique projection would be *really* cool. You could possibly hack the horizon using
inline features and a gradient fill. Yes, we don't support the gradient fill yet (although it
could be done with a PIXMAP symbol) but Thomas was poking around in that direction
with a alpha gradient skeleton proposal a few weeks ago and I was interested in seeing
that become more general to support color gradients within and across features.

Steve

>>> Stephen Woodbridge <[hidden email]> 02/27/08 8:57 AM >>>
Tamas Szekeres wrote:

> 2008/2/27, Stephen Woodbridge <[hidden email]>:
>> Hi all,
>>
>>  Sorry for the cross posting. I need to find out how to make mapserver
>>  generate map images that appear like the 3D mode of GPS devices. See
>>  attached image.
>>
>>  Has anyone done this? How?
>>  Any thoughts on how to to hack the code to do this?
>>
>
> Stephen,
>
> I think we should add a special renderer for doing such things, and it
> would require to do some additional coordinate transformations for the
> shapes and additional special effects like  drawing the horizon and
> use gradient fade out for distant areas etc. I don't think it would be
> a scope of instant hack in the code.

Tamas,

Thank you for your response.

Yes, you may be right. I think there are a variety of levels of
implementation. Initially just getting mapserver to render a tilted view
without all the special effects would be a start. I was thinking of the
possibility of hacking the projection matrix to achieve this, although
I'm not sure how or if that is possible.

The image also has an implied point of viewer that is used to orient
"up" for the image.

> I wonder which use case would make this option reasonable though. Are
> you planning to utilize a permanent client-server connection with the
> mobile application, or compile mapserver to your mobile platform?

Mobile devices can be Windows/Linux laptops along with those normally
thought of as mobile.

Best regards,
   -Steve W

> Best regards,
>
> Tamas
Reply | Threaded
Open this post in threaded view
|

Re: How to generate 3d image like GPS device?

Ed McNierney-4
In reply to this post by Stephen Woodbridge
Steve -

I don't have much time to investigate this now, but I would start by looking at a standard MapServer usage of the Tilted Perspective (proj=tpers) projection, supported by PROJ.  There's an overview of it in Snyder's book (Chapter 23) with an appropriate illustration on page 172 (altitude is too high, but the same idea, and the sample parameters are explained).

This obviously doesn't address the more sophisticated effects Steve and Tamas mention, although you could probably fake them pretty easily if were always generating images with a fixed altitude and angle to the horizon.

     - Ed

Ed McNierney
Chief Mapmaker
Demand Media / TopoZone.com
73 Princeton Street, Suite 305
North Chelmsford, MA  01863
[hidden email]
Phone: +1 (978) 251-4242
Fax: +1 (978) 251-1396

-----Original Message-----
From: UMN MapServer Developers List [mailto:[hidden email]] On Behalf Of Stephen Woodbridge
Sent: Wednesday, February 27, 2008 8:49 AM
To: [hidden email]
Subject: [MAPSERVER-DEV] How to generate 3d image like GPS device?

Hi all,

Sorry for the cross posting. I need to find out how to make mapserver generate map images that appear like the 3D mode of GPS devices. See attached image.

Has anyone done this? How?
Any thoughts on how to to hack the code to do this?

Thanks,
   -Steve W
Reply | Threaded
Open this post in threaded view
|

Re: How to generate 3d image like GPS device?

Brent Fraser
In reply to this post by Stephen Woodbridge
Stephen,

  A cheap way to approximate the projective transformation
might be to apply a x-axis scaling with the scaling factor
varying linearly along the y-axis, basically squishing it at
the top.  In other words, render the map image, then
resample each line of pixels (with a resampling value of say
10% for the top line of pixels to 100% of the bottom line),
then clip and add other stuff (sky etc).  Then there's the
problem of heading-up instead of north-up.  The map file
does have a rotation setting, which might help.

  In the end, I think a more rigorous projective
transformation would give better results (preserving line
widths, etc).  And there may be so many "special" features
that it would make more sense to have a separate "NavServer"
(with its own map file/API objects) instead of
warping/adding-noise to the more traditional MapServer to do
the task.  But as Steve Lime say, it would be cool to see in
Mapserver.  And 3d is the future...

Brent Fraser
GeoAnalytic Inc.
Calgary, Alberta

----- Original Message -----
From: "Stephen Woodbridge" <[hidden email]>
To: <[hidden email]>
Sent: Wednesday, February 27, 2008 7:57 AM
Subject: Re: [MAPSERVER-DEV] How to generate 3d image like
GPS device?


> Tamas Szekeres wrote:
> > 2008/2/27, Stephen Woodbridge <[hidden email]>:
> >> Hi all,
> >>
> >>  Sorry for the cross posting. I need to find out how to
make mapserver
> >>  generate map images that appear like the 3D mode of
GPS devices. See
> >>  attached image.
> >>
> >>  Has anyone done this? How?
> >>  Any thoughts on how to to hack the code to do this?
> >>
> >
> > Stephen,
> >
> > I think we should add a special renderer for doing such
things, and it
> > would require to do some additional coordinate
transformations for the
> > shapes and additional special effects like  drawing the
horizon and
> > use gradient fade out for distant areas etc. I don't
think it would be
> > a scope of instant hack in the code.
>
> Tamas,
>
> Thank you for your response.
>
> Yes, you may be right. I think there are a variety of
levels of
> implementation. Initially just getting mapserver to render
a tilted view
> without all the special effects would be a start. I was
thinking of the
> possibility of hacking the projection matrix to achieve
this, although
> I'm not sure how or if that is possible.
>
> The image also has an implied point of viewer that is used
to orient
> "up" for the image.
>
> > I wonder which use case would make this option
reasonable though. Are
> > you planning to utilize a permanent client-server
connection with the
> > mobile application, or compile mapserver to your mobile
platform?
>
> Mobile devices can be Windows/Linux laptops along with
those normally
> thought of as mobile.
>
> Best regards,
>    -Steve W
>
> > Best regards,
> >
> > Tamas
Reply | Threaded
Open this post in threaded view
|

Re: How to generate 3d image like GPS device?

Stephen Woodbridge
In reply to this post by Ed McNierney-4
Ed,

Thank you for the loan of the book.

Devs,

I tried using the proj=tpers feature of PROJ, but I'm not sure how to
set the parameters. So I added the following to the map object. h=
should be the height above the earth in some units. I started a 1 and
enlarged it by 2 orders of magnitude until I got it to do somthing
different then narrowed the search, but never get a map :(

   EXTENT -180.0 -90.0 180.0 90.0
   UNITS DD
   PROJECTION
     "proj=tpers"
     #"h=1000000" # fast
     #"h=8000000" # slow
     "h=8400000" # slow
     #"h=8500000" # fast
     #"h=10000000" # fast
     "tilt=0"
     "azi=0"
   END

and all my LAYER defs have

     PROJECTION
       "proj=latlong"
       "ellps=WGS84"
       "datum=WGS84"
     END

Was about to get it to the point the mapserver used 100% CPU for a very
long time and returned a white image, probably timed out.

tilt=0 should mean the observer is directly over the map
azi=0  should mean the north is up

So anyone have any ideas on using this feature of proj4?

-Steve W


Ed McNierney wrote:

> Steve -
>
> I don't have much time to investigate this now, but I would start by
> looking at a standard MapServer usage of the Tilted Perspective
> (proj=tpers) projection, supported by PROJ.  There's an overview of
> it in Snyder's book (Chapter 23) with an appropriate illustration on
> page 172 (altitude is too high, but the same idea, and the sample
> parameters are explained).
>
> This obviously doesn't address the more sophisticated effects Steve
> and Tamas mention, although you could probably fake them pretty
> easily if were always generating images with a fixed altitude and
> angle to the horizon.
>
> - Ed
>
> Ed McNierney Chief Mapmaker Demand Media / TopoZone.com 73 Princeton
> Street, Suite 305 North Chelmsford, MA  01863 [hidden email] Phone:
> +1 (978) 251-4242 Fax: +1 (978) 251-1396
>
> -----Original Message----- From: UMN MapServer Developers List
> [mailto:[hidden email]] On Behalf Of Stephen Woodbridge
> Sent: Wednesday, February 27, 2008 8:49 AM To:
> [hidden email] Subject: [MAPSERVER-DEV] How to generate
> 3d image like GPS device?
>
> Hi all,
>
> Sorry for the cross posting. I need to find out how to make mapserver
> generate map images that appear like the 3D mode of GPS devices. See
> attached image.
>
> Has anyone done this? How? Any thoughts on how to to hack the code to
> do this?
>
> Thanks, -Steve W