Leaflet獲取某一范圍內的矢量數據,並顯示在地圖上


http://xx:6080/arcgis/rest/services/jiangyin/jiangyin/FeatureServer/0/query?where=1%3D1&objectIds=&time=&geometry=120.308%2C31.923%2C120.326%2C31.935&geometryType=esriGeometryEnvelope&inSR=&spatialRel=esriSpatialRelIntersects&relationParam=&outFields=*&returnGeometry=true&maxAllowableOffset=&geometryPrecision=&outSR=&gdbVersion=&returnDistinctValues=false&returnIdsOnly=false&returnCountOnly=false&orderByFields=&groupByFieldsForStatistics=&outStatistics=&returnZ=false&returnM=false&f=json

 

>>https://www.cnblogs.com/2008nmj/p/14053361.html

Using GeoJSON with Leaflet:https://leafletjs.com/examples/geojson/

GeoJSON is becoming a very popular data format among many GIS technologies and services — it's simple, lightweight, straightforward, and Leaflet is quite good at handling it. In this example, you'll learn how to create and interact with map vectors created from GeoJSON objects.

什么是GeoJSON?

GeoJSON is a format for encoding a variety of geographic data structures […]. A GeoJSON object may represent a region of space (a Geometry), a spatially bounded entity (a Feature), or a list of Features (a FeatureCollection). GeoJSON supports the following geometry types: Point, LineString, Polygon, MultiPoint, MultiLineString, MultiPolygon, and GeometryCollection. Features in GeoJSON contain a Geometry object and additional properties, and a FeatureCollection contains a list of Features.

GeoJSON是一種編碼各種地理數據結構的格式[…]。GeoJSON對象可以表示一個空間區域(一個幾何體)、一個空間邊界實體(一個特性),或者一個特性列表(一個FeatureCollection)。GeoJSON支持以下幾何體類型:點、線串、多邊形、多點、多線串、多多邊形和幾何體集合。GeoJSON中的特性包含一個Geometry對象和其他屬性,FeatureCollection包含一個特性列表。

Leaflet supports all of the GeoJSON types above, but Features and FeatureCollections work best as they allow you to describe features with a set of properties. We can even use these properties to style our Leaflet vectors. Here's an example of a simple GeoJSON feature:

Leaflet支持所有的上述GeoJSON類型,但是Features和FeatureCollections工作最好,因為它們允許你使用一套屬性來描述特征。我們可以使用這些屬性來給我們的Leaflet矢量賦予格式。這里是一個簡單的GeoJSON特征的例子:

var geojsonFeature = {
    "type": "Feature",
    "properties": {
        "name": "Coors Field",
        "amenity": "Baseball Stadium",
        "popupContent": "This is where the Rockies play!"
    },
    "geometry": {
        "type": "Point",
        "coordinates": [-104.99404, 39.75621]
    }
};

The GeoJSON layer

GeoJSON objects are added to the map through a GeoJSON layer. To create it and add it to a map, we can use the following code:

L.geoJSON(geojsonFeature).addTo(map);

GeoJSON objects may also be passed as an array of valid GeoJSON objects.

var myLines = [{
    "type": "LineString",
    "coordinates": [[-100, 40], [-105, 45], [-110, 55]]
}, {
    "type": "LineString",
    "coordinates": [[-105, 40], [-110, 45], [-115, 55]]
}];

Alternatively, we could create an empty GeoJSON layer and assign it to a variable so that we can add more features to it later.

或者,我們可以創建一個空的GeoJSON層,並將其分配給一個變量,以便以后可以向其添加更多特性。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM