1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

CVXExtractor - Exporting vector data.

Discussion in 'Showroom' started by Patrick Germain, 31 Jan 2015.

  1. Patrick Germain

    Patrick Germain

    Joined:
    27 May 2014
    Messages:
    86
    Country:
    ca-quebec
    Hi folks

    CVXExtractor is a command-line application that allows you to export the vector data of a CVX BGL file into one of the following formats:

    - XML (Plain XML)
    - KML or KMZ
    - ESRI Shapes
    - BLN
    - OSM (Open StreetMap XML)
    Also note that original lines or polygons may be split if they cross the boundaries of QMID squares (Level 11 , or 15 in the case of Freeways).
    So if you have a square polygon that overlaps 2 QMID areas, 2 polygons will be created by the Shp2Vec tool (one in each QMID area).

    Bear with me as this is version 1.0 and it may contains bugs.
    Anyways, any comment, idea, advice is welcome !

    Enjoy!

    The usage is:

    cvxextractor -i InputFilePath -t Type [-o OutputFolderPath] [-f Filter] [-latMin value] [-latMax value] [-longMin value] [-longMax value]

    where

    -i : (Mandatory) The path on the input BGL file.
    This file is supposed to contain some vectors.​

    -t : (Mandatory) The type of output.
    The value is one of these: XML, KML, KMZ, ESRI, BLN.​

    -o : (Optional) The path on the output folder where the export files will be created.
    If omitted, the output folder will be created in the executable's folder and will have the same name as the input BGL file.​

    -f : (Optional) The types of vector that will be present in the output file.
    If omitted, all types will be exported.
    Several types can be specified. They must be separated by the + character.
    Possible values are:
    • Shorelines
    • Railways
    • AirportBounds
    • Roads
    • Freeways
    • Streams
    • Parks
    • HydroPolygons
    • Exclusions
    • Utilities
    • GPSHydroPolygons

    -latMin
    -latMax
    -longMin
    -longMax
    : (Optional) Defines the boundary coordinates of the area from which the vectors will be exported.
    If any of these 4 options is omitted, the default values will be used. Only the segments totally within the area will be present in the output file.​
    Segments that cross the boundaries will be ignored.
    Default values are -180 for longMin, 180 for longMax
    -90 for latMin, 90 for latMax​

    Example:

    cvxextractor -i "C:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\Scenery\0301\scenery\cvx2815.bgl" -t XML -o C:\Users\Patrick\Documents\Test -f Parks+Shorelines+Utilities
    -latMax 45.52 -latMin 45.49 -longMax -73.3 -longMin -73.4

    This will take the file cvx2815.bgl as input and will output the file​
    C:\Users\Patrick\Documents\Test\cvx2815.xml that will contain only the segments of type Parks and ShoreLines and Utilities totally contained within the square having the following boundaries:
    NorthWest Corner: Latitude = 45.52, Longitude = -73.4
    SouthEast Corner: Latitude = 45.49, Longitude = -73.3​
     

    Attached Files:

    Last edited: 8 May 2017
    CFSO7335, vanyuha, ronh and 2 others like this.
  2. NoNewMessages

    NoNewMessages

    Joined:
    15 Jun 2010
    Messages:
    173
    Country:
    unitedstates
    Wowsers! Will have to get my head around the entire scope of things, but I can see it being of benefit. Even without a SBuilderX .SBX format I'll still be able to parse the XML for what I might need.

    Well done and Thanks!
     
  3. ollyau

    ollyau Resource contributor

    Joined:
    5 Jan 2008
    Messages:
    1,020
    Country:
    us-california
    Thanks Patrick! :)
     
  4. scruffyduck

    scruffyduck Administrator Staff Member FSDevConf team Resource contributor

    Joined:
    17 Sep 2005
    Messages:
    28,962
    Country:
    unitedkingdom
    Thanks Patrick :)
     
  5. rhumbaflappy

    rhumbaflappy Moderator Staff Member Resource contributor

    Joined:
    2 Jun 2004
    Messages:
    3,069
    Country:
    us-wisconsin
    Hi Patrick.

    Very interesting tool. nicely done.

    Dick
     
  6. rhumbaflappy

    rhumbaflappy Moderator Staff Member Resource contributor

    Joined:
    2 Jun 2004
    Messages:
    3,069
    Country:
    us-wisconsin
    Hi Patrick.

    A couple of things.

    Park polygons are usually PKXxxxx, not PLX....

    Also, there may be something wrong with some of the FLX shapefiles. cvx2416 crashes when recompiling. It doesn't happen with all of them. When I re-save the SHP file from Global Mapper, it recompiles just fine.

    Dick
     
    Last edited: 31 Jan 2015
  7. Patrick Germain

    Patrick Germain

    Joined:
    27 May 2014
    Messages:
    86
    Country:
    ca-quebec
    PKX ? Some typo in my code - I'll fix it

    FLX - Can you tell me what folder is cvx2416 in ? I'll recompile it with shp2vec to check .
     
  8. rhumbaflappy

    rhumbaflappy Moderator Staff Member Resource contributor

    Joined:
    2 Jun 2004
    Messages:
    3,069
    Country:
    us-wisconsin
    Hi Patrick.

    cvx2416 is in folder 302.

    I found other problems. cvx8419.bgl in folder in 1002 gives won't compile the HPX file. The shp file looks ok in Global Mapper, but within SBuilderX, it shows little "spikes" at the ends of triangles.

    Dick
     
  9. GaryGB

    GaryGB

    Joined:
    23 Dec 2005
    Messages:
    3,480
    Country:
    us-illinois
    Hi Patrick:

    Many thanks again for making such a revolutionary utility available to the FS development community... outstanding work ! :wizard:


    After having chased a few of my own links regarding the BLN file format, I see that in the haste of the moment while posting, I had only briefly explained that very simple "X,Y,Z with a single header line" format in prior posts here at FSDeveloper.

    SEE: EXAMPLE *.TXT POLYGON file in NotePad at:

    http://www.fsdeveloper.com/forum/threads/making-water.17540/#post-114883



    FYI: Although initially in very early versions of SBuilder for FS9 the implementation of BLN as an "Append"-able file type appeared to utilize a customized definition (IIUC, in an effort to define an intended line width via the second number in the header line Fields), AFAIK, that custom Append 're-interpretation' of BLN was eventually deprecated and replaced by use of Polish MP (*.MP) format files.

    BTW: For details on the Polish MP format and Garmin GPS data sets, see Page 22 at:

    http://www.globalmapper.com/helpv11/cGPSMapper.pdf


    Subsequently, the BLN format interpretation used by SBuilder for FS9 in its current release version 2.05 and SBuilderX version 3.x ...became compliant with the Golden Software "BLankiNg" file format type as was originally used in the Surfer GIS application some years ago.

    That 'original' simple format was a sequence of:

    * a single header line (which defines the number of Record lines to follow) for each individual polygon Record group

    * (3) X,Y,Z (Lat,Lon,Alt) Fields in each Record line

    * (1) Record per line


    This was originally explained by Jose Oliveira in his initial post at FSDeveloper on use of BLN files with his utility BLNMarker:

    http://www.fsdeveloper.com/forum/threads/flatten-and-autogen-exclude-in-fsx.3094/



    A few related threads on BLN files, BLNMarker, and BLN2SHP:

    http://www.fsdeveloper.com/forum/threads/blnmarker.49002/

    http://www.fsdeveloper.com/forum/threads/where-can-i-find-bln2shp.431366/



    PS: For FS developers who may be recovering their own vector source data with a need to utilize it in SBuilder for FS9 / SBuilderX and/or other FS utilities, these threads discuss use of vertex coordinate data for ex: custom vector "lines":

    http://www.fsdeveloper.com/forum/threads/utility_1-and-2.394520/

    http://www.fsdeveloper.com/forum/threads/width-of-roads-in-fsx.427279/



    Hope this additional info on the original Surfer simple BLN file format might help as your further development progresses ! :)

    GaryGB
     
    Last edited: 9 Apr 2015
  10. Patrick Germain

    Patrick Germain

    Joined:
    27 May 2014
    Messages:
    86
    Country:
    ca-quebec
    It sure will ! Thanks Gary.
     
  11. Patrick Germain

    Patrick Germain

    Joined:
    27 May 2014
    Messages:
    86
    Country:
    ca-quebec
    Updated with version 1.0.0.2

    Fixes:
    - Prefix PKX (and not PLX) for Parks
    - Polygons all with identical points making Shp2Vec tool crash.

    Enjoy!
     
  12. rhumbaflappy

    rhumbaflappy Moderator Staff Member Resource contributor

    Joined:
    2 Jun 2004
    Messages:
    3,069
    Country:
    us-wisconsin
    Hi Patrick.

    Some islands (holes) seem to be mistaken for water polys. I wonder if there is a flag for that in the BGL code?

    Dick
     
  13. Patrick Germain

    Patrick Germain

    Joined:
    27 May 2014
    Messages:
    86
    Country:
    ca-quebec
    Hi Dick
    The first thing that comes to mind is that I'm using only simple PolygonZ as Shape types for polygons (no ring, no parts). I'll have to dig into it and refine the shape generation.
    Do you have any BGL file containing theses 'holes' to point me to ?
    Thanks

    Btw, I'm looking at Flight now. How come that jewel is not more known ? Wow ! I'll try to install it when I have time but I'm really looking forward to using it.

    Patrick.
     
  14. rhumbaflappy

    rhumbaflappy Moderator Staff Member Resource contributor

    Joined:
    2 Jun 2004
    Messages:
    3,069
    Country:
    us-wisconsin
    Flight has no AI, no ATC, no ground traffic. And there was no way to add aircraft, missions or scenery ( other than MS' DLC, which was almost non-existant ). Steve has been working on making addon scenery possible, and aircraft and missions are also being looked at.

    I'll dig up a simple example of the islands for you to look at.

    Dick
     
  15. rhumbaflappy

    rhumbaflappy Moderator Staff Member Resource contributor

    Joined:
    2 Jun 2004
    Messages:
    3,069
    Country:
    us-wisconsin
    Hi Patrick.

    Here's a holes example (attached).
     

    Attached Files:

  16. Patrick Germain

    Patrick Germain

    Joined:
    27 May 2014
    Messages:
    86
    Country:
    ca-quebec
    Thanks Dick

    I also found an example with the FSX files.

    Mono Lake in (...)\Scenery\0202\scenery\cvx1618.bgl (at Latitude 38.00, Longitude -119.03).

    It looks like the Hydro polygon is not one with holes in it. Instead, there are several polygons surrounding the island.

    I'll try to understand the mechanism behind the polygon generation and reproduce it in my tool.

    upload_2015-2-3_15-10-25.png
     
  17. rhumbaflappy

    rhumbaflappy Moderator Staff Member Resource contributor

    Joined:
    2 Jun 2004
    Messages:
    3,069
    Country:
    us-wisconsin
    I found the original hole problem in FSX' cvx8419.bgl That file has a huge HP section. many islands are enclosed... not having polys subdivided to eliminate holes.

    CVX8419.bgl.png

    Dick
     
  18. Patrick Germain

    Patrick Germain

    Joined:
    27 May 2014
    Messages:
    86
    Country:
    ca-quebec
    New version for CvxExtractor (1.0.0.3)

    • You can now use abbreviations for the type of vectors:
    Shorelines or HLX
    Railways or RRX
    AirportBounds or FLX
    Roads or RDX
    Freeways or FWX
    Streams or STX
    Parks or PKX
    HydroPolygons or HPX
    Exclusions or EXX
    Utilities ot UTX
    GPSHydroPolygons or HGX​
    • Fixed the problem of polygons with holes.
    • Additional information about position of the vector in the original BGL file (FileOffsetHex) in the KML and XML output.
    • In KML, polygons are now filled AND outlined.
    Enjoy
     
    Last edited: 3 Feb 2015
  19. Patrick Germain

    Patrick Germain

    Joined:
    27 May 2014
    Messages:
    86
    Country:
    ca-quebec
    Fixed . New version available. :)
     
  20. mmann

    mmann

    Joined:
    20 Apr 2010
    Messages:
    599
    Country:
    ca-britishcolumbia
    It certainly is nice to see a developer update their application in a timely fashion! If only certain payware developer's were even half as dedicated as you, Patrick! Thank you very much.
     

Share This Page