Пример #1
0
def main():
    api = MapFigApplication(studioURL="https://studio.mapfig.com", apiKey="Za40iR62wtzc8HWs4TgJhNSI8_wRcqMa")

    try:
        map = api.get(555)  # Tested on ID 508
        print map.getWholeDataArray()

    except Exception as ex:
        print ex.message
def main():
    api = MapFigApplication(studioURL="https://studio.mapfig.com", apiKey="Za40iR62wtzc8HWs4TgJhNSI8_wRcqMa")

    try:
        map = api.get(555)
        map.setLayerId(1)  # Default 1 or change it to the account owner's layer ID
        map.setGroupId(0)  # Default 0 or change it to the account owner's layer group ID
        map.setPassword("")  # Default NONE or change it to the Desire Password to protact the Map
        map.setUseCluster(True)  # Default False
        map.setOverlayEnable(True)  # Default False
        map.setOverlayTitle("Updated Overlay Title")  # Default NONE
        map.setOverlayContent("Updated Overlay Content")  # Default NONE
        map.setOverlayBlurb("Example Blurb")  # Default NONE
        map.setLegendEnable(False)  # Default False
        map.setLegendContent("HTML content here")  # Default NONE
        map.setProjectId(0)	 # Default 0 or change it to the account owner's project ID
        map.setShowSidebar(True)  # Default True
        map.setShowExport(True)  # Default False
        map.setShowMeasure(True)  # Default False
        map.setShowMinimap(True)  # Default False
        map.setShowSearch(True)  # Default False
        map.setShowFilelayer(False)  # Default False # shows local file upload button
        map.setShowSvg(False)  # Default False
        map.setShowStaticSidebar(False)  # Default False
        map.setStaticSidebarContent("")  # Default NONE

        # Add Image Overlay
        name = "Overlay Title goes here"  # will not be displayed
        
        upperRightCornor = Point(0.0, 0.0)  # Upper Right Cornor Of Overlay Image
        upperRightCornor.setLatLng("Canada")
        
        bottomLeftCornor = Point(0.0, 0.0)  # Bottom Left Cornor Of image
        bottomLeftCornor.setLatLng("United State Of America")
        
        imageUrl = "http: #www.YOUR_IMAGE_URL.com/PATH.PNG"
        popupContent = "<h3>Image Overlay Content here<h3>"
        
        imageOverlay1 = ImageOverlay(name, upperRightCornor, bottomLeftCornor, imageUrl, popupContent)  # Create the overlay
        map.addImageOverlay(imageOverlay1)  # Add as many overlays as you want

        marker = Marker(48.856614, 2.3522219000000177)  # One Way - provide Latitude/Longitude directly

        # Properties
        marker.setLocation("New York")
        marker.setDescription("<p>This is where you can write the <strong>HTML</strong> code too</p>")

        # Advance Properties
        marker.setShowGetDirection(False)
        marker.setShowInfoBox(True)
        marker.setShowLocationOnPopup(True)
        marker.setHideLabel(True)

        # Styling
        marker.setMarkerStyle("")  # Default NONE, available options are (user,cog,leaf,home,.....)
                                   # Complete list can be found here http: #fortawesome.github.io/Font-Awesome/icons/
        marker.setMarkerColor("")  # Default NONE, available options are
                                   # (Red,Blue,Green,Purple,Orange,Darkred,Lightred,Beige,Darkblue,Darkpurple,White,
                                   #  Pink,Lightblue,Lightgreen,Gray,Black,cadetblue,Brown,Lightgray)
        map.addShape(marker)

        try:
            response = api.update(map)
            print response.text

            json_obj = response.json()
            print json_obj

        except Exception as ex:
            print ex.message

    except Exception as ex:
        print ex.message