Giter VIP home page Giter VIP logo

simplekml's People

Contributors

docjason avatar drid avatar eisoldt avatar klappj avatar mathews avatar meggycal avatar ryan-williams avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

simplekml's Issues

not well-formed (invalid token) error when extendeddata added

Is there a data limit for extendeddata? I am trying to write 20 columns, I thought maybe it has something to do with some characters but if I remove random a few columns it completes saving. I also am not abled to track down the issue as the error doesn't give me a reasonable information. What could be the issue?

county_fol = city_fol.newfolder(name=county[0])
for row in group_data:
    if row[-1] is None:
        continue
    geom = json.loads(row[-1])
    if geom is None:
        continue
    poly = county_fol.newpolygon(
        name="area",
        outerboundaryis=geom["coordinates"][0],
        innerboundaryis=geom["coordinates"][1:]
    )

    for idx, col in enumerate(data_cols):
        poly.extendeddata.newdata(col, row[idx])
Traceback (most recent call last):
  File "C:\Users\duoqu\miniconda3\envs\junk\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\duoqu\miniconda3\envs\junk\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "c:\Users\duoqu\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher/../..\debugpy\__main__.py", line 39, in <module>
    cli.main()
  File "c:\Users\duoqu\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher/../..\debugpy/..\debugpy\server\cli.py", line 430, in main
    run()
  File "c:\Users\duoqu\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher/../..\debugpy/..\debugpy\server\cli.py", line 284, in run_file
    runpy.run_path(target, run_name="__main__")
  File "c:\Users\duoqu\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 321, in run_path
    return _run_module_code(code, init_globals, run_name,
  File "c:\Users\duoqu\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 135, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "c:\Users\duoqu\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 124, in _run_code
    exec(code, run_globals)
  File "d:\Projects\test\convert.py", line 48, in <module>
    kml.save("areas.kml")
  File "C:\Users\duoqu\miniconda3\envs\junk\lib\site-packages\simplekml\kml.py", line 331, in save
    out = self._genkml(format)
  File "C:\Users\duoqu\miniconda3\envs\junk\lib\site-packages\simplekml\kml.py", line 243, in _genkml
    kml_str = xml.dom.minidom.parseString(xml_str.encode("utf-8"))
  File "C:\Users\duoqu\miniconda3\envs\junk\lib\xml\dom\minidom.py", line 1969, in parseString
    return expatbuilder.parseString(string)
  File "C:\Users\duoqu\miniconda3\envs\junk\lib\xml\dom\expatbuilder.py", line 925, in parseString
    return builder.parseString(string)
  File "C:\Users\duoqu\miniconda3\envs\junk\lib\xml\dom\expatbuilder.py", line 223, in parseString
    parser.Parse(string, True)
xml.parsers.expat.ExpatError: not well-formed (invalid token): line 13, column 198566

Thanks!

Trouble with "style"

from simplekml import Kml, Style

kml = Kml()
fol = kml.newfolder(name="GateWay")
sharedstyle = Style()
sharedstyle.labelstyle.color = 'ff0000ff' # Red
sharedstyle.iconstyle.color = 'ff0000ff' # Red
pnt = fol.newpoint( name='test', coords=[(100,14)] )
pnt.sytle = sharedstyle # ##>>>>>> Whoop pnt.style not sytle !!!
kml.save("Bug.kml")

Using a street address with simplekml instead of coordinates

Hello,

SimpleKML is a great tool - thank you

I'm having trouble using a street address (as opposed to coords) as an input to simpleKML, for use with Google mymaps or Google Earth.

Does anyone have any tips on how to configure the input to make it functional. Perhaps some sample code if possible.

Bug: Gx:Angle in GxTrack causes TypeError

Reproducible Example

import simplekml
trk = simplekml.GxTrack()
trk.newgxangle(0)
trk.__str__()

Issue Description
The snippet above produces a TypeError:

File "C:\Users\uzzell\AppData\Local\Programs\Python\Python39\lib\site-packages\simplekml\featgeom.py", line 2345, in __str__
    angle_str = ' '.join(map(str, angle))
TypeError: 'int' object is not iterable

If one adds a gx:angle to a GxTrack, the track's __str__() function no longer works. This makes it impossible to save a KML file that contains angles.

Expected Behavior
No error message. I would expect the result of trk.__str__() to be something like "<gx:Track><gx:angles>0</gx:angles></gx:Track>".

Additional information
The relevant portion of feat_geom.py has

        for angle in self.gxangles:
            angle_str = ' '.join(map(str, angle))
            buf.append("<gx:angles>{0}</gx:angles>".format(angle_str))

Removing angle_str = ' '.join(map(str, angle)) and replacing format(angle_str) with format(angle) looks like it would solve the problem.

Support for python 3.11

Gentoo has switched to python-3.11 as the default python version. One of the packages flagged for not supporting 3.11 is simplekml.

$ emerge -vp simplekml

These are the packages that would be merged, in order:

Calculating dependencies \

!!! Problem resolving dependencies for dev-python/simplekml
... done!
Dependency resolution took 0.89 s.


!!! The ebuild selected to satisfy "simplekml" has unmet requirements.
- dev-python/simplekml-1.3.6::gentoo USE="" ABI_X86="(64)" PYTHON_TARGETS="-python3_10"

  The following REQUIRED_USE flag constraints are unsatisfied:
    python_targets_python3_10

  The above constraints are a subset of the following complete expression:
    any-of ( python_targets_python3_10 )

https://bugs.gentoo.org/896876

Does simplekml-1.3.6 support python-3.11?

Deprecation warning when installing with latest version of pip

First of all: thanks for this library; it's really well done and useful.

When using pip 22.3 and setuptools 65.5.0 under python 3.8.10 in a new virtual environment, I see the following deprecation warning when installing simplekml:

DEPRECATION: simplekml is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559

Looks like this won't be an active problem until April of 2023, but I wanted to make you aware.

Thanks!

How to read a kml file?

I have some kml files, how to read them ?
how to parse kml file ?

Your document seem don't have open or read file function

solved, use pyKML ,done

Problem using polygon with multiple inner boundaries

As I am fairly new to python in general and only worked with simpleKml for a few weeks I recently asked for advice here:
https://gis.stackexchange.com/questions/447853/simplekml-adding-polygons-with-multiple-innerboundaries-works-for-google-earth

SimpleKml offers an effective way to write the code to create the KML file for my bathymetric maps. And right now I have almost achieved the desired result. But this final problem with multiple inner boundaries I need to solve as Google Maps for Android simply cannot handle the KML structure properly: I either fix this, or drop the use of simpleKml and start looking for alternatives.

As demonstrated in the above link: The problem I experience with Google Maps for Android as compared to Google Earth is that filled polygons are not added to the map in any particular order. Thus, polygons for a colored bathymetric map needs to be built with both outer and inner boundaries. As seen in the link (bottom part with my sample code) I add the inner boundaries to an array (also tried list) and declare them as "innerboundaryis" to polygon objects at the end. My problem is however how the resulting inner boundaries ends up in the KML file:

  • I get: A single innerboundaryis is with multiple LinearRing objects inside
  • Instead of the needed: Multiple innerboundaryis with a single LinerarRing object inside each

While Google Earth handles both alternatives with ease, Google Maps for Android only properly handles the latter.

Is there any way at all for me to write the code differently to achieve the (for Google Maps Android) mandatory "one innerboundaryis for each inner polygon"?

The response received so far to the question on gis stack exchange suggests simpleKml may have implemented multiple inner boundaries wrong and that the KML specification may be interpreted to support the second bullet above. At least, this is how Google Maps for Android seems to expect the structure.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.