Comments (5)
@wchatx I try FME 2020.1 Beta. Pip was able to bring in directaccess in the new version of the software. Thanks for your help.
from direct-access-py.
Hi @kiauho, thanks for the question and that's a really cool use case!
I've just run through this successfully in FME Desktop 2019.2. My preferred Python interpreter is set to Python 3.7+ in the Translation options. My system has multiple versions of FME Desktop so this is the command I ran:
& "C:\Program Files\FME2019\fme.exe" python -m pip install directaccess --target C:\Users\<your.user>\Documents\FME\Plugins\Python\python37
Are you providing the --target flag? This Safe Software doc might be helpful if you haven't already seen it.
from direct-access-py.
Your use case was interesting to me so I put together a basic PythonCreator using this module
import fme
import fmeobjects
from directaccess import DirectAccessV2
class EnverusFeatureCreator(object):
def __init__(self):
self.dataset = fme.macroValues['DATASET']
self.query = fme.macroValues['QUERY']
self.client_id = fme.macroValues['CLIENT_ID']
self.client_secret = fme.macroValues['CLIENT_SECRET']
self.api_key = fme.macroValues['API_KEY']
self.client = DirectAccessV2(self.client_id, self.client_secret, self.api_key)
self.log = fmeobjects.FMELogFile()
self.log.logMessageString(self.dataset)
def input(self, feature):
for row in self.client.query(self.dataset, **{x.split('=')[0]: x.split('=')[1] for x in self.query.split(';')}):
f = fmeobjects.FMEFeature()
f.setCoordSys('EPSG:4326')
if row['SurfaceLongitudeWGS84'] and row['SurfaceLatitudeWGS84']:
f.addCoordinate(row['SurfaceLongitudeWGS84'], row['SurfaceLatitudeWGS84'])
for k, v in row.items():
f.setAttribute(k, v)
self.pyoutput(f)
def close(self):
pass
I created five published parameters (DATASET, QUERY, CLIENT_ID, CLIENT_SECRET, API_KEY). DATASET matches the exact name of the dataset endpoint (in this case, permits), QUERY is a semi-colon separated string of query params (pagesize=100000;deleteddate=null) and the other three are your API credentials.
This is specific to permits, with the geometry field populated using that dataset's SurfaceLongitudeWGS84 and SurfaceLatitudeWGS84 fields. It's probably easy to make this a bit more configurable.
from direct-access-py.
Hi wchatx,
Thanks for the prompt response and the FME sample code for PythonCreator. I am new to FME. It'll be very helpful, but first I need to overcome the directaccess installation.
My target location is different from yours. It is pointing to One Drive and the python37 is empty. The command is stuck in exactly place as before after using the command you suggested:
Collecting unicodecsv==0.14.1 (from directaccess)
Using cached https://files.pythonhosted.org/packages/6f/a4/691ab63b17505a26096608cc309960b5a6bdf39e4ba1a793d5f9b1a53270/unicodecsv-0.14.1.tar.gz
Error [WinError 2] The system cannot find the file specified while executing command python setup.py egg_info
Could not install packages due to an EnvironmentError: [WinError 2] The system cannot find the file specified
Any new thoughts?
Thanks in advance.
Kiauho
from direct-access-py.
@kiauho try removing the \python37, I should not have included that. This module is usable in Python versions 2.7 and all of 3.x, hence Safe says your target should be C:\Users\<user>\Documents\FME\Plugins\Python
in their docs (modified for your unique situation).
I'm surprised to hear that your target deviates from what Safe specifies and that it's on a network-synced directory. That very well could be the source of your problem and I don't think I'll have much to offer there.
You can also try these older instructions using ez_setup.
Please follow up with your progress! I recall having installed modules into FME's python in a more traditional way previously and can try stepping through that if all else fails.
from direct-access-py.
Related Issues (20)
- Still receiving timeout error HOT 4
- Add to_dataframe method on V2 class
- Add helper methods for relational endpoints HOT 1
- Replace CircleCI with Github Actions
- "Verify=False" argument in DirectAccessV2 causing JSONDecodeError in V1.4.0 HOT 2
- Requesting Example For Use-Case Scenario | Multi-Processing into SQL Server Database HOT 3
- List of possible options for `query` method? HOT 5
- Match `well-origins` with `well-production-values` results` HOT 3
- WARNING Throttled token request. Waiting 60 seconds... HOT 3
- directaccess WARNING Throttled token request. Waiting 60 seconds... HOT 2
- How can I query specific fields of a dataset? HOT 2
- Way to get a count of query results without downloading the dataset? HOT 6
- Differentiate between bad API key and throttled token request
- Finalize to_dataframe()
- Handle HTTP 410 for Version 1
- Remove `links` argument from V2 class init
- enhancement: Completions Query HOT 6
- directaccess.DAQueryException: Non-200 response: 403 Authentication failed HOT 2
- Deprecation warning from urllib3 Retry
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from direct-access-py.