bcgov / bcdata

An R package for searching & retrieving data from the B.C. Data Catalogue
https://bcgov.github.io/bcdata
Apache License 2.0
82 stars 13 forks source link

Use propertyName=FEATURE_CODE to just get attributes for counting records #26

Closed ateucher closed 5 years ago

ateucher commented 5 years ago

Also use outputFormat=csv

$ curl "https://openmaps.gov.bc.ca/geo/pub/wfs?SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&outputFormat=csv&typeNames=WHSE_ENVIRONMENTAL_MONITORING.EMS_MONITORING_LOCN_GROUPS_SVW&propertyName=FEATURE_CODE" | head
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0FID,MONITORING_GROUP_ID,GROUP_NAME,OFFICE_CD,AEMS_TAG,FEATURE_CODE
WHSE_ENVIRONMENTAL_MONITORING.EMS_MONITORING_LOCN_GROUPS_SVW.fid--120209e6_1694abefcd7_13b7,330,HOWE SOUND AREA,20,0300189,EP10020300
WHSE_ENVIRONMENTAL_MONITORING.EMS_MONITORING_LOCN_GROUPS_SVW.fid--120209e6_1694abefcd7_13b8,330,HOWE SOUND AREA,20,0300190,EP10020300
WHSE_ENVIRONMENTAL_MONITORING.EMS_MONITORING_LOCN_GROUPS_SVW.fid--120209e6_1694abefcd7_13b9,315,ABB-SUMAS AQUIFER WELLS,20,0301012,WA12100190
WHSE_ENVIRONMENTAL_MONITORING.EMS_MONITORING_LOCN_GROUPS_SVW.fid--120209e6_1694abefcd7_13ba,357,BURRARD INLET PROJECT,20,0301046,EP10020300
WHSE_ENVIRONMENTAL_MONITORING.EMS_MONITORING_LOCN_GROUPS_SVW.fid--120209e6_1694abefcd7_13bb,217,BI TEST3,20,0301046,EP10020300
WHSE_ENVIRONMENTAL_MONITORING.EMS_MONITORING_LOCN_GROUPS_SVW.fid--120209e6_1694abefcd7_13bc,357,BURRARD INLET PROJECT,20,0301047,EP10020300
WHSE_ENVIRONMENTAL_MONITORING.EMS_MONITORING_LOCN_GROUPS_SVW.fid--120209e6_1694abefcd7_13bd,217,BI TEST3,20,0301047,EP10020300
WHSE_ENVIRONMENTAL_MONITORING.EMS_MONITORING_LOCN_GROUPS_SVW.fid--120209e6_1694abefcd7_13be,357,BURRARD INLET PROJECT,20,0301048,EP10020300
WHSE_ENVIRONMENTAL_MONITORING.EMS_MONITORING_LOCN_GROUPS_SVW.fid--120209e6_1694abefcd7_13bf,217,BI TEST3,20,0301048,EP10020300
100 32768    0 32768    0     0   182k      0 --:--:-- --:--:-- --:--:--  182k
boshek commented 5 years ago

Just popping in here to say that it looks like not every wfs record accepts the propertyName = FEATURE_CODE args to the request:

H:\>curl "https://openmaps.gov.bc.ca/geo/pub/wfs?SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&outputFormat=csv&typeNames=WHSE_IMAGERY_AND_BASE_MAPS.GSR_AIRPORTS_SVW&propertyName=FEATURE_CODE" | head
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1315    0  1315    0     0   4201      0 --:--:-- --:--:-- --:--:--  4943
<?xml version="1.0" encoding="UTF-8"?><ows:ExceptionReport xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0.0" xsi:schemaLocation="http://www.opengis.net/ows/1.1 http://openmaps.gov.bc.ca/geo/schemas/ows/1.1.0/owsAll.xsd">
  <ows:Exception exceptionCode="InvalidParameterValue" locator="GetFeature">
    <ows:ExceptionText>Requested property: FEATURE_CODE is not available for pub:WHSE_IMAGERY_AND_BASE_MAPS.GSR_AIRPORTS_SVW.  The possible propertyName values are: [CUSTODIAN_ORG_DESCRIPTION, BUSINESS_CATEGORY_CLASS, BUSINESS_CATEGORY_DESCRIPTION, OCCUPANT_TYPE_DESCRIPTION, SOURCE_DATA_ID, SUPPLIED_SOURCE_ID_IND, AIRPORT_NAME, DESCRIPTION, PHYSICAL_ADDRESS, ALIAS_ADDRESS, STREET_ADDRESS, POSTAL_CODE, LOCALITY, CONTACT_PHONE, CONTACT_EMAIL, CONTACT_FAX, WEBSITE_URL, IMAGE_URL, LATITUDE, LONGITUDE, KEYWORDS, DATE_UPDATED, SITE_GEOCODED_IND, AERODROME_STATUS, AIRCRAFT_ACCESS_IND, DATA_SOURCE, DATA_SOURCE_YEAR, ELEVATION, FUEL_AVAILABILITY_IND, HELICOPTER_ACCESS_IND, IATA_CODE, ICAO_CODE, MAX_RUNWAY_LENGTH, NUMBER_OF_RUNWAYS, OIL_AVAILABILITY_IND, RUNWAY_SURFACE, SEAPLANE_ACCESS_IND, TC_LID_CODE, SHAPE, SEQUENCE_ID, SE_ANNO_CAD_DATA]</ows:ExceptionText>
  </ows:Exception>
</ows:ExceptionReport>
ateucher commented 5 years ago

Ok thanks, that's not overly surprising I suppose. Do we have a use case for this at the moment? (Asking with full irony since I opened the issue)

boshek commented 5 years ago

I just thought an geometry argument that defaults to TRUE could be handy primarily for speed reasons. I can think of lots of reasons why you might only want the attribute information.

boshek commented 5 years ago

It looks like most objects have an OBJECTID column so we could use that but I am really wondering if we even want this.

ateucher commented 5 years ago

I'm closing this for now...