WherePress

GIS for WordPress and MySQL

  • Home
  • Projects and Plugins
    • WP-GeoMeta
    • WP-GeoMeta-Lib
    • GeoMeta for ACF
    • SavvyMapper
    • WP Spatial Capabilities Check
  • Contact
  • About
  • test
  • Pond Test

GeoJSON Imports, Status of WP-GeoMeta, Presentation at FOSS4G

August 1, 2017 by Michael Moore

I’m excited to announce the release of WP-GeoMeta 0.3.4 today with GeoJSON importing!

The import functionality is pretty straightforward and should cover the most common import use cases. With it you can create new Posts or Users or update existing Posts or Users.

For updates you can select a JSON property and a Post (or User) field, and any existing Posts with that property value will be updated instead of duplicates being created.

You can also choose to ignore GeoJSON features that aren’t found, so that you don’t create new posts (or Users) but only update existing ones.

If your import needs are more complex, or you want to add spatial data to Taxonomies or Comments, you’ll still need to script that yourself, but hopefully this import tool will cover most of your bases.

The Status of WP-GeoMeta

I know it’s been a while since I posted. I’m not a terrific blogger and I’m not ready to promise to change. WP-

GeoMeta and related WordPress spatial projects continue to move forward though, mostly based on clients needs. The idea of using WordPress for spatial work seems to be growing. WP-GeoMeta has been downloaded over 300 times, and I promise I only represent about 30 of those.

I’ve also been contacted by people from around the globe asking for help and pointers — I haven’t been able to help everyone, but I’d done what I can and will continue to add additional documentation as I can and as requested.

I have started formulating plans for a mapping plugin which will take advantage of spatial meta data. I’m still taking another look at existing WP plugins to see if there isn’t one that I can integrate with instead of starting another one, but it’s not promising so far.

FOSS4G

Finally, I’m excited to say that I’ll be speaking about WordPress and GIS at FOSS4G in Boston this year!

My talk is titled Spatially enable WordPress with WP-GeoMeta-Lib and is scheduled for 5PM on Wednesday the 16th in Waterfront 1C.

Here’s my abstract:

WordPress is an open-source Content Management System (CMS) written in PHP and MySQL. It runs over 25%* of websites and lacks real spatial support. There are WordPress plugins that offer simple mapping but GIS has so much more to offer!

The core problem is that the WordPress API stores metadata in text fields, which are unsuitable for use with MySQL’s spatial functions. To use spatial data types developers must handle table, index, and query creation themselves and work outside of the WordPress API. Plugin developers tend to prefer using the API, though it limits what they can do with their data spatially.

WP-GeoMeta-Lib solves this issue by providing WordPress developers with API access to all spatial functionality that MySQL supports. WP-GeoMeta-Lib is a PHP library which uses the WordPress API to transparently intercept queries containing spatial metadata or spatial functions. It redirects those queries to custom metadata tables with spatial columns and indexes. Developers can now use the WordPress API to provide actual spatial functionality to their users.

WP-GeoMeta-Lib can easily be used to develop new plugins to collect, query, and analyze spatial data. I’ve even used it to turn WordPress into a WFS (Web Feature Service) server!

This presentation will show how WP-GeoMeta-Lib works, discuss why it is important for WordPress, and demonstrate some example plugins that use it.

WP-GeoMeta-Lib gives GIS tools to a quarter of the Internet, in software people are already using. Come get inspired by WP-GeoMeta-Lib and see what it can do for you!

If you’re going to be at FOSS4G, let’s chat! I’d love to meet some more WordPress GIS users!

Filed Under: Uncategorized Tagged With: geojson, wp-geometa

Announcing GeoMeta for ACF

December 19, 2016 by Michael Moore Leave a Comment

I’m happy to announce that GeoMeta for ACF is now available in the WordPress plugin directory.

GeoMeta for ACF is a very easy way for editors and admins to add spatial data to posts, pages, taxonomies, users or anything else that Advanced Custom Fields supports.

