Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have a simple SpatiaLite geodb loaded in QGIS with one table. There is a POINT geometry field and some alphanumeric data. In some cases I can record data about a specific site, but the coordinates are not available at this time and will be retrieved and recorded later. In some other cases I have the coordinates and I want to insert them right into the geometry field, preferably by clicking on the map canvas in the same way available for adding new features (having a separate text field for the coordinates and generating the geometry from that is a no-go).

How do I add a geometry to an existing feature that was created with a NULL geometry field?

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

You can do this straight in spatialite. Run an UPDATE query each time you have the coordinates available like:

UPDATE point_table 
SET geometry=MakePoint(<your_new_x_coord>,<your_new_y_coord>, SRID)   
WHERE site_id=...;

This can be done from the spatialite_gui, or one of the QGIS database plugins. Does that help?

share|improve this answer
    
I should have explained that I need a GUI solution (e.g. click on a map) but maybe that can be done in one of the QGIS plugins? –  steko Nov 28 '12 at 13:12
    
I will accept your answer and create a new question more clearly GUI-oriented. –  steko Dec 7 '12 at 9:12
    
How ar eyou adding points to the table with a NULL geometry? I don't think that's possible in QGIS. On the other hand, you could implement a simple trigger to update the geometry column with the actual geometry whenever real x-y coordinates are added. –  Micha Dec 7 '12 at 20:54
    
It is possible in some cases. See this other question that I posted right now. –  steko Dec 8 '12 at 13:12
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.