Skip to main content
Solved

Vector to Raster conversion


Forum|alt.badge.img+1

Hi,

I have a point Shapefile that I would like to recreate in raster, specifically, ESRI Ascii Grid format.

However I am having issues in that when I use the 'NumericRasterizer', some of the resultant cells in the raster are up to 0.25m away from the original location of the points. Is there any way that I can set the rasterizer (or use a different transformer) to force the resultant cells to be overlaid exactly on the original points (ie: points will lay in the centre of the cell)?

Thanks

Best answer by takashi

Hi @aquamarine, I think the NumericRasterizer with your setting creates desired raster if the original points form a grid with spacing 0.5m x 0.5m. How did you confirm that the center of cells in the resulting raster have been moved 0.25m from the original points?

View original
Did this help you find an answer to your question?

11 replies

erik_jan
Contributor
Forum|alt.badge.img+18
  • Contributor
  • January 24, 2018

Have you looked at the MapnikRasterizer?

I find that one easy to use.


Forum|alt.badge.img+1
  • Author
  • January 24, 2018
erik_jan wrote:

Have you looked at the MapnikRasterizer?

I find that one easy to use.

Thanks @erik_jan

 

 

I tried the MapnikRasterizer but I am getting the following error:

 

 

REJECTING BELOW FEATURE: Polygon feature must have at least 4 coordinates...rejecting

 

 

I am importing a point shapefile not a polygon file. Is there a way to set it so that it knows I am importing point data.

 


erik_jan
Contributor
Forum|alt.badge.img+18
  • Contributor
  • January 24, 2018
aquamarine wrote:
Thanks @erik_jan

 

 

I tried the MapnikRasterizer but I am getting the following error:

 

 

REJECTING BELOW FEATURE: Polygon feature must have at least 4 coordinates...rejecting

 

 

I am importing a point shapefile not a polygon file. Is there a way to set it so that it knows I am importing point data.

 

Per imported layer in the MapnikRasterizer you can set the type of features (geometry) and the style options.

 

Have a look at this document: MapnikRasterizer

 

 


david_r
Celebrity
  • January 24, 2018

Can you show us how you've configured the NumericRasterizer?


Forum|alt.badge.img+1
  • Author
  • January 24, 2018
david_r wrote:

Can you show us how you've configured the NumericRasterizer?

Hi @david_r

 

 

These are the settings I used!

 


david_r
Celebrity
  • January 24, 2018
aquamarine wrote:
Hi @david_r

 

 

These are the settings I used!

 

This is what the transformer is doing, based on your configuration:

 

- Calculate the extent (bounding box) of all your points

 

- Divide the totalt extent into a grid of 0.5 x 0.5 meter large cells

 

- If a point is inside a cell, the cell gets the value from the point

 

So unless your points are all perfectly lined up in accordance with the grid, you'll often get these effects.

 

One way to mitigate this problem could be to set a user-defined ground extent in the NumericRasterizer and do a slight offset compared to your point extents, e.g. half a cell off (-0.25).

takashi
Influencer
  • Best Answer
  • January 24, 2018

Hi @aquamarine, I think the NumericRasterizer with your setting creates desired raster if the original points form a grid with spacing 0.5m x 0.5m. How did you confirm that the center of cells in the resulting raster have been moved 0.25m from the original points?


takashi
Influencer
  • January 25, 2018
takashi wrote:

Hi @aquamarine, I think the NumericRasterizer with your setting creates desired raster if the original points form a grid with spacing 0.5m x 0.5m. How did you confirm that the center of cells in the resulting raster have been moved 0.25m from the original points?

I checked it with this workspace. numericrasterizer-experiment.fmw (FME 2017.1.2.1)

 

Result. Looks the center of cells in the resulting raster match the original points (red).


david_r
Celebrity
  • January 25, 2018

A possible source of the issue could be that the raster cell size isn't exactly the same as the point spacing. Here's what it looks like if we use Takashi's example and set a raster cell size of 0.55 while retaining a point spacing of 0.5:

Notice how the points "drift" compared to the raster cells, eventually crossing into the neighboring cell.


takashi
Influencer
  • January 25, 2018
david_r wrote:

A possible source of the issue could be that the raster cell size isn't exactly the same as the point spacing. Here's what it looks like if we use Takashi's example and set a raster cell size of 0.55 while retaining a point spacing of 0.5:

Notice how the points "drift" compared to the raster cells, eventually crossing into the neighboring cell.

Yes, it's a possible situation. Also if the original points didn't form a grid with equi-spacing, naturally cell centers won't match the original points.

 

Another thought. Once set the cell origin to (0, 0) and then transform the raster into grid points with the RasterCellCorecer, the resulting points match left-bottom corners of the cells. It seems that FME reads an Esri ASCII Grid raster with cell origin (0, 0), so I think this is also a possible situation.

 

Anyway, let's wait for @aquamarine's response.

 


Forum|alt.badge.img+1
  • Author
  • January 29, 2018
takashi wrote:

Hi @aquamarine, I think the NumericRasterizer with your setting creates desired raster if the original points form a grid with spacing 0.5m x 0.5m. How did you confirm that the center of cells in the resulting raster have been moved 0.25m from the original points?

Thanks @takashi

 

I realize now that the issue was that my original point shapefile was not evenly gridded at 0.5m intervals and that's why I wasn't getting the NumericRasterizer to work. I will need to recreate the point shapefile with 0.5m intervals.

Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings