Subscribe to this thread
Home - General / All posts - Vectorize WMS raster image ?
JoeyD21 post(s)
#11-Oct-20 11:17

Hi, I have searched georeference.org but did not find anything that really fits my needs. However, my fuzzy memory tells me that I have read about this somewhere: Is there a way to vectorize WMS-images? I have a black and white image just with lines and 2 types of points giving propery delimiters for a federal state of Germany (URL attached, select "adv_alkis_flurstuecke"), and I would like to transform a small subset of the data (for one village, attached) into a drawing, if possible already as areas, not lines. Ideally the vectorization happens on the best zoom-level. I guess this is possible for a programming pro, but is it also possible for someone like me who can, so far, just use templates and apply and modify provided scripts? I am curious to hear your ideas!

yves61
192 post(s)
online
#12-Oct-20 13:50

Could you not fetch the required data as "open data" under the INSPIRE directive ?

JoeyD21 post(s)
#13-Oct-20 07:07

Hi Yves,

hm, I hadn't considered this, thanks! However, as far as I understand this directive, "The INSPIRE Directive lays down a number of rights and obligations regarding the sharing of spatial data sets and services between all levels of government (public authorities)". I don't fall into this category of entities. I also did not find the term "open data" in the Directive. As far as I can see, this Directive is not applicable to me. I could buy the vector data, which would be rather expensive. Of course the re-vectorization is a huge effort as well. Building it from the scratch is probably much more expensive. My question here was rather to elucidate if anyone has already done something like that, which then could be re-used.

So any further advice, on the technical challenge or on EU-Directives, is still welcome. Thanks in advance!

JoeyD

Post Reply

JoeyD21 post(s)
#13-Oct-20 16:32

Hi again,

I did some further digging: actually the federal state considers this data provision via WMS as provision of open data according to INSPIRE. They have a WFS service for the same data but only accessible for public administration. So in essence there is no access to vector data via INSPIRE. Unfortunately!

JoeyD

yves61
192 post(s)
online
#14-Oct-20 11:06

HI JoeyD,

Are you working with M9 or M8 ?

You mention in your initial message ... a federal state of Germany (URL attached, select "adv_alkis_flurstuecke") and I would like to transform a small subset of the data (for one village, attached)...

What is the exact URL , what is the exact Layer, what is the precise EPSG ?

Is your image like this (example Sachsen area)

https://geodienste.sachsen.de/wms_geosn_alkis-adv/guest?SERVICE=WMS&REQUEST=GetMap&SERVICE=WMS&LAYERS=adv_alkis_flurstuecke&TRANSPARENT=TRUE&FORMAT=image/png&VERSION=1.3.0&STYLES=&CRS=EPSG:25833&BBOX=390625,5644639,391625,5645139&WIDTH=2000&HEIGHT=1000

JoeyD21 post(s)
#23-Oct-20 07:55

Hi Yves,

Sorry it took a while, I was tied up with other things: I am working on M9. The URL of the WMS-server is https://www.geodaten-mv.de/dienste/alkis_wms?

EPSG is 5650

I took this from the properties of the data source:

{ "Source": "https:\/\/www.geodaten-mv.de\/dienste\/alkis_wms", "SourceAgent": "Mozilla\/5.0 Manifold\/9.0", "SourceCache": true, "SourceCacheTemp": true, "SourceCoordSystemPreferred": "5650", "SourceUuid": "91fc18ec-ae98-4adf-a7a7-ef1a04d5dcd1" }

If you connect to this WMS you find several folders. In the folder "Flurstuecke" you find adv_alkis_flurstuecke, this is the image I am talking about.

Sachsen is a different federal state, I am dealing with Mecklenburg-Vorpommern. Access rights to geodata can vary. As I said the access to the WMS is free, whereas the same data provided via WFS is access restricted to public administration, i.e. not available to me. So the INSPIRE topic seems to be addressed: No free access to vector data.

As mentioned, I would like to transform the property information displayed via WMS back transformed into a drawing. Possible or not?

Best regards, Joey

yves61
192 post(s)
online
#24-Oct-20 19:38

You could - the hard way - build your own tile system and download all necessary tiles to cover the locality like with :

https://www.geodaten-mv.de/dienste/alkis_wms?

request=GetMap&SERVICE=WMS&version=1.3.0&CRS=EPSG:5650

&BBOX=33364700,5941100,33364800,5941200&WIDTH=1000&HEIGHT=1000

&FORMAT=image/png&TRANSPARENT=true

&layers=adv_alkis_flurstuecke

The above image covers a 100 m x 100 m for a 1000 x 1000 pixel image

Google chrome Webbroser will require : Transparant = false ( if true --> you will get a black background on screen)

Sure there must exist easier ways to do this using Manifold 8 or 9 or other programs ?

yves61
192 post(s)
online
#26-Oct-20 09:31

I am not sure about the distance (100 x 100m)

EPSG 5650 has a false easting of 33500000 and there is a scaling aspect to take into account.

{ "Name": "ETRS89 \/ UTM zone 33N (zE-N) (EPSG:5650)", "System": "Transverse Mercator", "CenterLat": 0, "CenterLon": 15, "FalseEasting": 33500000, "ScaleX": 0.9996, "ScaleY": 0.9996, "Axes": "XY", "Base": "ETRS89 (EPSG:4258)", "MajorAxis": 6378137, "Eccentricity": 0.08181919104281579, "Transform": "Molodensky-Badekas", "Accuracy": 1, "Rect": [ -16.1, 32.88, 39.65, 84.17 ], "Unit": "Meter", "UnitScale": 1, "UnitShort": "m" }

JoeyD21 post(s)
#26-Oct-20 20:37

Hi Yves,

well, that was my idea that in essence Manifold would be systematically "grazing" through the WMS-Service in a certain boundary box and store the tiles of a certain zoom level as a database in order to, in a second step, vectorize the image. I don´t think I have time to manually build the tiles with a webbrowser and constantly think about false easting, but I have learned something new.

Thanks a lot for your help!

Dimitri


6,275 post(s)
online
#27-Oct-20 03:50

in essence Manifold would be systematically "grazing" through the WMS-Service in a certain boundary box and store the tiles of a certain zoom level as a database i

That it does, if you so command. See the "Cache" heading in the Web Servers topic.

JoeyD21 post(s)
#30-Oct-20 08:20

Hm, OK, I take it the systematic grazing could be achieved with caching. I think this is most likely the easier part of what I had in mind. The vectorization of lines and points in this cached image into areas, where the image only consists of black on white lines and (at the crossings) points also sounds doable, that's why I was asking. However, I cannot do it, and seemingly nobody else has done this before where I could copy the approach.

I tested the water, found out it is not doable for me. I thank you all for your thoughts on this!

Dimitri


6,275 post(s)
online
#30-Oct-20 10:44

and seemingly nobody else has done this before where I could copy the approach.

It's not that it's not doable, it's just that depending on the data used there are many nuances, and that usually other approaches are better.

For example, extracting clean vectors out of possibly highly erratic rasters is an extremely difficult task. You can use many 9 facilities to assist in that task (see, for example, the Trace template in the Transform pane), but reducing it to a "copy this" approach is not realistic.

That's not just a 9 deal, by the way, as many books and papers have been written on the ins and outs of extracting vectors from raster images. The usual problem is that you end up with so many errors that it would have been easier to vectorize manually than to hunt for and replace errors that are in the result of an automated process.

An example of that, tons of errors despite having unlimited budget and using the latest techniques, is in the user manual here. That's one reason there are so many contractors in low cost labor areas around the world who specialize in manual digitizing.

Instead of trying to extract vectors from raster data, it is usually much better to invest time into finding the vector data set that was originally used to create, say, the WMS.

That might not always be possible, because the reason some organizations (not all, but some) publish vector data in raster form via WMS is precisely because they do not want you to have the vector data. They want to keep it for themselves. So they publish it in a form which deliberately obfuscates the data, so you can see a view of it that they prepare, but you can't get at the actual data itself.

If despite their disinclination to provide you with the data you want to grab that data anyway, by scraping the WMS tiles and then reverse-engineering from raster to vector to try to break their obfuscation, you have your work cut out for you.

yves61
192 post(s)
online
#14-Oct-20 11:33

I found for Sachsen area also this link under the INSPIRE directive.

https://geoportal.sachsen.de/cps/feed-viewer.html?url=https%3A%2F%2Fgeodownload.sachsen.de%2Finspire%2Fcp_atom%2FService_cp.xml

Flurstucke seem to be downloadable under restrictive use "Nutzungsbedingungen"

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