Quantcast

Anyone have a simple way of rendering vectors as images?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Anyone have a simple way of rendering vectors as images?

Jeff Adams-4
I need to be able to render vector data (that I've built using NTS) so I can overlay it onto an image.  Ideally I'd just send the vector back to the map server and tell it "Hey add this onto the image" but our map server doesn't support that, so I have to do it after the fact.

I'm just fishing for ideas here, otherwise I'll probably convert the image from the map server into a bitmap, do math to convert all the vector coordinates into bitmap offsets, and draw the vectors using image operations, then convert the bitmap back to a png and be done.

However that sounds like a lot of work and this really seems like something people would have done before... so any ideas?

Thanks,
Jeff

_______________________________________________
jts-devel mailing list
[hidden email]
http://lists.refractions.net/mailman/listinfo/jts-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Anyone have a simple way of rendering vectors as images?

Sunburned Surveyor
Jeff,

I'm not an experienced .NET programmer, so bear with me.

Can't you convert NTS geometries into the graphic primitives used by
Microsoft's GUI drawing libraries? If you can do this there should be
a built-in component that can render those graphic primitives as an
image.

In Java you'd convert the JTS geometry into a Java2D graphic
primitive, and then have Swing/AWT render this graphic primitive as an
image. In fact, this is how OpenJUMP renders feature geometries.

I hope that helps.

The Sunburned Surveyor

On Thu, Oct 30, 2008 at 6:52 AM, Jeff Adams <[hidden email]> wrote:

> I need to be able to render vector data (that I've built using NTS) so I can
> overlay it onto an image.  Ideally I'd just send the vector back to the map
> server and tell it "Hey add this onto the image" but our map server doesn't
> support that, so I have to do it after the fact.
>
> I'm just fishing for ideas here, otherwise I'll probably convert the image
> from the map server into a bitmap, do math to convert all the vector
> coordinates into bitmap offsets, and draw the vectors using image
> operations, then convert the bitmap back to a png and be done.
>
> However that sounds like a lot of work and this really seems like something
> people would have done before... so any ideas?
>
> Thanks,
> Jeff
>
> _______________________________________________
> jts-devel mailing list
> [hidden email]
> http://lists.refractions.net/mailman/listinfo/jts-devel
>
>
_______________________________________________
jts-devel mailing list
[hidden email]
http://lists.refractions.net/mailman/listinfo/jts-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Anyone have a simple way of rendering vectors as images?

Rory Plaire
Hey Jeff,
 
SharpMap (www.codeplex.com/SharpMap) does this to an extent. Have you looked at it?

On Thu, Oct 30, 2008 at 7:57 AM, Sunburned Surveyor <[hidden email]> wrote:
Jeff,

I'm not an experienced .NET programmer, so bear with me.

Can't you convert NTS geometries into the graphic primitives used by
Microsoft's GUI drawing libraries? If you can do this there should be
a built-in component that can render those graphic primitives as an
image.

In Java you'd convert the JTS geometry into a Java2D graphic
primitive, and then have Swing/AWT render this graphic primitive as an
image. In fact, this is how OpenJUMP renders feature geometries.

I hope that helps.

The Sunburned Surveyor

On Thu, Oct 30, 2008 at 6:52 AM, Jeff Adams <[hidden email]> wrote:
> I need to be able to render vector data (that I've built using NTS) so I can
> overlay it onto an image.  Ideally I'd just send the vector back to the map
> server and tell it "Hey add this onto the image" but our map server doesn't
> support that, so I have to do it after the fact.
>
> I'm just fishing for ideas here, otherwise I'll probably convert the image
> from the map server into a bitmap, do math to convert all the vector
> coordinates into bitmap offsets, and draw the vectors using image
> operations, then convert the bitmap back to a png and be done.
>
> However that sounds like a lot of work and this really seems like something
> people would have done before... so any ideas?
>
> Thanks,
> Jeff
>
> _______________________________________________
> jts-devel mailing list
> [hidden email]
> http://lists.refractions.net/mailman/listinfo/jts-devel
>
>
_______________________________________________
jts-devel mailing list
[hidden email]
http://lists.refractions.net/mailman/listinfo/jts-devel


_______________________________________________
jts-devel mailing list
[hidden email]
http://lists.refractions.net/mailman/listinfo/jts-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Anyone have a simple way of rendering vectors as images?

Jeff Adams-4
Thanks for the suggestions.  I think SharpMap is more overhead than I want, because all its operations seem to require a map object.  But using the .NET graphics stuff is looking moderately promising (I think that's what SharpMap is doing behind the scenes).

I'm looking into both options in more detail.

Jeff

On Thu, Oct 30, 2008 at 12:21 PM, CodeKaizen <[hidden email]> wrote:
Hey Jeff,
 
SharpMap (www.codeplex.com/SharpMap) does this to an extent. Have you looked at it?

On Thu, Oct 30, 2008 at 7:57 AM, Sunburned Surveyor <[hidden email]> wrote:
Jeff,

I'm not an experienced .NET programmer, so bear with me.

Can't you convert NTS geometries into the graphic primitives used by
Microsoft's GUI drawing libraries? If you can do this there should be
a built-in component that can render those graphic primitives as an
image.

In Java you'd convert the JTS geometry into a Java2D graphic
primitive, and then have Swing/AWT render this graphic primitive as an
image. In fact, this is how OpenJUMP renders feature geometries.

I hope that helps.

The Sunburned Surveyor

On Thu, Oct 30, 2008 at 6:52 AM, Jeff Adams <[hidden email]> wrote:
> I need to be able to render vector data (that I've built using NTS) so I can
> overlay it onto an image.  Ideally I'd just send the vector back to the map
> server and tell it "Hey add this onto the image" but our map server doesn't
> support that, so I have to do it after the fact.
>
> I'm just fishing for ideas here, otherwise I'll probably convert the image
> from the map server into a bitmap, do math to convert all the vector
> coordinates into bitmap offsets, and draw the vectors using image
> operations, then convert the bitmap back to a png and be done.
>
> However that sounds like a lot of work and this really seems like something
> people would have done before... so any ideas?
>
> Thanks,
> Jeff
>
> _______________________________________________
> jts-devel mailing list
> [hidden email]
> http://lists.refractions.net/mailman/listinfo/jts-devel
>
>
_______________________________________________
jts-devel mailing list
[hidden email]
http://lists.refractions.net/mailman/listinfo/jts-devel


_______________________________________________
jts-devel mailing list
[hidden email]
http://lists.refractions.net/mailman/listinfo/jts-devel



_______________________________________________
jts-devel mailing list
[hidden email]
http://lists.refractions.net/mailman/listinfo/jts-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Anyone have a simple way of rendering vectors as images?

Rory Plaire
It is doing that behind one of the scenes. If you dig into the code, specifically the classes in the http://sharpmapv2.googlecode.com/svn/trunk/SharpMap.Rendering/Gdi/GdiVectorRenderer.cs class, you could get some things you can use to speed you on your way...


 
On Thu, Oct 30, 2008 at 9:42 AM, Jeff Adams <[hidden email]> wrote:
Thanks for the suggestions.  I think SharpMap is more overhead than I want, because all its operations seem to require a map object.  But using the .NET graphics stuff is looking moderately promising (I think that's what SharpMap is doing behind the scenes).

I'm looking into both options in more detail.

Jeff


On Thu, Oct 30, 2008 at 12:21 PM, CodeKaizen <[hidden email]> wrote:
Hey Jeff,
 
SharpMap (www.codeplex.com/SharpMap) does this to an extent. Have you looked at it?

On Thu, Oct 30, 2008 at 7:57 AM, Sunburned Surveyor <[hidden email]> wrote:
Jeff,

I'm not an experienced .NET programmer, so bear with me.

Can't you convert NTS geometries into the graphic primitives used by
Microsoft's GUI drawing libraries? If you can do this there should be
a built-in component that can render those graphic primitives as an
image.

In Java you'd convert the JTS geometry into a Java2D graphic
primitive, and then have Swing/AWT render this graphic primitive as an
image. In fact, this is how OpenJUMP renders feature geometries.

I hope that helps.

The Sunburned Surveyor

On Thu, Oct 30, 2008 at 6:52 AM, Jeff Adams <[hidden email]> wrote:
> I need to be able to render vector data (that I've built using NTS) so I can
> overlay it onto an image.  Ideally I'd just send the vector back to the map
> server and tell it "Hey add this onto the image" but our map server doesn't
> support that, so I have to do it after the fact.
>
> I'm just fishing for ideas here, otherwise I'll probably convert the image
> from the map server into a bitmap, do math to convert all the vector
> coordinates into bitmap offsets, and draw the vectors using image
> operations, then convert the bitmap back to a png and be done.
>
> However that sounds like a lot of work and this really seems like something
> people would have done before... so any ideas?
>
> Thanks,
> Jeff
>
> _______________________________________________
> jts-devel mailing list
> [hidden email]
> http://lists.refractions.net/mailman/listinfo/jts-devel
>
>
_______________________________________________
jts-devel mailing list
[hidden email]
http://lists.refractions.net/mailman/listinfo/jts-devel


_______________________________________________
jts-devel mailing list
[hidden email]
http://lists.refractions.net/mailman/listinfo/jts-devel



_______________________________________________
jts-devel mailing list
[hidden email]
http://lists.refractions.net/mailman/listinfo/jts-devel



_______________________________________________
jts-devel mailing list
[hidden email]
http://lists.refractions.net/mailman/listinfo/jts-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Anyone have a simple way of rendering vectors as images?

Jeff Adams-4
Yep, thanks.  I copied/hacked up a bunch of code from that class (and two methods from elsewhere) and have successfully rendered 1 point to an otherwise blank image :-).  Now to see if it's actually correct...

Jeff

On Thu, Oct 30, 2008 at 12:51 PM, CodeKaizen <[hidden email]> wrote:
It is doing that behind one of the scenes. If you dig into the code, specifically the classes in the http://sharpmapv2.googlecode.com/svn/trunk/SharpMap.Rendering/Gdi/GdiVectorRenderer.cs class, you could get some things you can use to speed you on your way...


 
On Thu, Oct 30, 2008 at 9:42 AM, Jeff Adams <[hidden email]> wrote:
Thanks for the suggestions.  I think SharpMap is more overhead than I want, because all its operations seem to require a map object.  But using the .NET graphics stuff is looking moderately promising (I think that's what SharpMap is doing behind the scenes).

I'm looking into both options in more detail.

Jeff


On Thu, Oct 30, 2008 at 12:21 PM, CodeKaizen <[hidden email]> wrote:
Hey Jeff,
 
SharpMap (www.codeplex.com/SharpMap) does this to an extent. Have you looked at it?

On Thu, Oct 30, 2008 at 7:57 AM, Sunburned Surveyor <[hidden email]> wrote:
Jeff,

I'm not an experienced .NET programmer, so bear with me.

Can't you convert NTS geometries into the graphic primitives used by
Microsoft's GUI drawing libraries? If you can do this there should be
a built-in component that can render those graphic primitives as an
image.

In Java you'd convert the JTS geometry into a Java2D graphic
primitive, and then have Swing/AWT render this graphic primitive as an
image. In fact, this is how OpenJUMP renders feature geometries.

I hope that helps.

The Sunburned Surveyor

On Thu, Oct 30, 2008 at 6:52 AM, Jeff Adams <[hidden email]> wrote:
> I need to be able to render vector data (that I've built using NTS) so I can
> overlay it onto an image.  Ideally I'd just send the vector back to the map
> server and tell it "Hey add this onto the image" but our map server doesn't
> support that, so I have to do it after the fact.
>
> I'm just fishing for ideas here, otherwise I'll probably convert the image
> from the map server into a bitmap, do math to convert all the vector
> coordinates into bitmap offsets, and draw the vectors using image
> operations, then convert the bitmap back to a png and be done.
>
> However that sounds like a lot of work and this really seems like something
> people would have done before... so any ideas?
>
> Thanks,
> Jeff
>
> _______________________________________________
> jts-devel mailing list
> [hidden email]
> http://lists.refractions.net/mailman/listinfo/jts-devel
>
>
_______________________________________________
jts-devel mailing list
[hidden email]
http://lists.refractions.net/mailman/listinfo/jts-devel


_______________________________________________
jts-devel mailing list
[hidden email]
http://lists.refractions.net/mailman/listinfo/jts-devel



_______________________________________________
jts-devel mailing list
[hidden email]
http://lists.refractions.net/mailman/listinfo/jts-devel



_______________________________________________
jts-devel mailing list
[hidden email]
http://lists.refractions.net/mailman/listinfo/jts-devel



_______________________________________________
jts-devel mailing list
[hidden email]
http://lists.refractions.net/mailman/listinfo/jts-devel
Loading...