2

I have huge datasets on PostGIS. For example building table includes more than 100k features in POLYGON geometry. When I want to get all data in QGIS (2.1) or other GIS software by using direct DB connection I wait about 30 sec. But if use WFS connection (GeoServer) it takes more time (don't try)... In a web GIS project (using OpenLayers) people don't want to wait in front of the screen. And I think OpenLayers can't handle with that amount of data... So I use to serve data by using WMS. It's really too fast and maybe later I try tilecaching etc... OK everything is so far so good. But I want to edit features (only insert maybe delete, but no update) in the browser.

I have checked OpenLayers examples for WFS-T. These examples load all data to by WFS. I don't want loading data just inserting new features by drawing and than clicking save button. So new features sending to GeoServer...

I tried with OpenLayers WFS-transaction example link. Firstly modified data map.addlayers([wfs,gpyh]); to map.addlayers([gpyh]); to load only googlemaps baselayer. There is no error during drawing but when saving I get error. I says

this.layer.map is null
var local = this.layer.map.getProjectionObject();

What do you advise me when working with big layers.Is my way correct. How can I handle with this issue? My JavaScript knowledge is limited.

EDIT

Some info about the system which I want to build:

I want to serve buildings, roads, boundary etc. layers to people. Not only showing but also editing capabilities it should have.

MY PROBLEM:

I don't want to load features to OpenLayers, I just want to draw new features and put them into database. And I use WMS for serving layers.

I use OpenLayers lib in client side (apprentice in JavaScript).

The data is stored in PostGIS., but I can use Spatialite.

GeoServer for WMS and WFS service.

I am not bad in Python and PHP. Maybe I can use FeatureServer. Also I can serve feature data with PHP or Python.

3
  • 1
    100K isn't a lot of features in a database, and presumably you won't be able to show all of those on the screen at once. Do you have good indexing? This question is pretty confusing, so I think you should consider editing it to show the real code you are using, and remove the parts that aren't relevant to the question you are trying to ask. Is this about WFS, WMS, Openlayers, QGIS or what? If you can't explain the question, we can't provide an answer.
    – BradHards
    Commented Oct 19, 2013 at 23:18
  • 1
    There is a good Meta Q&A on What makes a good Question? that is well worth reviewing as you try to revise your question to become Answer-able. I would start with its title because once that has a question mark on it adding focus to the rest of the Question should follow.
    – PolyGeo
    Commented Oct 20, 2013 at 22:22
  • I feel that even with the edit, the question is confusing. Firstly, what are you asking? DO you want help with the general architecture, or with the specific error that you are getting? Where are you stuck? what have you tried? Commented Oct 21, 2013 at 3:07

1 Answer 1

0

if you only want to insert features, you can directly do that in database. With openlayers draw the feature then convert it to WKT.

This code will output the WKT geometry of the added feature in an input field with id geometry. Then you can use php to make connection to database and insert it there.

 //Draw Feature control
                var draw = new OpenLayers.Control.DrawFeature(
                        vector,         //layer
                        OpenLayers.Handler.Path, //Handler
                        {       multi:true,
                                type: OpenLayers.Control.TYPE_TOGGLE,
                                //handlerOptions : {maxVertices: 5}
                        }//options
                );
                map.addControl(draw);
                draw.events.register("featureadded",'' , FeatureAdded);
                function FeatureAdded(object){ 
                        //alert('feature added');
                        var oFeature = object.feature; 
                        oFeature.state = OpenLayers.State.INSERT;  
                        document.getElementById('geometry').value = oFeature.geometry;

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