Skip to main content
add python tag
Source Link
ramiroaznar
  • 4.4k
  • 2
  • 15
  • 29

Using CARTOframes to push to CartoCARTO account

I am using CARTOframes to create and style a map that includes widgets. I'm able to push a Dataset to my Carto account and to publish and update a map, however I can't seem to get that published map to appear in my dashboard when I login to Cartodb. The goal is for people on my team to be able to make changes to a map either from a jupyter notebook using something like CARTOframes OR through logging on and using the Builder manually.

I have version 1.0b21.0b2 of CARTOframes installed and here is the code:

    #setting credentials: 
set_default_credentials('https://{}.carto.com/'.format(username), api_key)

Creds = Credentials(username=username, api_key=api_key)

#to turn geopandas geodataframe into a carto Dataset: 

locations_data = Dataset(df)

#to create map

testmap = Map(Layer(locations_data,
          popup=Popup({'hover':[{'title':'service', "value":'$service_name'}]}),
            widgets=[
            default_widget(
                title='NYC Social Services Locations',
                description='Visualization of service sites for city-funded social services.',
                footer='Data source: SSSLD'
            ), 
            formula_widget(
                'count',
                is_global=True,
                footer='sites'
            ), 
            category_widget(
                'org_name',
                title='Provider Organization Name',
                description='Select an org to filter',
            )
            ]
         ) ) 

#to sync data with my account: 

testmap.sync_data('test_data')

#to publish map

testmap.publish('sssld_test_map_jupyter', maps_api_key=api_key, credentials=Creds)

#to update published map:

testmap.update_publication('sssld_test_map_gui', password=None, maps_api_key=api_key)

Using CARTOframes to push to Carto account

I am using CARTOframes to create and style a map that includes widgets. I'm able to push a Dataset to my Carto account and to publish and update a map, however I can't seem to get that published map to appear in my dashboard when I login to Cartodb. The goal is for people on my team to be able to make changes to a map either from a jupyter notebook using something like CARTOframes OR through logging on and using the Builder manually.

I have version 1.0b2 of CARTOframes installed and here is the code:

    #setting credentials: 
set_default_credentials('https://{}.carto.com/'.format(username), api_key)

Creds = Credentials(username=username, api_key=api_key)

#to turn geopandas geodataframe into a carto Dataset: 

locations_data = Dataset(df)

#to create map

testmap = Map(Layer(locations_data,
          popup=Popup({'hover':[{'title':'service', "value":'$service_name'}]}),
            widgets=[
            default_widget(
                title='NYC Social Services Locations',
                description='Visualization of service sites for city-funded social services.',
                footer='Data source: SSSLD'
            ), 
            formula_widget(
                'count',
                is_global=True,
                footer='sites'
            ), 
            category_widget(
                'org_name',
                title='Provider Organization Name',
                description='Select an org to filter',
            )
            ]
         ) ) 

#to sync data with my account: 

testmap.sync_data('test_data')

#to publish map

testmap.publish('sssld_test_map_jupyter', maps_api_key=api_key, credentials=Creds)

#to update published map:

testmap.update_publication('sssld_test_map_gui', password=None, maps_api_key=api_key)

Using CARTOframes to push to CARTO account

I am using CARTOframes to create and style a map that includes widgets. I'm able to push a Dataset to my Carto account and to publish and update a map, however I can't seem to get that published map to appear in my dashboard when I login to Cartodb. The goal is for people on my team to be able to make changes to a map either from a jupyter notebook using something like CARTOframes OR through logging on and using the Builder manually.

I have version 1.0b2 of CARTOframes installed and here is the code:

#setting credentials: 
set_default_credentials('https://{}.carto.com/'.format(username), api_key)

Creds = Credentials(username=username, api_key=api_key)

#to turn geopandas geodataframe into a carto Dataset: 

locations_data = Dataset(df)

#to create map

testmap = Map(Layer(locations_data,
          popup=Popup({'hover':[{'title':'service', "value":'$service_name'}]}),
            widgets=[
            default_widget(
                title='NYC Social Services Locations',
                description='Visualization of service sites for city-funded social services.',
                footer='Data source: SSSLD'
            ), 
            formula_widget(
                'count',
                is_global=True,
                footer='sites'
            ), 
            category_widget(
                'org_name',
                title='Provider Organization Name',
                description='Select an org to filter',
            )
            ]
         ) ) 

#to sync data with my account: 

testmap.sync_data('test_data')

#to publish map

testmap.publish('sssld_test_map_jupyter', maps_api_key=api_key, credentials=Creds)

#to update published map:

testmap.update_publication('sssld_test_map_gui', password=None, maps_api_key=api_key)
formatting
Source Link
Vince
  • 20.3k
  • 16
  • 48
  • 65
    #setting credentials: 
set_default_credentials('https://{}.carto.com/'.format(username), api_key)

Creds = Credentials(username=username, api_key=api_key)

#to turn geopandas geodataframe into a carto Dataset: 

locations_data = Dataset(df)

#to create map

