Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have the following gml geometry :

<gml:Polygon xmlns:gml="http://www.opengis.net/gml" srsName="EPSG:2154">
  <gml:exterior>
    <gml:LinearRing>
      <gml:posList srsDimension="2">
657983.0000000068 6860322.000000936 657655.0000000069 6860452.000000936 657172.000000007 6859562.000000938 656962.000000007
6859846.000000937 657140.0000000069 6860890.000000934 657169.0000000069 6861180.000000931 657362.0000000069 6861189.000000934
657395.0000000069 6860859.000000935 658016.0000000068 6860653.000000936 657983.0000000068 6860322.000000936 657983.0000000068
6860322.000000936 658016.0000000068 6860653.000000936 657395.0000000069 6860859.000000935 657362.0000000069 6861189.000000934
658110.0000000068 6861132.000000933 658706.0000000066 6861564.000000933 659428.0000000065 6861377.000000932 660042.0000000064
6861175.000000932 660094.0000000064 6860854.000000935 659478.0000000065 6860671.000000935 657983.0000000068 6860322.000000936
659428.0000000065 6861377.000000932 658706.0000000066 6861564.000000933 658110.0000000068 6861132.000000933 657362.0000000069
6861189.000000934 657169.0000000069 6861180.000000931 657099.0000000069 6861841.000000932 657684.0000000068 6862313.000000931
658585.0000000066 6863988.000000925 659117.0000000065 6863683.000000926 659784.0000000064 6864414.000000923 660744.0000000063
6864361.000000924 661242.0000000062 6863433.000000928 661899.000000006 6863173.000000927 661962.000000006 6862500.000000929
659959.0000000065 6861848.000000931 659428.0000000065 6861377.000000932 657983.0000000068 6860322.000000936
</gml:posList>
    </gml:LinearRing>
  </gml:exterior>
</gml:Polygon>

I'd like to import it as easily and fast as possible into QGIS.

  • I've tried direct GML import => not a valid GML (and i quite agree with that ;))
  • I can use QuickWKT => But then I need to put commas every two coordinates
  • I've tried "Add delimited Text Layer" => But it does seem to work mainly for CSV file with coordinates on each line.

Any ideas ?

Thanx in advance

share|improve this question
add comment

1 Answer 1

A lateral solution - if you need commas every two coordinates for QuickWKT you can use a simple regular expression to create them.

Find: ([0-9\.]+ [0-9\.]+)

Replace: \1, (or $1, depending on the syntax).

So you end up with this:

<gml:Polygon xmlns:gml="http://www.opengis.net/gml" srsName="EPSG:2154">
  <gml:exterior>
    <gml:LinearRing>
      <gml:posList srsDimension="2">
        657983.0000000068 6860322.000000936, 657655.0000000069 6860452.000000936, 657172.000000007 6859562.000000938, 656962.000000007 6859846.000000937, 657140.0000000069 6860890.000000934, 657169.0000000069 6861180.000000931, 657362.0000000069 6861189.000000934, 657395.0000000069 6860859.000000935, 658016.0000000068 6860653.000000936, 657983.0000000068 6860322.000000936, 657983.0000000068 6860322.000000936, 658016.0000000068 6860653.000000936, 657395.0000000069 6860859.000000935, 657362.0000000069 6861189.000000934, 658110.0000000068 6861132.000000933, 658706.0000000066 6861564.000000933, 659428.0000000065 6861377.000000932, 660042.0000000064 6861175.000000932, 660094.0000000064 6860854.000000935, 659478.0000000065 6860671.000000935, 657983.0000000068 6860322.000000936, 659428.0000000065 6861377.000000932, 658706.0000000066 6861564.000000933, 658110.0000000068 6861132.000000933, 657362.0000000069 6861189.000000934, 657169.0000000069 6861180.000000931, 657099.0000000069 6861841.000000932, 657684.0000000068 6862313.000000931, 658585.0000000066 6863988.000000925, 659117.0000000065 6863683.000000926, 659784.0000000064 6864414.000000923, 660744.0000000063 6864361.000000924, 661242.0000000062 6863433.000000928, 661899.000000006 6863173.000000927, 661962.000000006 6862500.000000929, 659959.0000000065 6861848.000000931, 659428.0000000065 6861377.000000932, 657983.0000000068 6860322.000000936
    </gml:posList>
    </gml:LinearRing>
  </gml:exterior>
</gml:Polygon>

Not strictly a GIS solution, but it might work. ;-)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.