5.1. Lesson: Crearea unui Nou Set de Date Vectoriale

Datele pe care le utlizați trebuie să vină de undeva. Pentru aplicațiile uzuale, datele există deja; dar cu cât proiectul este mai aparte și mai specializat, cu atât scad șansele ca datele să fie disponibile. În asemenea cazuri va fi nevoie să va creați propriile date.

Scopul acestei lecții: De a crea un nou set de date vectoriale.

5.1.1. basic Follow Along: Dialogul de Creare a unui Strat

Înainte de a adăuga date vectoriale noi veți avea nevoie de un set de date la care să le adăugați. În cazul nostru veți începe prin a creea date complet noi, mai degrabă decât să editați un set de date existent. În concluzie, va trebui să începeți prin a crea propriul set de date.

  1. Open QGIS and create a new blank project.

  2. Navigate to and click on the menu entry Layer ► Create Layer ► New Shapefile Layer. You’ll be presented with the New Shapefile Layer dialog, which will allow you to define a new layer.

    ../../../_images/create_vector_layer.png
  3. Click for the File name field. A save dialog will appear.

  4. Navigate to the exercise_data directory.

  5. Save your new layer as school_property.shp.

    Este important să decideți ce fel de set de date doriți. Fiecare tip de strat vectorial este „construit diferit” în fundal, deci odată ce ați creat un strat, nu îi puteți schimba tipul.

    For the next exercise, we’re going to create new features which describe areas. For such features, you’ll need to create a polygon dataset.

  6. For Geometry Type, select Polygon from the drop down menu:

    ../../../_images/polygon_selected.png

    Aceasta nu are nici un impact asupra restului dialogului, dar va determina folosirea tipului corect de geometrie care să fie utilizat la crearea setului de date vectorial.

    The next field allows you to specify the Coordinate Reference System, or CRS. CRS is a method of associating numerical coordinates with a position on the surface of the Earth. See the User Manual on Working with Projections to learn more.

    For this example we will use the default CRS associated with this project, which is WGS84.

    ../../../_images/default_crs.png

    Next there is a collection of fields grouped under New Field. By default, a new layer has only one attribute, the id field (which you should see in the Fields list) below. However, in order for the data you create to be useful, you actually need to say something about the features you’ll be creating in this new layer. For our current purposes, it will be enough to add one field called name that will hold Text data and will be limited to text length of 80 characters.

  7. Replicate the setup below, then click the Add to Fields List button:

    ../../../_images/new_attribute.png
  8. Verificați dacă dialogul dvs. arată acum astfel:

    ../../../_images/new_attribute_added.png
  9. Clic pe OK

The new layer should appear in your Layers panel.

5.1.2. basic Follow Along: Sursele de Date

Când creați date noi, este evident necesar să se refere la obiecte care există întradevăr pe teren. De aceea, va fi nevoie să obțineți informația de undeva.

Există multe moduri de a obține date despre obiecte. De exemplu, ați putea folosi un GPS pentru a caputra puncte din lumea reală, după care să importați datele in QGIS. Sau ați putea să identificați punctele folosind un teodolit, după care să introduceți manual coordonatele pentru a crea noi entități.

Pentru exemplul nostru, veți folosi digitizarea. Eșantioanele seturilor de date raster vă sunt puse la dispoziție, așa că va trebui să le importați după nevoie.

  1. Click on dataSourceManager Data Source Manager button.

  2. Select raster Raster on the left side.

  3. In the Source panel, click on the button:

  4. Navigate to exercise_data/raster/.

  5. Select the file 3420C_2010_327_RGB_LATLNG.tif.

  6. Click Open to close the dialogue window.

    ../../../_images/add_raster.png
  7. Click Add and Close. An image will load into your map.

    ../../../_images/raster_added.png
  8. If you don’t see an aerial image appear, select the new layer, right click, and choose Zoom to Layer in the context menu.

    ../../../_images/zoom_to_raster.png
  9. Click on the zoomIn Zoom In button, and zoom to the area highlighted in blue below:

    ../../../_images/map_area_zoom.png