testmap = Map(Layer(locations_data,
          popup=Popup({'hover':[{'title':'service', "value":'$service_name'}]}),
            widgets=[
            default_widget(
                title='NYC Social Services Locations',
                description='Visualization of service sites for city-funded social services.',
                footer='Data source: SSSLD'
            ), 
            formula_widget(
                'count',
                is_global=True,
                footer='sites'
            ), 
            category_widget(
                'org_name',
                title='Provider Organization Name',
                description='Select an org to filter',
            )
            ]
         ) ) 

#to sync data with my account: 

testmap.sync_data('test_data')

#to publish map

testmap.publish('sssld_test_map_jupyter', maps_api_key=api_key, credentials=Creds)

#to update published map:

testmap.update_publication('sssld_test_map_gui', password=None, maps_api_key=api_key)

set_default_credentials('https://{}.carto.com/'.format(username), api_key)

Creds = Credentials(username=username, api_key=api_key)

#to turn geopandas geodataframe into a carto Dataset:

locations_data = Dataset(df)

#to create map

testmap = Map(Layer(locations_data, popup=Popup({'hover':[{'title':'service', "value":'$service_name'}]}), widgets=[ default_widget( title='NYC Social Services Locations', description='Visualization of service sites for city-funded social services.', footer='Data source: SSSLD' ), formula_widget( 'count', is_global=True, footer='sites' ), category_widget( 'org_name', title='Provider Organization Name', description='Select an org to filter', ) ] ) )

#to sync data with my account:

testmap.sync_data('test_data')

#to publish map

testmap.publish('sssld_test_map_jupyter', maps_api_key=api_key, credentials=Creds)

#to update published map:

testmap.update_publication('sssld_test_map_gui', password=None, maps_api_key=api_key)

#setting credentials: 

set_default_credentials('https://{}.carto.com/'.format(username), api_key)

Creds = Credentials(username=username, api_key=api_key)

#to turn geopandas geodataframe into a carto Dataset:

locations_data = Dataset(df)

#to create map

testmap = Map(Layer(locations_data, popup=Popup({'hover':[{'title':'service', "value":'$service_name'}]}), widgets=[ default_widget( title='NYC Social Services Locations', description='Visualization of service sites for city-funded social services.', footer='Data source: SSSLD' ), formula_widget( 'count', is_global=True, footer='sites' ), category_widget( 'org_name', title='Provider Organization Name', description='Select an org to filter', ) ] ) )

#to sync data with my account:

testmap.sync_data('test_data')

#to publish map

testmap.publish('sssld_test_map_jupyter', maps_api_key=api_key, credentials=Creds)

#to update published map:

testmap.update_publication('sssld_test_map_gui', password=None, maps_api_key=api_key)

    #setting credentials: 
set_default_credentials('https://{}.carto.com/'.format(username), api_key)

Creds = Credentials(username=username, api_key=api_key)

#to turn geopandas geodataframe into a carto Dataset: 

locations_data = Dataset(df)

#to create map

testmap = Map(Layer(locations_data,
          popup=Popup({'hover':[{'title':'service', "value":'$service_name'}]}),
            widgets=[
            default_widget(
                title='NYC Social Services Locations',
                description='Visualization of service sites for city-funded social services.',
                footer='Data source: SSSLD'
            ), 
            formula_widget(
                'count',
                is_global=True,
                footer='sites'
            ), 
            category_widget(
                'org_name',
                title='Provider Organization Name',
                description='Select an org to filter',
            )
            ]
         ) ) 

#to sync data with my account: 

testmap.sync_data('test_data')

#to publish map

testmap.publish('sssld_test_map_jupyter', maps_api_key=api_key, credentials=Creds)

#to update published map:

testmap.update_publication('sssld_test_map_gui', password=None, maps_api_key=api_key)
Source Link

Using CARTOframes to push to Carto account

I am using CARTOframes to create and style a map that includes widgets. I'm able to push a Dataset to my Carto account and to publish and update a map, however I can't seem to get that published map to appear in my dashboard when I login to Cartodb. The goal is for people on my team to be able to make changes to a map either from a jupyter notebook using something like CARTOframes OR through logging on and using the Builder manually.

I have version 1.0b2 of CARTOframes installed and here is the code:

#setting credentials: 

set_default_credentials('https://{}.carto.com/'.format(username), api_key)

Creds = Credentials(username=username, api_key=api_key)

#to turn geopandas geodataframe into a carto Dataset:

locations_data = Dataset(df)

#to create map

testmap = Map(Layer(locations_data, popup=Popup({'hover':[{'title':'service', "value":'$service_name'}]}), widgets=[ default_widget( title='NYC Social Services Locations', description='Visualization of service sites for city-funded social services.', footer='Data source: SSSLD' ), formula_widget( 'count', is_global=True, footer='sites' ), category_widget( 'org_name', title='Provider Organization Name', description='Select an org to filter', ) ] ) )

#to sync data with my account:

testmap.sync_data('test_data')

#to publish map

testmap.publish('sssld_test_map_jupyter', maps_api_key=api_key, credentials=Creds)

#to update published map:

testmap.update_publication('sssld_test_map_gui', password=None, maps_api_key=api_key)