Giter VIP home page Giter VIP logo

Comments (7)

Gonzalo-Mier avatar Gonzalo-Mier commented on June 16, 2024 1

Hi @helix22, welcome to the project!

First, I don't think you can delete the issue. It is good to have a log on doubts people have, so others can solve their questions faster too! btw, rename the issue if you can to give more context. About your questions:

a) Unfortunately the ROS demo was only available for ROS 1. The good part is that Nav2 is working on an interface with F2C.

b) Download your file as Well-Known Text (WKT). You can import a multipolygon as F2CCells c; c.importFromWkt("THE WKT INFO");

I hope this solve the issue :)

from fields2cover.

Gonzalo-Mier avatar Gonzalo-Mier commented on June 16, 2024 1

Hi @helix22,

There is an example in the tutorials on using importFromWkt for a point. Similarly, you can do the same with F2CCell. This is the code in python:

import fields2cover as f2c
c = f2c.Cell()
c.importFromWkt("POLYGON ((571826.879847092 4454303.72791723,571995.622984484 4454429.58217387,572016.674058808 4454401.14195982,571852.381533276 4454277.61374514,571826.879847092 4454303.72791723))")

f2c.Visualizer.figure()
f2c.Visualizer.plot(c)
f2c.Visualizer.show()

Hope this is useful!

from fields2cover.

helix22 avatar helix22 commented on June 16, 2024 1

Hello again! For the record and for anyone wondering in the future I sum up (please jump in where I am mistaken):

My query started since I could not transform the format of my field into the .xml format used in the tutorial 7_complete_flow. So, a field in a shp format, maybe from QGIS app (probably a number of files, 5 in my case: .cpg, .dbf, .shp, .prj, .shx) can be easily converted to WKT from here: https://mygeodata.cloud/converter/shp-to-wkt.

Then, you can create a Cell and import the polygon as above.

Then you can use:

cells = f2c.Cells()
cells.addGeometry(c)

And if using the exact tutorial 7, you will have to switch the "field.field" in the no_hl = ... to "cells", and also in the plotting later, as you have not defined "field" anywhere. So, like this, you can import any field/polygon from wkt format and easily work on it.

Many thanks to Gonzalo-Mier for the explanations.

from fields2cover.

helix22 avatar helix22 commented on June 16, 2024

Dear Gonzalo-Mier, thank you very much for this quick reply!!

Regarding the (1), okay good, I thought I was missing something, maybe I will try installing ROS1 to try it as well!
Regarding the (2), everything is clearer already, I just can't get to place my wkt data into the importFromWkt. Could you spend some more time in order to give me an example? i.e. if my field is this in WKT: "POLYGON ((571826.879847092 4454303.72791723,571995.622984484 4454429.58217387,572016.674058808 4454401.14195982,571852.381533276 4454277.61374514,571826.879847092 4454303.72791723))"

Thanks again!! :)

from fields2cover.

helix22 avatar helix22 commented on June 16, 2024

Done! Great! Ok now I will try to import "c" in the complete flow as a field and transform it to UTM to work in meters.

So many thanks! :)

from fields2cover.

Gonzalo-Mier avatar Gonzalo-Mier commented on June 16, 2024

from fields2cover.

helix22 avatar helix22 commented on June 16, 2024

Right! So the very last question of this thread would be.. Well obviously commenting out field = f2c.Parser... and the transform after, and even more obviously typing instead "field = c" (where c is my polygon that i imported from Wkt, for anyone checking please see above) does not work, so what am I missing for the n^th time? ('Cell' object has not attribute 'field'). A sincere apology for my lack of skills here.

from fields2cover.

Related Issues (20)

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.