Now you are ready to digitize these three fields:

../../../_images/field_outlines1.png

Before starting to digitize, let’s move the school_property layer above the aerial image.

  1. Select school_property layer in the Layers pane and drag it to the top.

../../../_images/move_school_layer.png

Pentru a începe digitizarea trebuie să intrați în modul editare. Aplicațiile GIS cer asta în mod curent pentru a preveni modificarea sau ștergerea accidentală a datelor importante. Modul editare este activat sau dezactivat independent pentru fiecare strat.

To enter edit mode for the school_property layer:

  1. Click on the school_property layer in the Layers panel to select it.

  2. Click on the toggleEditing Toggle Editing button.

    Dacă nu puteți găsi acest buton, verificați dacă bara de instrumente Digitizing este activată. Ar trebui să existe un semn de selectare lângă elementul de meniu View ► Toolbars ► Digitizing.

    As soon as you are in edit mode, you’ll see that some digitizing tools have become active:

    • capturePolygon Capture Polygon

    • vertexToolActiveLayer Vertex Tool

    Other relevant buttons are still inactive, but will become active when we start interacting with our new data.

    Notice that the layer school_property in the Layers panel now has the pencil icon, indicating that it is in edit mode.

  3. Click on the capturePolygon Capture Polygon button to begin digitizing our school fields.

    You’ll notice that your mouse cursor has become a crosshair. This allows you to more accurately place the points you’ll be digitizing. Remember that even when you’re using the digitizing tool, you can zoom in and out on your map by rolling the mouse wheel, and you can pan around by holding down the mouse wheel and dragging around in the map.

    Prima entitate pe care o veți digitaliza este athletics field:

    ../../../_images/school_area_one.png
  4. Începeți digitizarea făcând clic pe un punct, de-a lungul marginii câmpului.

  5. Plasați mai multe puncte, făcând clic în continuare de-a lungul marginii, până când forma desenată acoperă complet câmpul.

    ../../../_images/school_field_outline.png
  6. After placing your last point, right click to finish drawing the polygon. This will finalize the feature and show you the Attributes dialog.

  7. Completați valorile, așa cum se arată mai jos:

    ../../../_images/school_area_one_attributes.png
  8. Click OK, and you have created a new feature!

    ../../../_images/new_feature.png
  9. In the Layers panel select the school_property layer.

  10. Right click and choose Open Attribute Table in the context menu.

    ../../../_images/open_attribute_table.png

    In the table you will see the feature you just added. While in edit mode you can update the attributes data by double click on the cell you want to update.

    ../../../_images/feature_table.png
  11. Închideți tabelul de atribute.

  12. To save the new feature we just created, click on saveEdits Save Edits button.

Amintiți-vă că dacă ați făcut o greșeală în timp ce digitizați o entitate, o puteți edita oricând după ce ați definitivat crearea ei. Dacă ați făcut o greșeală, continuați digitizarea până ați terminat crearea entității de mai sus. Apoi:

  1. Click on vertexToolActiveLayer Vertex Tool button.

  2. Hover the mouse over a vertex you want to move and left click on the vertex.

  3. Move the mouse to the correct location of the vertex, and left click. This will move the vertex to the new location.

    ../../../_images/select_vertex.png
    ../../../_images/moved_vertex.png

    The same procedure can be used to move a line segment, but you will need to hover over the midpoint of the line segment.

    If you want to undo a change, you can press the undo Undo button or Ctrl+Z.

  4. Remember to save your changes by clicking the saveEdits Save Edits button.

  5. When done editing, click the toggleEditing Toggle Editing button to get out of edit mode.

5.1.3. basic Try Yourself Digitizing Polygons

