from simplekml import Kml, Snippet, Types, AltitudeMode
# Create the KML document
kml = Kml(name="Tracks", open=1)
doc = kml.newdocument(name='PMX Track', snippet=Snippet(filedate))
if os.path.exists(kmlfilepath): open(kmlfilepath, 'w').close()
# only read header and first row and put data in init_values
with open(csvfilepath, 'r') as file:
reader = csv.DictReader(file)
for row in reader:
init_values.append(row)
curr_time = datetime.now().strftime('%Y-%m-%dT%H:%M:%SZ')
# append time to key TIME in init_values
init_values[0]['TIME'] = curr_time
break
file.close()
print(init_values)
# Set the document properties with init_values
doc.lookat.gxtimespan.begin = init_values[0]['TIME']
# add one hour to the begin time
end_time = datetime.now() + timedelta(hours=1)
print(end_time.strftime('%Y-%m-%dT%H:%M:%SZ'))
doc.lookat.gxtimespan.end = end_time.strftime('%Y-%m-%dT%H:%M:%SZ')
doc.lookat.longitude = init_values[0]['LONGITUDE']
doc.lookat.latitude = init_values[0]['LATITUDE']
doc.lookat.range = 1300.000000
# Create a folder
fol = doc.newfolder(name='Track')
# Create a schema for extended data: heart rate, cadence and power
schema = kml.newschema()
schema.newgxsimplearrayfield(name='heading', type=Types.float, displayname='heading')
# Create a new track in the folder
trk = fol.newgxtrack(name=filedate)
trk.altitudemode = AltitudeMode.absolute
# Apply the above schema to this track
trk.extendeddata.schemadata.schemaurl = schema.id
# Add all the information to the track
trk.newwhen(init_values[0]['TIME']) # Each item in the give nlist will become a new <when> tag
trk.newgxcoord([(float(init_values[0]['LONGITUDE']),float(init_values[0]['LATITUDE']),float(init_values[0]['ALTITUDE']))]) # Ditto
trk.extendeddata.schemadata.newgxsimplearraydata('heading', [float(init_values[0]['HEADING'])])
# Styling
trk.stylemap.normalstyle.iconstyle.icon.href = dronePNGfilepath
trk.stylemap.normalstyle.linestyle.color = '99ffac59'
trk.stylemap.normalstyle.linestyle.width = 6
trk.stylemap.highlightstyle.iconstyle.icon.href = 'http://earth.google.com/images/kml-icons/track-directional/track-0.png'
trk.stylemap.highlightstyle.iconstyle.scale = 1.2
trk.stylemap.highlightstyle.linestyle.color = '99ffac59'
trk.stylemap.highlightstyle.linestyle.width = 8
# Save the kml to file
kml.save(kmlfilepath)
Repro Steps
Install Python Vscode Extension thats it.
If Pylance is uninstalled and pyright installed instead code completion and suggestions work again, so it is definetly a pylance problem.
Expected behavior
Intellisense working correclty with autocompletion and suggestions showing.
Actual behavior
Not a single Intellisense feature is working.
Edit: Seems that only the simplekml library is affected and intellisense is not working for this lib.
Logs
Cant add There was an error creating your Issue: body is too long (maximum is 65536 characters).See comment below
Environment data
Python 3.12.1
Pylance v2024.3.2
IntelliCode v1.3.1
Using virtual environment created with venv same python version as above
Requirements.txt
Repro Steps
Install Python Vscode Extension thats it.
If Pylance is uninstalled and pyright installed instead code completion and suggestions work again, so it is definetly a pylance problem.
Expected behavior
Intellisense working correclty with autocompletion and suggestions showing.
Actual behavior
Not a single Intellisense feature is working. Edit: Seems that only the simplekml library is affected and intellisense is not working for this lib.![Clipboard_03-26-2024_01](https://github.com/microsoft/pylance-release/assets/17785769/c70ad0ab-778b-4086-8b32-1c09a9edd4c0)
Logs
Cant add
There was an error creating your Issue: body is too long (maximum is 65536 characters).
See comment below