> Both your descriptions are logically correct, but insanely
> inefficient approaches.

Yes, I believe insane is absolutely the right word :)

> Another way of saying "vector to raster" is "rendering".  The
> existing rendering code in geotools should provide some fine examples
> of turning vectors into rasters.

You are right, I'll have a look.

> For raster to vector, your earlier post where you looked at GRASS was
> a good starting point.  Stealing the approach from GRASS and re-
> coding in Java will probably take you no longer than implementing
> your logic below, and will be much faster, guaranteed.

Yes, I already gave a look to it, but the code presents a lot of static global 
variables which makes the code not all that readable. However I will get back 
to it again at some point (also because that takes into consideration points, 
lines and areas). I just needed a fast one, so I coded that easy logic below.

Thanks,
Andrea

>
> Paul
>
> On 6-Jan-06, at 2:10 PM, andrea antonello wrote:
> > Some time ago I posted a question about how to convert features to
> > rasters and back.
> > I thought an simple way would be the following, assuming that my
> > raster is represented by a matrix grid.
> >
> > v.to.rast:
> > looping through the rows and columns of the matrix, query if the point
> > given by the coordinates (found through row and col) is inside the
> > geometry of the feature to rasterize.
> >
> >
> > r.to.vect:
> > looping through the matrix, for every cell that has a value to be
> > vectorized, create a polygon geometry of xresolution by yresolution.
> > In the end join all the polygons to a single polygon.
> > This can be awfully memory intensive, but it's a fast way to code and
> > should work.
> > Instead, I'm having problems with this. The the resulting geometry
> > doesn't exactly trace the raster. It is more or less the same as the
> > raster, but as I said, just more or less, which is not very scientific
> >
> > :)
> >
> > I'm not very expert in features yet. Does anyone see what I couldn't
> > see, notice some trouble?
> >
> > Thanks,
> > Regards,
> > Andrea
> >
> >
> > --
> > ______________________________________________________________________
> > ______
> > HydroloGIS - Environmental Open Source Solutions
> > www.hydrologis.com
> >
> > Andrea Antonello
> > Environmental Engineer
> > mobile:  +393288497722
> >
> > "Let it be as much a great honour to take as to give learning,
> > if you want to be called wise."
> > Skuggsja' - The King's mirror - 1240 Reykjavik
> > ______________________________________________________________________
> > ______
> >
> >
> > -------------------------------------------------------
> > This SF.net email is sponsored by: Splunk Inc. Do you grep through
> > log files
> > for problems?  Stop!  Download the new AJAX search engine that makes
> > searching your log files as easy as surfing the  web.  DOWNLOAD
> > SPLUNK!
> > http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
> > _______________________________________________
> > Geotools-devel mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/geotools-devel

-- 
____________________________________________________________________________
HydroloGIS - Environmental Open Source Solutions
www.hydrologis.com

Andrea Antonello
Environmental Engineer
mobile:  +393288497722

"Let it be as much a great honour to take as to give learning,
if you want to be called wise."
Skuggsja' - The King's mirror - 1240 Reykjavik
____________________________________________________________________________




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to