WordPress.org

Forums

Intergeo Maps
[resolved] Overlay API? (8 posts)

  1. Pat Garner
    Member
    Posted 1 year ago #

    Are the coordinates of each rectangle that I create in the overlay stored in the database or are they stored as JSON in a file on the filesystem? I would like to edit the database (or JSON) to edit the latitude and longitude coordinates of each rectangle that I created in the overlay.

    http://wordpress.org/plugins/intergeo-maps/

  2. madpixels
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Pat!

    They are stored in database. The plugin uses custom post type to store all maps. All settings are stored in a post body as json. You can override it manually or you can apply your own hook to filter map options.

    Use hook attribute in the shortcode like this:

    [intergeo hook="my_custom_intergeo_hook"]...[/intergeo]

    Then in your plugin or theme you can do like this:

    add_filter( 'my_custom_intergeo_hook', 'my_intergeo_filter' );
    function my_intergeo_filter( $options ) {
        // edit option
        ...
    
        // return updated options
        return $options;
    }
  3. Pat Garner
    Member
    Posted 1 year ago #

    The filter you've displayed looks interesting, although I haven't a clue of what the API is for the options in JavaScript. Where might I find documentation on this? Or even an example of a single rectangle polyline would be great using the following data, which I created in KML (I'm familiar with KML, not the new JavaScript API):

    <Placemark>
        <name>Centre = 29.590569,-82.238584</name>
        <LineString>
            <extrude>0</extrude>
            <tessellate>1</tessellate>
            <altitudeMode>clampToGround</altitudeMode>
            <coordinates> -82.238787,29.590794,0.000000 -82.238787,29.590344,0.000000 -82.238382,29.590344,0.000000 -82.238382,29.590794,0.000000 -82.238787,29.590794,0.000000</coordinates>
        </LineString>
    </Placemark>

    Also, on the database side I'd like to learn how to edit the coordinates of the polylines I've created using Intergeo. I searched for the Intergeo map data in the database. I assumed there would be one table for maps, one for polylines, one for polygons, etc. However, I could not find any such tables or data. Here are the tables in my WP installation:

    refererstat
    viewstat
    wp_bad_behavior
    wp_commentmeta
    wp_comments
    wp_contact_form_7
    wp_events
    wp_events_categories
    wp_frm_fields              <-- Formidable Pro plugin
    wp_frm_forms
    wp_frm_items
    wp_frm_item_metas
    wp_links
    wp_ngg_album               <-- NGG Image Gallery plugin
    wp_ngg_gallery
    wp_ngg_pictures
    wp_options
    wp_postmeta
    wp_posts
    wp_terms
    wp_term_relationships
    wp_term_taxonomy
    wp_usermeta
    wp_users

    Perusing the above tables in my schema, I searched for Intergeo overlay data but couldn't find it anywhere. I did see a few entries in wp_options, but these clearly are for Intergeo settings, not any specific map I've created, e.g. here are a few option_names

    intergeo_messages
    intergeo_show_map_center
    intergeo_map_api_key
    intergeo_adsense_publisher_id
    intergeo-settings-map-api-key

    I presume that I should be able to find the coordinates of the polylines I've created using Intergeo's overlay/polyline drawing tool in one of the database tables, yes? I need to edit such coordinates and adjust them a little bit in order to get them to line up exactly with coordinates that were generated by a GPS unit in the field.

  4. Pat Garner
    Member
    Posted 1 year ago #

    I should have read your response a little more closely. As you said, it's post data and I found it in wp_posts, stored as json. So the database portion of my question is answered. Awesome!

    So how would I embed the following json using an Intergeo hook:

    {"lat": 29.5912749982, "lng": -82.2380460874, "zoom": 18, "map": {
        "mapTypeId": "HYBRID"
    }, "container": {
        "width": "480px",
        "height": "480px"
    }, "overlays": {
        "rectangle": [
            {
                "path": [
                    ["29.592136", "-82.238889"],
                    ["29.592542", "-82.238427"]
                ],
                "position": "CENTER",
                "weight": 2,
                "stroke_opacity": "",
                "stroke_color": "#000000",
                "fill_opacity": 0.2,
                "fill_color": "#dd3333"
            }
        ]
    }}
  5. madpixels
    Member
    Plugin Author

    Posted 1 year ago #

    Do you know PHP? If you don't it will be better right now to edit database record.

    All shapes are stored in overlays array. As you can see in the json above there is array of rectangles. To enter your coordinates, just edit path array. It contains two subarrays: ["29.592136", "-82.238889"] and ["29.592542", "-82.238427"]. It is two points of your rectangle. Enter your coordinates, and the rectangle will be updated.

    Try to play with it and you will see what you need to change.

  6. Pat Garner
    Member
    Posted 1 year ago #

    Yes, I am familiar with json and can edit the database files -- no problem -- which is excellent because it becomes possible to set up a map, sketch rectangles via Intergeo and then edit the coordinates of each rectangle via the database to match GPS readings we are making in the field so that the rectangles are accurately positioned on the map.

    In this project a use case requires a user to change the rectangle's fill color via form submission at runtime. I was thinking it might be possible to do so via the Intergeo hook by grabbing the new fill color data from the database using something like a Formidable Pro tag but now I am beginning to realize that doing so is beyond the scope of the Intergeo hook (let me know if I'm wrong!).

    I don't know PHP, I've done little side projects with it in the late 1990s. I've made several websites using WordPress over the past few years, which required some editing of PHP files and CSS and such. My first exposure to Google Maps began yesterday, when I learned how to use KML to generate the rectangles. Today, I perused the Google Maps v.3 JavaScript API, which seems pretty straightforward, and I learned to implement my map using JavaScript + HTML. My expertise is in enterprise middleware (JEE), which does provide json hooks. I could implement an amazingly awesome interactive and dynamic application but building and hosting such an application is beyond the budget of my client -- a small nonprofit organization. So I am probably capable of making changes to the plugin and my WordPress installation to implement the use case but the budget is a constraint.

    As I have searched for WordPress map plugins I have noticed that while many plugins provided the means to dynamically add location markers few provided the means to create overlays and to my knowledge none provided the means to edit rectangle fill colors in real time (please correct me if I'm wrong!).

    For this project the rectangles, once set up, don't need the fill colors to be changed often -- perhaps two rectangles per month -- so it would be feasible to provide a solution using WP + Intergeo and manually editing the fill_color attributes in the database when necessary. Although not elegant this would get the job done within budget.

    Thanks for your help!

  7. madpixels
    Member
    Plugin Author

    Posted 1 year ago #

    It is possible to develop an ability to change fill color from front end. All you need is just to process color submission and update appropriate database record. However it require PHP knowledge. I would like to recommend you to hire a freelancer (elance/odesk/etc) to do this job.

    Any way if you need any further help then ask me, otherwise, please, mark this thread as resolved (if you think so).

  8. Pat Garner
    Member
    Posted 1 year ago #

    I will look into your suggestions. Thanks!

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Intergeo Maps
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags