একটি choropleth মানচিত্র হল এক ধরনের থিম্যাটিক মানচিত্র যেখানে প্রশাসনিক অঞ্চলগুলি একটি ডেটা মান অনুসারে রঙিন বা ছায়াযুক্ত হয়। আপনি ডেটার উপর ভিত্তি করে একটি মানচিত্রের স্টাইল করার জন্য একটি স্টাইল ফ্যাক্টরি ফাংশন ব্যবহার করতে পারেন যেখানে প্রতিটি প্রশাসনিক এলাকা বিভিন্ন সাংখ্যিক মানের সাথে যুক্ত থাকে। নিম্নলিখিত উদাহরণ মানচিত্র মার্কিন যুক্তরাষ্ট্র রাজ্যের জন্য একটি choropleth মানচিত্র দেখায়.
এই উদাহরণে, ডেটা রাজ্যের স্থান আইডি নিয়ে গঠিত। স্টাইল ফ্যাক্টরি ফাংশন শর্তসাপেক্ষে রাজ্যের জন্য স্থান আইডির হ্যাশড মানের উপর ভিত্তি করে প্রতিটি রাজ্যকে রঙ করে।
যদি আপনি ইতিমধ্যে এটি না করে থাকেন, তাহলে একটি নতুন মানচিত্র ID এবং মানচিত্রের শৈলী তৈরি করতে শুরু করুন -এর ধাপগুলি অনুসরণ করুন৷ প্রশাসনিক এলাকা স্তর 1 বৈশিষ্ট্য স্তর সক্রিয় করতে ভুলবেন না.
মানচিত্র শুরু হলে প্রশাসনিক এলাকা স্তর 1 বৈশিষ্ট্য স্তরের একটি রেফারেন্স পান। মার্কিন যুক্তরাষ্ট্রের জন্য, এই প্রশাসনিক স্তরগুলি পৃথক রাজ্যের সাথে মিলে যায়।
জাভা
privateFeatureLayerareaLevel1Layer; @OverridepublicvoidonMapReady(GoogleMapmap){areaLevel1Layer=map.getFeatureLayer(newFeatureLayerOptions.Builder().featureType(FeatureType.ADMINISTRATIVE_AREA_LEVEL_1).build()); // Apply style factory function to ADMINISTRATIVE_AREA_LEVEL_1 layer.styleAreaLevel1Layer();}
কোটলিন
privatevarareaLevel1Layer:FeatureLayer?=null overridefunonMapReady(googleMap:GoogleMap){// Get the ADMINISTRATIVE_AREA_LEVEL_1 feature layer.areaLevel1Layer=googleMap.getFeatureLayer(FeatureLayerOptions.Builder().featureType(FeatureType.ADMINISTRATIVE_AREA_LEVEL_1).build()) // Apply style factory function to ADMINISTRATIVE_AREA_LEVEL_1 layer.styleAreaLevel1Layer()}
একটি স্টাইল ফ্যাক্টরি ফাংশন তৈরি করুন এবং এটি প্রশাসনিক এলাকা স্তর 1 বৈশিষ্ট্য স্তরে প্রয়োগ করুন৷ নিম্নলিখিত উদাহরণটি মার্কিন যুক্তরাষ্ট্রের প্রতিটি রাজ্যের প্রতিনিধিত্বকারী বহুভুজটিতে ফাংশনটি প্রয়োগ করে।
জাভা
privatevoidstyleAreaLevel1Layer(){FeatureLayer.StyleFactorystyleFactory=(Featurefeature)->{if(featureinstanceofPlaceFeature){PlaceFeatureplaceFeature=(PlaceFeature)feature; // Return a hueColor in the range [-299,299]. If the value is// negative, add 300 to make the value positive.inthueColor=placeFeature.getPlaceId().hashCode()%300;if(hueColor < 0){hueColor+=300;} returnnewFeatureStyle.Builder()// Set the fill color for the state based on the hashed hue color..fillColor(Color.HSVToColor(150,newfloat[]{hueColor,1,1})).build();}returnnull;}; // Apply the style factory function to the feature layer.areaLevel1Layer.setFeatureStyle(styleFactory);}
কোটলিন
privatefunstyleAreaLevel1Layer(){valstyleFactory=FeatureLayer.StyleFactory{feature:Feature->
if(featureisPlaceFeature){valplaceFeature:PlaceFeature=featureasPlaceFeature // Return a hueColor in the range [-299,299]. If the value is// negative, add 300 to make the value positive.varhueColor:Int=placeFeature.getPlaceId().hashCode()%300if(hueColor < 0){hueColor+=300}return@StyleFactoryFeatureStyle.Builder()// Set the fill color for the state based on the hashed hue color..fillColor(Color.HSVToColor(150,floatArrayOf(hueColor.toFloat(),1f,1f))).build()}return@StyleFactorynull} // Apply the style factory function to the feature layer.areaLevel1Layer?.setFeatureStyle(styleFactory)}
[null,null,["2025-08-29 UTC-তে শেষবার আপডেট করা হয়েছে।"],[[["\u003cp\u003eChoropleth maps use color variations to represent data values associated with geographic areas, like shading states based on population.\u003c/p\u003e\n"],["\u003cp\u003eThis guide explains how to create a choropleth map using a style factory function that colors administrative areas based on data ranges.\u003c/p\u003e\n"],["\u003cp\u003eYou'll learn to enable the "Administrative Area Level 1" feature, access this layer, and apply a style factory function to it, demonstrated with code snippets for Android (Java/Kotlin).\u003c/p\u003e\n"],["\u003cp\u003eThe example provided utilizes a hashed value of the place ID to determine the color of each state, although real-world scenarios would likely involve a lookup table for color assignments.\u003c/p\u003e\n"]]],[],null,["# Make a choropleth map\n\nSelect platform: [Android](/maps/documentation/android-sdk/dds-boundaries/choropleth-map \"View this page for the Android platform docs.\") [iOS](/maps/documentation/ios-sdk/dds-boundaries/choropleth-map \"View this page for the iOS platform docs.\") [JavaScript](/maps/documentation/javascript/dds-boundaries/choropleth-map \"View this page for the JavaScript platform docs.\")\n\n\u003cbr /\u003e\n\nA choropleth map is a type of thematic map in which administrative areas are\ncolored or shaded according to a data value. You can use a style factory\nfunction to style a map based on data where each administrative area is\nassociated with a range of numeric values. The following example map shows a\nchoropleth map for the states of the United States.\n\nIn this example, the data consists of the place ID of the state. The style\nfactory function conditionally colors each state based on a hashed value of the\nplace ID for the state.\n\n| **Note:** Typically, you would define a table of the color for each state, and then lookup the color for each state based on the state's place ID.\n\n1. If you haven't already done so, follow the steps in\n [Get Started](/maps/documentation/android/dds-boundaries/start)\n to create a new map ID and map style. Be sure to enable the\n **Administrative Area Level 1** feature layer.\n\n2. Get a reference to the Administrative Area Level 1 feature layer when the\n map initializes. For the United States, these administrative levels\n correspond to the individual states.\n\n ### Java\n\n\n ```java\n private FeatureLayer areaLevel1Layer;\n\n @Override\n public void onMapReady(GoogleMap map) {\n areaLevel1Layer = map.getFeatureLayer(new FeatureLayerOptions.Builder()\n .featureType(FeatureType.ADMINISTRATIVE_AREA_LEVEL_1)\n .build());\n\n // Apply style factory function to ADMINISTRATIVE_AREA_LEVEL_1 layer.\n styleAreaLevel1Layer();\n }\n ```\n\n \u003cbr /\u003e\n\n ### Kotlin\n\n\n ```java\n private var areaLevel1Layer: FeatureLayer? = null\n\n override fun onMapReady(googleMap: GoogleMap) {\n // Get the ADMINISTRATIVE_AREA_LEVEL_1 feature layer.\n areaLevel1Layer = googleMap.getFeatureLayer(FeatureLayerOptions.Builder()\n .featureType(FeatureType.ADMINISTRATIVE_AREA_LEVEL_1)\n .build())\n\n // Apply style factory function to ADMINISTRATIVE_AREA_LEVEL_1 layer.\n styleAreaLevel1Layer()\n }\n ```\n\n \u003cbr /\u003e\n\n3. Create a style factory function and apply it to the\n Administrative Area Level 1 feature layer. The following example applies the\n function to the polygon representing each state of the United States.\n\n ### Java\n\n\n ```java\n private void styleAreaLevel1Layer() {\n FeatureLayer.StyleFactory styleFactory = (Feature feature) -\u003e {\n if (feature instanceof PlaceFeature) {\n PlaceFeature placeFeature = (PlaceFeature) feature;\n\n // Return a hueColor in the range [-299,299]. If the value is\n // negative, add 300 to make the value positive.\n int hueColor = placeFeature.getPlaceId().hashCode() % 300;\n if (hueColor \u003c 0) {\n hueColor += 300;\n }\n\n return new FeatureStyle.Builder()\n // Set the fill color for the state based on the hashed hue color.\n .fillColor(Color.HSVToColor(150, new float[] {hueColor, 1, 1}))\n .build();\n }\n return null;\n };\n\n // Apply the style factory function to the feature layer.\n areaLevel1Layer.setFeatureStyle(styleFactory);\n }\n ```\n\n \u003cbr /\u003e\n\n ### Kotlin\n\n\n ```java\n private fun styleAreaLevel1Layer() {\n val styleFactory = FeatureLayer.StyleFactory { feature: Feature -\u003e\n if (feature is PlaceFeature) {\n val placeFeature: PlaceFeature = feature as PlaceFeature\n\n // Return a hueColor in the range [-299,299]. If the value is\n // negative, add 300 to make the value positive.\n var hueColor: Int = placeFeature.getPlaceId().hashCode() % 300\n if (hueColor \u003c 0) {\n hueColor += 300\n }\n return@StyleFactory FeatureStyle.Builder()\n // Set the fill color for the state based on the hashed hue color.\n .fillColor(Color.HSVToColor(150, floatArrayOf(hueColor.toFloat(), 1f, 1f)))\n .build()\n }\n return@StyleFactory null\n }\n\n // Apply the style factory function to the feature layer.\n areaLevel1Layer?.setFeatureStyle(styleFactory)\n }\n ```\n\n \u003cbr /\u003e"]]