Subscribe to this thread
Home - General / All posts - Converting Image to Points
pslinder1
126 post(s)
online
#19-Oct-18 00:22

I have a Geotiff image/surface that I need to convert to a vector file of Lat Long points with a height value. Does anyone know how to do this with Manifold 9?

Thanks in advance.

Dimitri

5,082 post(s)
#19-Oct-18 09:36

Consider this example - you can then create centroids for each area created. Or, you can create a mesh of points and transfer heights from the created areas to the points they contain.

pslinder1
126 post(s)
online
#19-Oct-18 15:28

It seems to me that the problem with this approach is that areas that end of being traced do not exactly match the boundaries of the raster boxes. It seems to merge neighboring and equal values into larger regions. This means that I can't get the centroids for each raster box.

Is there a trick I am missing?

tjhb

8,335 post(s)
#19-Oct-18 15:35

You could adapt the code here, to create pixel centroids instead of boxes.

pslinder1
126 post(s)
online
#19-Oct-18 16:40

How do you create a mesh of points?

Dimitri

5,082 post(s)
#22-Oct-18 07:53

I use 8, because I'm lazy, but you could do that in 9 with SQL or a simple script.

pslinder1
126 post(s)
online
#22-Oct-18 15:37

I ask on the forum because I am lazy

adamw


8,204 post(s)
#29-Oct-18 15:47

See attached MXB.

Open MXB. Run the query (make_points). This will (re-)populate the drawing with points from the image. After the query completes, you can open the image, drop the drawing into it, see it line up with the image, click individual points to see pixel coordinates and height, etc.

The query:

--SQL9

DELETE FROM [german_alps_points];

INSERT INTO [german_alps_points] ([geom][value])

SELECT GeomMakePoint(VectorMakeX2([tx]*128 + [x][ty]*128 + [y])), [value]

FROM (

  SELECT [x] AS [tx][y] AS [ty]SPLIT CALL TileToValues([tile])

  FROM [german_alps Tiles]

);

The number 128 is the tile size - you can retrieve it from image properties dynamically in the query instead of hard-coding.

Hope this helps.

Attachments:
make-points.mxb

tjhb

8,335 post(s)
#30-Oct-18 01:33

To get points in pixel centres (rather than lower left corner)

--SQL9

...

SELECT GeomMakePoint(VectorMakeX2([tx]*128 + [x] + 0.5[ty]*128 + [y] + 0.5)), [value]

...

adamw


8,204 post(s)
#30-Oct-18 08:19

Good catch, thanks.

pslinder1
126 post(s)
online
#06-Nov-18 01:08

Thank you both.

Manifold User Community Use Agreement Copyright (C) 2007-2017 Manifold Software Limited. All rights reserved.