Hello,
I'm new has developer in esri products.
I'm having trouble with this method. I'm trying to create a chorolopeth map using esriClassifyNaturalBreaks, but the API reference doesn't mention any argument for the number of breaks, i found it in a video for other method (sdf.spatial.plot), the argument is "class_count=", and it works, i don't know why it is not in the documentation. But surprisenly the argument "method = ", does not work at all. No matter the value used it creates the same renderer. Am i doing something wrong here?
renderer_classed = arcgis.mapping.renderer.generate_renderer(geometry_type = 'Polygon',
sdf_or_series = sdf,
render_type ='c',
colors = 'Reds',
method = 'esriClassifyNaturalBreaks',
field = 'media_10',
class_count = 5)
Which is the best way to create a renderer in python arcgis API?
Thanks
Just for update this topic:
When using sdf.spatial.plot() i get the same result. Any method, same renderer...
sdf.spatial.plot(kind ='map',
map_widget = mapa1,
renderer_type = 'c',
method = 'esriClassifyNaturalBreaks',
col = 'media_10',
class_count = 5,
cmap = 'Reds',
outline_color = [0,0,0,150],
line_width = 0.5)
It always retrieve equal intervals...
And additionaly, the very sample code from esri doesn't work has it should be:
https://developers.arcgis.com/python/guide/visualizing-data-with-the-spatially-enabled-dataframe/
If you try m4 sample code, you will realise that this method doesn't work at all:
df.spatial.plot(map_widget=m4, renderer_type='c', # for class breaks renderer method='esriClassifyNaturalBreaks', # classification algorithm class_count=20, # choose the number of classes col='POPULATION', # numeric column to classify cmap='prism', # color map to pick colors from for each class alpha=0.7 # specify opacity )
You can change to any method here (e.g., esriClassifyQuantile), and you will always get equal intervals breaks.
Now, the most strange thing is that to very sample code shows that there's no esriClassifyNaturalBreaks hapening there, has they show in the sample script, it is equal intervals....
cbs_list = []
cmap_list = []
for cb in class_breaks:
print(cb.description) # print the class break labels
cbs_list.append(cb.classMaxValue)
cmap_list.append([x/255.0 for x in cb.symbol.color])
7957.0 - 11659.315789473683 11659.315789473683 - 15361.631578947368 15361.631578947368 - 19063.947368421053 19063.947368421053 - 22766.263157894737 22766.263157894737 - 26468.57894736842 26468.57894736842 - 30170.894736842107 30170.894736842107 - 33873.21052631579 33873.21052631579 - 37575.52631578947 37575.52631578947 - 41277.84210526316 41277.84210526316 - 44980.15789473684 44980.15789473684 - 48682.47368421053 48682.47368421053 - 52384.78947368421 52384.78947368421 - 56087.10526315789 56087.10526315789 - 59789.42105263158 59789.42105263158 - 63491.73684210526 63491.73684210526 - 67194.05263157895 67194.05263157895 - 70896.36842105264 70896.36842105264 - 74598.68421052632 74598.68421052632 - 78301.0 78301.0 - 78301.0
Now the question is, has someone had success using this Python API for choropleth maps with these methods? Please, show me how.
method Determines the classification method that was used to generate class breaks. Must be one of the following values: + esriClassifyDefinedInterval + esriClassifyEqualInterval + esriClassifyGeometricalInterval + esriClassifyNaturalBreaks + esriClassifyQuantile + esriClassifyStandardDeviation + esriClassifyManual