pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

      <i id='AhEOw'><tr id='AhEOw'><dt id='AhEOw'><q id='AhEOw'><span id='AhEOw'><b id='AhEOw'><form id='AhEOw'><ins id='AhEOw'></ins><ul id='AhEOw'></ul><sub id='AhEOw'></sub></form><legend id='AhEOw'></legend><bdo id='AhEOw'><pre id='AhEOw'><center id='AhEOw'></center></pre></bdo></b><th id='AhEOw'></th></span></q></dt></tr></i><div class="9tzjrtr" id='AhEOw'><tfoot id='AhEOw'></tfoot><dl id='AhEOw'><fieldset id='AhEOw'></fieldset></dl></div>

      <tfoot id='AhEOw'></tfoot>
    1. <small id='AhEOw'></small><noframes id='AhEOw'>

    2. <legend id='AhEOw'><style id='AhEOw'><dir id='AhEOw'><q id='AhEOw'></q></dir></style></legend>
      • <bdo id='AhEOw'></bdo><ul id='AhEOw'></ul>

      TimeSlider 插件和傳單 - 標記未按順序顯示

      TimeSlider Plugin and Leaflet - Markers not appearing in order(TimeSlider 插件和傳單 - 標記未按順序顯示)
    3. <legend id='gGPhn'><style id='gGPhn'><dir id='gGPhn'><q id='gGPhn'></q></dir></style></legend><tfoot id='gGPhn'></tfoot>
        <tbody id='gGPhn'></tbody>
    4. <small id='gGPhn'></small><noframes id='gGPhn'>

            <bdo id='gGPhn'></bdo><ul id='gGPhn'></ul>

                <i id='gGPhn'><tr id='gGPhn'><dt id='gGPhn'><q id='gGPhn'><span id='gGPhn'><b id='gGPhn'><form id='gGPhn'><ins id='gGPhn'></ins><ul id='gGPhn'></ul><sub id='gGPhn'></sub></form><legend id='gGPhn'></legend><bdo id='gGPhn'><pre id='gGPhn'><center id='gGPhn'></center></pre></bdo></b><th id='gGPhn'></th></span></q></dt></tr></i><div class="oom0w2k" id='gGPhn'><tfoot id='gGPhn'></tfoot><dl id='gGPhn'><fieldset id='gGPhn'></fieldset></dl></div>
                本文介紹了TimeSlider 插件和傳單 - 標記未按順序顯示的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                更新了 JSFIDDLE 鏈接

                我正在使用 LeafletJS 構建一個帶有時間軸滑塊的 web 地圖.我正在使用 LeafletSlider 插件 來顯示一組基于名為 DATE_START<的 GEOJSON 屬性的標記/代碼>.這是我的數據對象的示例:

                var camps = {"type": "FeatureCollection",特征": [{類型":特征",特性": {狀態":無人居住","DATE_START": "2015-06-23",DATE_CLOSED":2016-01-23"},幾何學": {類型":點",坐標":[64.6875, 34.97600151317591]}}, {類型":特征",特性": {狀態":占用","DATE_START": "2014-01-21",DATE_CLOSED":2015-05-25"},幾何學": {類型":點",坐標":[65.335693359375, 36.26199220445664]}}, {類型":特征",特性": {狀態":無人居住","DATE_START": "2015-09-13",DATE_CLOSED":"},幾何學": {類型":點",坐標":[67.587890625, 35.969115075774845]}}]};

                我的代碼示例:

                //創建標記層(在示例中通過 GeoJSON FeatureCollection 完成)var testlayer = L.geoJson(營地,{onEachFeature:函數(特征,層){layer.bindPopup(feature.properties.DATE_START);}});var sliderControl = L.control.sliderControl({位置:右上角",層:測試層,時間屬性:'DATE_START'});//確保將滑塊添加到地圖;-)map.addControl(sliderControl);//并初始化滑塊滑塊控制.startSlider();

                我已將時間滑塊插件添加到我的地圖中,盡管它正在運行,但我似乎無法讓滑塊按時間順序顯示標記.例如,具有 2014-01-21DATE_START 值的標記顯示在第二位,而實際上它應該首先顯示,因為它是具有最早日期的標記.

                如何讓我的時間滑塊/標記以正確的順序從最早到最晚出現?謝謝.

                解決方案

                正如 ghybs 在下面提到的(并在an example中顯示),確保滑塊在正確的順序是對sliderControl的options.markers數組進行排序:

                sliderControl.options.markers.sort(function(a, b) {返回(a.feature.properties.DATE_START > b.feature.properties.DATE_START);});

                我的原始答案(如下)對 GeoJSON 的功能進行了排序,但這并不能保證 Leaflet 會以正確的順序返回它們.

                <小時>

                原答案:

                您可以使用 array.sort 方法 對 features 數組進行排序:

                camps.features.sort(function(a, b) {返回(a.properties.DATE_START > b.properties.DATE_START);});

                http://jsfiddle.net/nathansnider/ngeLm8c0/4/p>

                Updated with a JSFIDDLE link

                I am using LeafletJS to build a web map with a timeline slider. I am using the LeafletSlider plugin to show a group of markers based on a GEOJSON property named DATE_START. Here's an example of what my data object looks like:

                var camps = {
                    "type": "FeatureCollection",
                    "features": [{
                        "type": "Feature",
                        "properties": {
                            "STATUS": "UNOCCUPIED",
                            "DATE_START": "2015-06-23",
                            "DATE_CLOSED": "2016-01-23"
                        },
                        "geometry": {
                            "type": "Point",
                            "coordinates": [64.6875, 34.97600151317591]
                        }
                    }, {
                        "type": "Feature",
                        "properties": {
                            "STATUS": "OCCUPIED",
                            "DATE_START": "2014-01-21",
                            "DATE_CLOSED": "2015-05-25"
                        },
                        "geometry": {
                            "type": "Point",
                            "coordinates": [65.335693359375, 36.26199220445664]
                        }
                    }, {
                        "type": "Feature",
                        "properties": {
                            "STATUS": "UNOCCUPIED",
                            "DATE_START": "2015-09-13",
                            "DATE_CLOSED": ""
                        },
                        "geometry": {
                            "type": "Point",
                            "coordinates": [67.587890625, 35.969115075774845]
                        }
                    }]
                };
                

                An example of my code:

                //Create a marker layer (in the example done via a GeoJSON FeatureCollection)
                var testlayer = L.geoJson(camps, {
                    onEachFeature: function(feature, layer) {
                        layer.bindPopup(feature.properties.DATE_START);
                    }
                });
                
                var sliderControl = L.control.sliderControl({
                    position: "topright",
                    layer: testlayer,
                    timeAttribute: 'DATE_START'
                });
                
                //Make sure to add the slider to the map ;-)
                map.addControl(sliderControl);
                
                //And initialize the slider
                sliderControl.startSlider();
                

                I've added the timeslider plugin to my map, and although it's functioning, I can't seem to get the slider to show the markers in a temporal order. For example, the marker with the DATE_START value of 2014-01-21 is shown second when in fact it should be shown first because it's the marker with the earliest date.

                How can I get my timeslider/markers to appear in the correct order from earliest to latest? Thanks.

                解決方案

                EDIT:

                As ghybs mentions below (and shows in an example), the proper way to ensure that the slider returns data in the correct order is to sort the options.markers array of the sliderControl:

                sliderControl.options.markers.sort(function(a, b) {
                    return (a.feature.properties.DATE_START > b.feature.properties.DATE_START);
                });
                

                My original answer (below) sorts the features of the GeoJSON, but this does not guarantee that Leaflet will return them in the correct order.


                Original answer:

                You can use the array.sort method to sort the features array in place:

                camps.features.sort(function(a, b) {
                  return (a.properties.DATE_START > b.properties.DATE_START);
                });
                

                http://jsfiddle.net/nathansnider/ngeLm8c0/4/

                這篇關于TimeSlider 插件和傳單 - 標記未按順序顯示的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                相關文檔推薦

                Check if a polygon point is inside another in leaflet(檢查一個多邊形點是否在傳單中的另一個內部)
                Changing leaflet markercluster icon color, inheriting the rest of the default CSS properties(更改傳單標記群集圖標顏色,繼承其余默認 CSS 屬性)
                Trigger click on leaflet marker(觸發點擊傳單標記)
                How can I change the default loading tile color in LeafletJS?(如何更改 LeafletJS 中的默認加載磁貼顏色?)
                Add external geojson to leaflet layer(將外部geojson添加到傳單層)
                Adding Leaflet layer control to sidebar(將 Leaflet 圖層控件添加到側邊欄)
                • <i id='a6gAt'><tr id='a6gAt'><dt id='a6gAt'><q id='a6gAt'><span id='a6gAt'><b id='a6gAt'><form id='a6gAt'><ins id='a6gAt'></ins><ul id='a6gAt'></ul><sub id='a6gAt'></sub></form><legend id='a6gAt'></legend><bdo id='a6gAt'><pre id='a6gAt'><center id='a6gAt'></center></pre></bdo></b><th id='a6gAt'></th></span></q></dt></tr></i><div class="k0uskiy" id='a6gAt'><tfoot id='a6gAt'></tfoot><dl id='a6gAt'><fieldset id='a6gAt'></fieldset></dl></div>
                • <legend id='a6gAt'><style id='a6gAt'><dir id='a6gAt'><q id='a6gAt'></q></dir></style></legend>

                  <small id='a6gAt'></small><noframes id='a6gAt'>

                  <tfoot id='a6gAt'></tfoot>
                        <tbody id='a6gAt'></tbody>
                        <bdo id='a6gAt'></bdo><ul id='a6gAt'></ul>

                          主站蜘蛛池模板: 冷热冲击试验箱_温度冲击试验箱价格_冷热冲击箱排名_林频厂家 | 安徽成考网-安徽成人高考网 | 艾乐贝拉细胞研究中心 | 国家组织工程种子细胞库华南分库 | 齿轮减速马达一体式_蜗轮蜗杆减速机配电机-德国BOSERL齿轮减速电动机生产厂家 | 玉米加工设备,玉米深加工机械,玉米糁加工设备.玉米脱皮制糁机 华豫万通粮机 | 工业设计,人工智能,体验式3D展示的智能技术交流服务平台-纳金网 J.S.Bach 圣巴赫_高端背景音乐系统_官网 | 合肥弱电工程_安徽安防工程_智能化工程公司-合肥雷润 | 中药超微粉碎机(中药细胞级微粉碎)-百科 | 北京自然绿环境科技发展有限公司专业生产【洗车机_加油站洗车机-全自动洗车机】 | 水性绝缘漆_凡立水_绝缘漆树脂_环保绝缘漆-深圳维特利环保材料有限公司 | LCD3D打印机|教育|桌面|光固化|FDM3D打印机|3D打印设备-广州造维科技有限公司 | 压片机_高速_单冲_双层_花篮式_多功能旋转压片机-上海天九压片机厂家 | 便携式XPDM露点仪-在线式防爆露点仪-增强型烟气分析仪-约克仪器 冰雕-冰雪世界-大型冰雕展制作公司-赛北冰雕官网 | 碳钢法兰厂家,非标法兰,定制异型,法兰生产厂家-河北九瑞管道 | 解放卡车|出口|济南重汽|报价大全|山东三维商贸有限公司 | 西门子代理商_西门子变频器总代理-翰粤百科 | 重庆中专|职高|技校招生-重庆中专招生网| 湖南印刷厂|长沙印刷公司|画册印刷|挂历印刷|台历印刷|杂志印刷-乐成印刷 | 土壤水分自动监测站-SM150便携式土壤水分仪-铭奥仪器 | 不锈钢反应釜,不锈钢反应釜厂家-价格-威海鑫泰化工机械有限公司 不干胶标签-不干胶贴纸-不干胶标签定制-不干胶标签印刷厂-弗雷曼纸业(苏州)有限公司 | 武汉高温老化房,恒温恒湿试验箱,冷热冲击试验箱-武汉安德信检测设备有限公司 | 硫化罐_蒸汽硫化罐_大型硫化罐-山东鑫泰鑫智能装备有限公司 | 品牌策划-品牌设计-济南之式传媒广告有限公司官网-提供品牌整合丨影视创意丨公关活动丨数字营销丨自媒体运营丨数字营销 | 高防护蠕动泵-多通道灌装系统-高防护蠕动泵-www.bjhuiyufluid.com慧宇伟业(北京)流体设备有限公司 | 干式变压器厂_干式变压器厂家_scb11/scb13/scb10/scb14/scb18干式变压器生产厂家-山东科锐变压器有限公司 | 海尔生物医疗四川代理商,海尔低温冰箱四川销售-成都壹科医疗器械有限公司 | 深圳办公室装修,办公楼/写字楼装修设计,一级资质 - ADD写艺 | 除甲醛公司-甲醛检测-广西雅居环境科技有限公司 | 超声波破碎仪-均质乳化机(供应杭州,上海,北京,广州,深圳,成都等地)-上海沪析实业有限公司 | 杭州双螺杆挤出机-百科 | 老房子翻新装修,旧房墙面翻新,房屋防水补漏,厨房卫生间改造,室内装潢装修公司 - 一修房屋快修官网 | 电动百叶窗,开窗器,电动遮阳百叶,电动开窗机生产厂家-徐州鑫友工控科技发展有限公司 | 安徽泰科检测科技有限公司【官方网站】 | 鑫达滑石-辽宁鑫达滑石集团 | 合肥通道闸-安徽车牌识别-人脸识别系统厂家-安徽熵控智能技术有限公司 | 胶辊硫化罐_胶鞋硫化罐_硫化罐厂家-山东鑫泰鑫智能装备有限公司 意大利Frascold/富士豪压缩机_富士豪半封闭压缩机_富士豪活塞压缩机_富士豪螺杆压缩机 | 北京公寓出租网-北京酒店式公寓出租平台 | 拉曼光谱仪_便携式|激光|显微共焦拉曼光谱仪-北京卓立汉光仪器有限公司 | 电动手术床,医用护理床,led手术无影灯-曲阜明辉医疗设备有限公司 | 锂电叉车,电动叉车_厂家-山东博峻智能科技有限公司 | POS机官网 - 拉卡拉POS机免费办理|官网在线申请入口 |