Jump to content

 
Photo

Clutter classes statistics

- - - - -

  • Please log in to reply
24 replies to this topic

#16
SerbanR

SerbanR

    Contributor

  • Validated Member
  • PipPip
  • 15 posts
  • Gender:Male
  • Location:Timisoara
  • Romania

Hi Serban,

I don’t think that you can do much analysis within Vertical Mapper as you are using a classified grid, which has character attribute information, rather than a numeric grid (like a DEM).

You can use the Region Information tool on the VM toolbar (i within a polygon) and it will allow you to select a polygon from your admin boundary table and report back the area and percent for each classification within the selected polygon. Unfortunately, I couldn’t find a way of doing this for ALL the polygons within the table using the functions available within VM. You can do this for a numeric grid, but it only returns statistical information (like max value or standard deviation)>

The process I settled on in the end was to convert the .grc file into a vector table using the Contour option within VM. This will trace around the cell boundaries for each classification and create a region for each one. You can then use this file within MapInfo and use SQL to work out the area overlap between the admin boundary and land cover polygon tables. This query will do it for the sample data you posted:

Select FrVecSmpl_UTM31n_25m.CODE_INSEE, x_grd_contour.Class, sum(proportionoverlap(FrVecSmpl_UTM31n_25m.obj, x_grd_contour.obj)), sum(areaoverlap(FrVecSmpl_UTM31n_25m.obj, x_grd_contour.obj)) from FrVecSmpl_UTM31n_25m, x_grd_contour where FrVecSmpl_UTM31n_25m.Obj intersects x_grd_contour.Obj group by 1,2 into Selection

