GeoJSON स्टाइलिंग जानकारी


25

जहाँ तक मैं देख सकता हूँ कि स्टाइल की जानकारी, लाइन रंग, मोटाई आदि को स्टोर करने के लिए जियोसन मानक में कुछ भी नहीं है।

क्या मुझे कुछ याद आ रहा है या यह कुछ ऐसा है जो जियोसन के साथ नहीं है?

जवाबों:


18

GeoJSON के लिए - सीएसएस शैलियों का उपयोग मोटाई और रंग के साथ आपके बिंदुओं, रेखा, बहुभुज को संशोधित करने के लिए किया जाता है

{ 
    "type": "Feature",
    "geometry": {
    "type": "Polygon",
    "coordinates": [[
        [-180.0, 10.0], [20.0, 90.0], [180.0, -5.0], [-30.0, -90.0]
        ]]
    },
    "style": {
        "__comment": "all SVG styles allowed",
        "fill":"red",
        "stroke-width":"3",
        "fill-opacity":0.6
    },
    "className": {
        "baseVal":"A class name"
    }
}

http://wiki.openstreetmap.org/wiki/Geojson_CSS


1
यह GeoJSON कल्पना का हिस्सा प्रतीत नहीं होता है। क्या यह एक सामान्य कार्यान्वयन है?
Mr_Chimp

हाँ आम सामान्य कार्यान्वयन, कि काम करता है - GeoJOSN एक 'भू-स्थानिक डेटा विनिमय प्रारूप' है
Mapperz

थोड़ा सा विषय है, लेकिन क्या यह जियोसोन_केक्स कार्टो मैपबॉक्स से संबंधित है / -कार्टो
फ्रांसिस्को पूगा

6
यह एक मानक बात नहीं है और प्रत्येक कार्यान्वयन इसे अलग तरीके से करने जा रहा है।
केल्विन

3
QGis (जो हुड के नीचे GDAL का उपयोग करता है) और geojsonlint.com , 2 उदाहरणों को नाम देने के लिए, "शैली" विशेषता का उपयोग करते समय त्रुटियों को फेंक देते हैं।
मारी १

10

इन दिनों मेपबॉक्स का सिंपलसैट है

"properties": {
        // OPTIONAL: default ""
        // A title to show when this item is clicked or
        // hovered over
        "title": "A title",

        // OPTIONAL: default ""
        // A description to show when this item is clicked or
        // hovered over
        "description": "A description",

        // OPTIONAL: default "medium"
        // specify the size of the marker. sizes
        // can be different pixel sizes in different
        // implementations
        // Value must be one of
        // "small"
        // "medium"
        // "large"
        "marker-size": "medium",

        // OPTIONAL: default ""
        // a symbol to position in the center of this icon
        // if not provided or "", no symbol is overlaid
        // and only the marker is shown
        // Allowed values include
        // - Icon ID from the Maki project at http://mapbox.com/maki/
        // - An integer 0 through 9
        // - A lowercase character "a" through "z"
        "marker-symbol": "bus",

        // OPTIONAL: default "7e7e7e"
        // the marker's color
        //
        // value must follow COLOR RULES
        "marker-color": "#fff",

        // OPTIONAL: default "555555"
        // the color of a line as part of a polygon, polyline, or
        // multigeometry
        //
        // value must follow COLOR RULES
        "stroke": "#555555",

        // OPTIONAL: default 1.0
        // the opacity of the line component of a polygon, polyline, or
        // multigeometry
        //
        // value must be a floating point number greater than or equal to
        // zero and less or equal to than one
        "stroke-opacity": 1.0,

        // OPTIONAL: default 2
        // the width of the line component of a polygon, polyline, or
        // multigeometry
        //
        // value must be a floating point number greater than or equal to 0
        "stroke-width": 2,

        // OPTIONAL: default "555555"
        // the color of the interior of a polygon
        //
        // value must follow COLOR RULES
        "fill": "#555555",

        // OPTIONAL: default 0.6
        // the opacity of the interior of a polygon. implementations
        // may choose to set this to 0 for line features.
        //
        // value must be a floating point number greater than or equal to
        // zero and less or equal to than one
        "fill-opacity": 0.5
    }

युक्ति में स्टाइलिंग गुण भी गुण हैं, इसलिए हमेशा जहाँ जोंसन की अपेक्षा की जाती है वहां काम करना चाहिए।
अब्बाफी

इस स्टाइलिंग का उपयोग जीथब के जियोजोन रेंडरिंग (जो लीफलेट पर बनाया गया है) द्वारा किया जाता है: help.github.com/en/articles/…
एरियल एलोन

4

GeoJSON इससे निपटता नहीं है। किसी भी शैली की जानकारी इस बात पर निर्भर करने वाली है कि रेंडर क्या है, जियोजोन सीएसएस सीवीजी को लक्षित करने के लिए है, लेकिन आपके पास कार्टो है जो मैपनिक को लक्षित करता है, याद रखें कि आप जियोजोन में अतिरिक्त क्षेत्र जोड़ सकते हैं और यह अभी भी मान्य होगा ताकि इनमें से कोई भी अमान्य जेजेन्सन न हो ।


1

मुझे लगता है कि यह सभी प्रकार की वर्तनी है और यदि आप चाहें तो आप अधिक परिभाषा जोड़ सकते हैं। मुझे नहीं लगता कि यह json कल्पना में भाग नहीं लेने के लिए बहुत महत्वपूर्ण है ... json ऑब्जेक्ट के लिए कोई सीमा नहीं है, केवल महत्वपूर्ण बात यह है कि आपके json को सही उपयोग के लिए मान्य होना चाहिए ...

और मैंने Mapperz♦जियोजोन की जाँच की है , इसमें कुछ पार्स त्रुटि थी .. और वैध जियोजोन:

{
    "type": "Feature",
    "geometry": {
        "type": "Polygon",
        "coordinates": [
            [
                [-180, 10],[20, 90],[180, -5],[-30, -90]
            ]
        ]
    },
    "style": {
        "stroke-width": "3",
        "fill-opacity": 0.6
    },
    "className": {
        "baseVal": "highway_primary"
    }
}

और अंतिम बात यह है कि आप अपनी जियोजोन फ़ाइल की जाँच कर सकते हैं कि क्या JSONLint से वैध है या नहीं जो कि JSON Valintator है ...

मुझे उम्मीद है इससे आपको मदद मिली होगी


2
मुझे पता है कि यह इस तरह से करना संभव है मैं बस सोच रहा था कि क्या अन्य लोग इसे इस तरह से लागू करें ताकि संगतता को अधिकतम किया जा सके।
Mr_Chimp

स्रोत यहाँ है - wiki.openstreetmap.org/wiki/Geojson_CSS
Mapperz
हमारी साइट का प्रयोग करके, आप स्वीकार करते हैं कि आपने हमारी Cookie Policy और निजता नीति को पढ़ और समझा लिया है।
Licensed under cc by-sa 3.0 with attribution required.