Digitizarea școlii propriu-zise și a câmpului de sus. Utilizați această imagine pentru a vă ajuta:

../../../_images/field_outlines1.png

Remember that each new feature needs to have a unique id value!

Notă

După ce ați terminat de adăugat entitățile într-un strat, nu uitați să salvați modificările și să ieșiți din modul de editare.

Notă

You can style the fill, outline and label placement and formatting of the school_property using techniques learnt in earlier lessons.

5.1.4. moderate Follow Along: Using Vertex Editor Table

Another way to edit a feature is to manually enter the actual coordinate values for each vertex using the Vertex Editor table.

  1. Make sure you are in edit mode on layer school_property.

  2. If not already activated, click on vertexToolActiveLayer Vertex Tool button.

  3. Move the mouse over one of the polygon features you created in the school_property layer and right click on it. This will select the feature and a Vertex Editor pane will appear.

    ../../../_images/vertex_editor_table.png

    Notă

    This table contains the coordinates for the vertices of the feature. Notice there are seven vertices for this feature, but only six are visually identified in the map area. Upon closer inspection, one will notice that row 0 and 6 have identical coordinates. These are the start and end vertices of the feature geometry, and are required in order to create a closed polygon feature.

  4. Click and drag a box over a vertex, or multiple vertices, of the selected feature.

    ../../../_images/vertex_select.png

    The selected vertices will change to a color blue and the Vertex Editor table will have the corresponding rows highlighted, which contain the coordinates of the vertices.

    ../../../_images/vertex_selected.png
  5. To update a coordinate, double left click on the cell in the table that you want to edit and enter the updated value. In this example, the x coordinate of row 4 is updated from 20.4450 to 20.4444.

    ../../../_images/edit_vertex_in_vertex_editor.png
  6. After entering the updated value, hit the enter key to apply the change. You will see the vertex move to the new location in the map window.

  7. When done editing, click the toggleEditing Toggle Editing button to get out of edit mode, and save your edits.

5.1.5. basic Try Yourself Digitizing Lines

We are going to digitize two routes which are not already marked on the roads layer; one is a path, the other is a track. Our path runs along the southern edge of the suburb of Railton, starting and ending at marked roads:

../../../_images/path_start_end.png

Piste este situată un pic mai departe de sud:

../../../_images/track_start_end.png
  1. If the roads layer is not yet in your map, then add the roads layer from the GeoPackage file training-data.gpkg included in the exercise_data folder of the training data you downloaded. You can read Follow Along: Loading vector data from a GeoPackage Database for a how-to.

  2. Create a new ESRI Shapefile line dataset called routes.shp in the exercise_data directory, with attributes id and type (use the approach above to guide you.)

  3. Activate edit mode on the routes layer.

  4. Since you are working with a line feature, click on the captureLine Add Line button to initiate line digitizing mode.

  5. One at a time, digitize the path and the track on the routes layer. Try to follow the routes as accurately as possible, adding additional points along corners or turns.

  6. Set the type attribute value to path or track.

  7. Use the Layer Properties dialog to add styling to your routes. Feel free to use different styles for paths and tracks.

  8. Save your edits and toggle off editing mode by pressing the toggleEditing Toggle Editing button.

5.1.6. In Conclusion

Acum știți cum să creați entități! Acest curs nu acoperă adăugarea entităților de tip punct, deoarece nu este neapărat necesară după ce ați lucrat cu entități mai complexe (lini și poligoane). Funționează exact la fel, cu excepția faptului că dați clic doar o singură dată unde doriți să plasați punctul, îi completați atributele ca de obicei, după care entitatea este creată.

Cunoașterea digitizării este importantă deoarece reprezintă o activitate frecventă în aplicațiile GIS.

5.1.7. What’s Next?

Features in a GIS layer aren’t just pictures, but objects in space. For example, adjacent polygons know where they are in relation to one another. This is called topology. In the next lesson you’ll see an example of why this can be useful.