(Sorry, but I can't upload the x_grd_contour.tab table that I created in VM)

It does take awhile to run, so you may well be better off using FME now that you are working with 2 vector tables.

The query groups by CODE_INSEE (1) and CLASS (2) and proportionoverlap() produces the percentage of one object covered by another and areaoverlap() returns the area of overlap in the currently set area units (Map – Options – Area Unts)

Not sure if that helps you any, but I don't think there is any other way of doing it using MapInfo and Vertical Mapper.

Cheers

Greg

Thanks a lot Greg for this solution, it is very helpful given the lack of other ways to do it. The only problem is related to the fact that it will be very slow because for example creating contours for entire clutter map of France takes at least one hour (if MapInfo doesn't crash because of huge number of objects which has to be created).
The best way to do this with MapInfo and VM would be a MapBasic program which would be able to use that function in Vertical Mapper which produce statistics for a single polygon. But as far as I see there is no way to use VM functions from within MapBasic. Do I miss something ?
Serban

#17
Hans van der Maarel

Hans van der Maarel

    CartoTalk Editor-in-Chief

  • Admin
  • PipPipPipPipPipPipPip
  • 3,890 posts
  • Gender:Male
  • Location:The Netherlands
  • Interests:Cartography, GIS, history, popular science, music.
  • Netherlands

Unfortunately, no luck with FME...

The trick I tried, replacing pixels with points, doesn't retain the original pixel properties (such as color and classification).

So there is something which can not be done with FME! :(


Yet ;)

Well, I will go ahead and file this as a feature request. It's then up to Safe to determine whether or not this would be worth it. I can also post a description of this problem on the FME mailing list (or you can go ahead and do that yourself if you like), maybe somebody else has an idea on how to tackle this.
Hans van der Maarel - Cartotalk Editor
Red Geographics
Email: hans@redgeographics.com / Twitter: @redgeographics

#18
SerbanR

SerbanR

    Contributor

  • Validated Member
  • PipPip
  • 15 posts
  • Gender:Male
  • Location:Timisoara
  • Romania

Unfortunately, no luck with FME...

The trick I tried, replacing pixels with points, doesn't retain the original pixel properties (such as color and classification).

So there is something which can not be done with FME! :(


Yet ;)

Well, I will go ahead and file this as a feature request. It's then up to Safe to determine whether or not this would be worth it. I can also post a description of this problem on the FME mailing list (or you can go ahead and do that yourself if you like), maybe somebody else has an idea on how to tackle this.

Please make the post on FME mailing list yourself, I think you have more chances to get an answer than me. It is really strange for me to see that such a simple thing like counting how many pixels of a certain color are inside a shape is not already implemented !

#19
benbakelaar

benbakelaar

    Ultimate Contributor

  • Associate Admin
  • PipPipPipPipPipPip
  • 658 posts
  • Gender:Male
  • Location:North Brunswick, NJ
  • Interests:maps, information, technology, scripting, computers
  • United States

How frequently will you need to run this process? On how many polygons? This is, as you say, something very simple that could be accomplished with regular image software (that can tally total pixels per unique color) - but you would have to export each polygon/raster overlay as a raster (and white out the surrounding area) first.

Please make the post on FME mailing list yourself, I think you have more chances to get an answer than me. It is really strange for me to see that such a simple thing like counting how many pixels of a certain color are inside a shape is not already implemented !



#20
gregsd

gregsd

    Master Contributor

  • Validated Member
  • PipPipPipPip
  • 169 posts
  • Gender:Male
  • Location:Surrey, England.
  • Interests:Cycling, mostly off-road (MTB) riding.
  • United Kingdom

Thanks a lot Greg for this solution, it is very helpful given the lack of other ways to do it. The only problem is related to the fact that it will be very slow because for example creating contours for entire clutter map of France takes at least one hour (if MapInfo doesn't crash because of huge number of objects which has to be created).
The best way to do this with MapInfo and VM would be a MapBasic program which would be able to use that function in Vertical Mapper which produce statistics for a single polygon. But as far as I see there is no way to use VM functions from within MapBasic. Do I miss something ?
Serban


You have have to use the Vertical Mapper SDK if you want to access the functionality from MapBasic. I've also posted the problem on the MapInfo-L mailing list just in case I've overlooked something within Vertical Mapper. You're right about the speed/performence issue as Vertical Mapper can itself be unstable with large datasets.

Greg.


Greg Driver

GIS Analyst
MapInfo User...!

#21
SerbanR

SerbanR

    Contributor

  • Validated Member
  • PipPip
  • 15 posts
  • Gender:Male
  • Location:Timisoara
  • Romania

How frequently will you need to run this process? On how many polygons? This is, as you say, something very simple that could be accomplished with regular image software (that can tally total pixels per unique color) - but you would have to export each polygon/raster overlay as a raster (and white out the surrounding area) first.

Well it's needed quite frequently. I'm usually working with countrywide classified grids (or high resolution city databases), and I have to derive the clutter statistics for each administrative division inside that country or city. For a country like Germany or France we have more than 10.000 (ten thousand) administrative divisions, and also at least 10.000 different clutters split into 10-20 classes.

#22
benbakelaar

benbakelaar

    Ultimate Contributor

  • Associate Admin
  • PipPipPipPipPipPip
  • 658 posts
  • Gender:Male
  • Location:North Brunswick, NJ
  • Interests:maps, information, technology, scripting, computers
  • United States

Wow, good luck then! It sounds like a more specialized task, not something so common.

#23
gregsd

gregsd

    Master Contributor

  • Validated Member
  • PipPipPipPip
  • 169 posts
  • Gender:Male
  • Location:Surrey, England.
  • Interests:Cycling, mostly off-road (MTB) riding.
  • United Kingdom

Just wondered if you'd managed to find a solution or workaround for this yet?

Greg


Greg Driver

GIS Analyst
MapInfo User...!

#24
SerbanR

SerbanR

    Contributor

  • Validated Member
  • PipPip
  • 15 posts
  • Gender:Male
  • Location:Timisoara
  • Romania

Just wondered if you'd managed to find a solution or workaround for this yet?

Greg


No solution yet. I think that this could be accomplished using MapBasic and Vertical Mapper SDK, but I do not have the SDK documentation. Does anyone have it and willing to share ?

There is no way to create a custom transformer in FME which could do something similar?
Or the raster analyzer tools in Manifold?

Any idea regarding solving this kind of problem using MapInfo/MapBasic/Verical Mapper OR Manifold OR FME would still be really appreciated!

BR
Serban

#25
gregsd

gregsd

    Master Contributor

  • Validated Member
  • PipPipPipPip
  • 169 posts
  • Gender:Male
  • Location:Surrey, England.
  • Interests:Cycling, mostly off-road (MTB) riding.
  • United Kingdom

No solution yet. I think that this could be accomplished using MapBasic and Vertical Mapper SDK, but I do not have the SDK documentation. Does anyone have it and willing to share ?


Have a look at this, it's documentation for the VM SDK v2.6 if that helps!

I don't have access to the SDK so I haven't used it but I'm fimilar with MapBasic if you need a hand with anything.

Greg.


Greg Driver

GIS Analyst
MapInfo User...!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

-->