Simply add a GeoMeta field to your Field Group, then draw the geometry you want to use for that post. You can use the usual ACF settings so that a GeoMeta field only shows up on certain post types or other conditions.

 

All data stored with GeoMeta for ACF can be queried with spatial queries since it uses WP-GeoMeta-Lib under the hood.

Store campground locations and then search for the campground that’s closest to a given city. Find out which precinct a user lives in. Mark all the locations you blog from and then show them on a map.

There’s a ton you can do with spatial data once you’ve captured it. GeoMeta for ACF is so easy that anyone can use it.

Go Download It Today!

Filed Under: Uncategorized

A New WP-GeoMeta Release for PostGIS Day

November 16, 2016 by Michael Moore Leave a Comment

Yesterday was GIS Day, according to Esri, which makes today PostGIS day! To celebrate the two special days it seemed  appropriate to release a new version of WP-GeoMeta. The main new feature of WP-GeoMeta version 0.2.2 is support for separate latitude and longitude meta fields.

When plugin developers want to implement location information they tend to implement it with separate latitude and longitude fields. If they do any spatial searching it’s using trigonometry functions and custom queries.

Convert latitude and longitude to geometryWordPress itself supports method of storing spatial points, it’s the WordPress Geodata standard, with key names geo_latitude and geo_longitude.

Starting with version 0.2.2 WP-GeoMeta supports the WordPress Geodata standard out of the box, and additional key name pairs can be added as simply as calling:

    // WP_GeoMeta::add_latlng_field( <latitude field name>, <longitude field name>, <spatial meta_key name> );
    WP_GeoMeta::add_latlng_field( 'myplugin_lat', 'myplugin_lng', 'myplugin_geo' );

A few new hooks were added in this release as well. Documentation for WP_GeoMeta::add_latlng_field and the new hooks can be found on on GitHub.

As always, WP-GeoMeta can be downloaded from the WordPress Plugin Directory or from GitHub.

Filed Under: Uncategorized

MySQL Stored Geo Functions

July 5, 2016 by Michael Moore Leave a Comment

As part of writing a demo of WP-GeoMeta I needed to be able to buffer points by X meters, while the points were stored as Lat,Long coordinates. It’s been a while since I dusted off the trigonometry, but luckily Movable-Type.co.uk had several examples of the math I’d need in JavaScript which I was able to adapt to MySQL stored functions.

The result is MySQL Stored Geo Functions, a small collection of MySQL stored function definitions for working with Lat,Long coordinates.

Currently there are three available operations:

  • Buffering a point (by meters or miles)
  • Calculating distance between two points (the Haversine function)
  • Creating a line given a point, bearing and distance (in meters or miles)

Screenshot

Here’s a sample buffering result. The point in red has been buffered by 30 miles, producing a polygon with 8 points.

The generated polygon is also used in a query with a WHERE ST_INTERSECTS(polygon, point_geom) since MySQL doesn’t have ST_DWITHIN. The Marker is the result of the query.

 

8 Point buffer
8 Point buffer

 

Contributions Welcome

If you’ve got MySQL spatial functions that you’d like to share, please submit a pull request! I’ll also continue to add any useful new functions I write.

Filed Under: Uncategorized

WP Spatial Capabilities Check Released

June 7, 2016 by Michael Moore Leave a Comment

Update: It’s now in the plugin directory

The plugin is now in the WordPress plugin directory. You can get it here, or install from within WordPress the usual way.

 

As I’ve started working on a couple of small spatial projects, I’ve realized that I needed a quick and easy way to see if I could do what I needed to on the current host.

Today I prettied up the code that I’d been using and made it into a plugin so that anyone can quickly see what GIS functions their database has available.

I’ve submitted the plugin to the WordPress repository, but for now you can get it on GitHub.

WP Spatial Capabilities Check
WP Spatial Capabilities Check

If you have a GIS plugin for WordPress that you’d like me to review, contact me and let me know. I have several in the queue, but I’m always interested in hearing about good stuff that’s happening.

Filed Under: Uncategorized Tagged With: GIS, plugin, WordPress

Copyright © 2019 · Cimbura.com · Log in