<div dir="ltr"><div>Hey folks</div><div><br></div><div>We're having a lot of trouble getting data out of a WFS server that doesn't have primary keys. <a href="https://github.com/OSGeo/gdal/pull/8146">(previous work on this)</a></div><div><br></div><div><br></div><div>The URL that's causing us grief is this one: <a href="https://opendata.maps.vic.gov.au/geoserver/wfs?REQUEST=GetFeature&SERVICE=WFS&VERSION=2.0.0&TYPENAMES=open-data-platform:v_s_parcel_proposed&STARTINDEX=0&COUNT=2">https://opendata.maps.vic.gov.au/geoserver/wfs?REQUEST=GetFeature&SERVICE=WFS&VERSION=2.0.0&TYPENAMES=open-data-platform:v_s_parcel_proposed&STARTINDEX=0&COUNT=2</a></div><div><br></div><div>* we can't disable pagination, because the server only returns 5000 records even if we ask for more.</div><div>* we can't paginate without ordering, because there's no PK.</div><div><br></div><div>So, adding a `&SORTBY=parcel_pfi` to the querystring fixes the issue. But I can't seem to get GDAL to do that for us.</div><div><br></div><div>There does seem to be code for applying an "ORDER BY" clause from ExecuteSQL to the WFS 1.1+ SORTBY field. However, I can't get it to work.</div><div><br></div><div>I made <a href="https://gist.github.com/craigds/4fc8c0f61d02c0293b7c5005b8492744#file-wfs-order-by-test-py">a test script</a> to demonstrate the problem. It uses ExecuteSQL to apply an ORDER BY clause, but the resulting curl queries don't have a SORTBY parameter. Then it crashes after the server returns a 400 error due to the missing SORTBY.<br></div><div><br></div><div>I assume there's something I need to do to cause GDAL to use the SORTBY parameter but I'm not sure what it is. Any tips would be appreciated.<br></div><div><br><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px">Regards,</div><div style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px">Craig</div><div style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px"><br></div><div style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px">Platform Engineer<br></div><div style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px">Koordinates</div><div style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px"><br></div><div style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px"><a href="tel:+64%2021%20256%209488" style="color:rgb(17,85,204)" target="_blank">+64 21 256 9488</a> / <a href="http://koordinates.com/" style="color:rgb(17,85,204)" target="_blank">koordinates.com</a> / <a href="https://twitter.com/koordinates" style="color:rgb(17,85,204)" target="_blank">@koordinates</a></div></div></div></div></div>