Drag (modify) to achieve point openlayers, the increase in modification and deletion point in the layer.

 

Recently busy the whole map, we have forgotten to precipitate their own summary, self-review.

Summarize the contents of a recent study of the use of openlayer, first about my business logic of it, in indoor maps

1. Click on the map to add a new drag point can determine the location of the drag is complete, add additional data, saving storage.

2, after increasing the display point number has the above points.

3, modify, elected in a record time of need to map points highlighted above, this time can drag position, modify the form data, the modified save.

4. Select a record is deleted, delete the record map points to delete.

Since the method based on the old version of the development, as used herein, are openlayer4.6.5 version, specific problems or must refer api, look at the problems encountered api, the official website address: https://openlayers.org/

I am also a beginner, I stood beginner's point of view to think, to solve the problem, first of all is to add points.

I wait for the next down briefly say that I understand openlayers of ah:

 Directly on the map, it can be seen handmade

First five core maps, map, you would have to declare him a map, what did he not also dry.

view, which is a coordinate system (center point), zoom (zoom) level and so on.

control control map shown above Button

layer layer, the core map, the map is actually a layer stacked up not on a plane.

soure source of this data is the key

The source also speak good variety of points, he said this geometry, his Chinese means the feature / graphic meaning, a graphic by points, lines constitute it,

and so

Geometry = Features + attribute;

For starters, do not know how to generate points on the map, the idea is this.

1, is defined in the layer (Layer)

 

2, on the layer we add to this style,

 

These two methods can be found in the api.

In fact, we need to define the style, to tell him what kind of points we want.

You need to define or add to the layer above can.

In fact, the whole point of view it is not two, the definition of style, the return of the style, add to your layers can also be defined directly in the layer.

Implement drag and drop points, we need to add modify method.

这样定义就可以拖拽了。

这是监听拖拽完以后发生的事件,

也可以移除modify

不管怎样有啥不会的,先去api找方法。

 

Guess you like

Origin www.cnblogs.com/cqy1125/p/11166382.html