# Third Party Modules import WeoGeoAPI # Establish connection to WeoGeo Market weos = WeoGeoAPI.weoSession("market.weogeo.com", "username", "password") weos.connect() print weos # Set initial job parameters. The 'note' variable is optional. Here we only want one layer, '10m High Res'. # Spatial resolution is 1 (native). Use 2, 3 or 4 to deliver as 2x/3x/4x coarser. # Reproject our order to NAD83-Geo(EPSG:4269). newJob = WeoGeoAPI.weoJob( datasetToken="5dbdb7db-1acf-4f19-b629-04b54f907552", layers=["10m High Res"], outputFormat="GeoTIFF", coordinateSystem="EPSG:4269", spatialResolution="1", note="Extract of area around Oregon.", acceptLicense=True, ) # Set crop box around Oregon. EPSG must be GEO(EPSG:4326) or Spherical Mercator(EPSG:3857). newJob.setBoxCropArea("EPSG:4326", 46.17, 42.13, -116.28, -124.33) # Create job object to be used for ordering. job_response, job_output = weos.createJob(newJob) # Pricing and size information response, price = weos.getPrice(newJob) print "\n-Order Summary-" print "Price: " + price["price"]
""" In this example we will demonstrate how to order a standard job using information we logged from the getdatasets_by_area.py example. A job on a Standard listing delivers all data and therefore do not allow for customization. The dataset used in this example is "NASA: Earth at Night - 2000", which can be found here: http://market.trimbledata.com/#/datasets/5416193f-ba3d-f45e-bd9c-6dbf8193bfad """ import WeoGeoAPI # Establish connection to Trimble Data Marketplace session = WeoGeoAPI.weoSession('market.trimbledata.com', 'username', 'password') session.connect() print session # Create job object. Since there is no customization involved we only need to supply the token accept the license. testJob = WeoGeoAPI.weoJob(dataset_token='5416193f-ba3d-f45e-bd9c-6dbf8193bfad', content_license_acceptance=True) # Create job object to be used for ordering. response = session.createJob(testJob) # Pricing and size information price = session.getPrice(testJob) print "\n-Order Summary-" print "Price: " + price.content['job_price']['price'] print "Size: " + price.content['job_price']['human_estimated_data_size'] # Complete the order if response.status != 201: print response.content exit(0) else:
import WeoGeoAPI # Establish connection to WeoGeo Market weos = WeoGeoAPI.weoSession('market.weogeo.com', 'username', 'password') weos.connect() print weos # Create text file to log tokens outfile = open('job_tokens.txt', 'w') # Create lists for job instances and another list for their tokens jobs = [] jobtokens = [] # Create standard job object and append to jobs list standardJob = WeoGeoAPI.weoJob( datasetToken = '9dc42e34-cbd0-6952-ad6c-fb39eb23fd0a', acceptLicense = True) jobs.append(standardJob) # Create vector job object and append to jobs list vectorJob = WeoGeoAPI.weoJob( datasetToken = 'bfc2b36e-3d0d-4a6d-935d-e9ab090aaa3c', layers = ['Area Hydrography', 'Linear Hydrography'], outputFormat = 'SHAPE', note = 'Extract of area around Portland, OR.', acceptLicense = True ) vectorJob.setClipAreaCoordinateSystem( 'EPSG:4326' ) vectorJob.addClipAreaPoints((-122.55,45.43), (-122.46,45.43), (-122.14,45.32), (-122.14,45.27), (-122.55,45.27)) jobs.append(vectorJob) # Create raster job object and append to jobs list rasterJob = WeoGeoAPI.weoJob( datasetToken = '5dbdb7db-1acf-4f19-b629-04b54f907552', layers = ['10m High Res'],
information we logged from the getdatasets_by_area.py example. The dataset used in this example is "TIGER/Line 2014", which can be found here: http://market.trimbledata.com/#/datasets/tiger-line-2014 """ import WeoGeoAPI # Establish connection to Trimble Data Marketplace session = WeoGeoAPI.weoSession('market.trimbledata.com', 'username', 'password') session.connect() print session # Set initial job parameters. The 'note' variable is optional. Datasets with no layers do not need to be specified. newJob = WeoGeoAPI.weoJob(dataset_token='3d52ffef-50cf-41e5-aadf-a5ec3dc5fc11', layers=['All Roads', 'Census Tract'], job_file_format='SHAPE', note='Extract of area around Portland, OR.', content_license_acceptance=True) # Create a polygon selection using pairs of X,Y points that are in sequence. newJob.setClipAreaCoordinateSystem('EPSG:4326') newJob.addClipAreaPoints(((-122.55, 45.43), (-122.46, 45.43), (-122.14, 45.32), (-122.14, 45.27), (-122.55, 45.27), (-122.55, 45.43))) # Create job object to be used for ordering. response = session.createJob(newJob) # Pricing and size information price = session.getPrice(newJob) print "\n-Order Summary-" print "Price: " + price.content['job_price']['price'] print "Size: " + price.content['job_price']['human_estimated_data_size']
import WeoGeoAPI # Establish connection to Trimble Data Marketplace session = WeoGeoAPI.weoSession('market.trimbledata.com', 'username', 'password') session.connect() print session # Set initial job parameters. The 'note' variable is optional. # Here we only want one layer, '10m High Res'. # Spatial resolution is 1 (native). Use 2, 3 or 4 to deliver as 2x/3x/4x coarser. # Reproject our order to NAD83-Geo(EPSG:4269). newJob = WeoGeoAPI.weoJob(dataset_token='5dbdb7db-1acf-4f19-b629-04b54f907552', layers=['10m High Res'], job_file_format='GeoTIFF', job_datum_projection='EPSG:4269', job_spatial_resolution='1', note='Extract of area around Oregon.', content_license_acceptance=True) # Set crop box around Oregon. EPSG must be GEO(EPSG:4326) or Spherical Mercator(EPSG:3857). newJob.setBoxCropArea('EPSG:4326', 46.17, 42.13, -116.28, -124.33) # Create job object to be used for ordering. response = session.createJob(newJob) # Pricing and size information price = session.getPrice(newJob) print "\n-Order Summary-" print "Price: " + price.content['job_price']['price'] print "Size: " + price.content['job_price']['human_estimated_data_size']
import WeoGeoAPI # Establish connection to Trimble Data Marketplace session = WeoGeoAPI.weoSession('market.trimbledata.com', 'username', 'password') session.connect() print session # Create text file to log tokens outfile = open('job_tokens.txt', 'w') # Create lists for job instances and another list for their tokens jobs = [] jobtokens = [] # Create standard job object and append to jobs list standardJob = WeoGeoAPI.weoJob(dataset_token='5416193f-ba3d-f45e-bd9c-6dbf8193bfad', content_license_acceptance=True) jobs.append(standardJob) # Create vector job object and append to jobs list vectorJob = WeoGeoAPI.weoJob(dataset_token='3d52ffef-50cf-41e5-aadf-a5ec3dc5fc11', layers=['All Roads', 'Census Tract'], job_file_format='SHAPE', note='Extract of area around Portland, OR.', content_license_acceptance=True) vectorJob.setClipAreaCoordinateSystem('EPSG:4326') vectorJob.addClipAreaPoints(((-122.55, 45.43), (-122.46, 45.43), (-122.14, 45.32), (-122.14, 45.27), (-122.55, 45.27))) jobs.append(vectorJob) # Create raster job object and append to jobs list rasterJob = WeoGeoAPI.weoJob(dataset_token='5dbdb7db-1acf-4f19-b629-04b54f907552', layers=['10m High Res'],