Skip to content
  • ZipCode Api
  • Blog
  • About RedLine13
RedLine13
RedLine13
Primary Navigation Menu
Menu
  • Start Testing
  • Demo
  • Pricing
  • JMeter
  • Partners
  • Docs
    • Documentation Home
    • AWS Set Up for load testing
    • AWS Approval for Large Tests
    • PHP, NodeJS, Python Load Tests
    • Scalability
    • Jenkins Plugin Setup
    • Premium Features
    • Knowledge Base

Lat/Long SQL Where Clause for Your Database

By: Rich Friedman

Polygon Approximation of a CircleWe have added an interesting extension to our Zipcode API. This is for applications that have their own database of latitude and longitude positions, but need to calculate items within a certain radius of another latitude/longitude.

You can try it here – https://www.zipcodeapi.com/API#radiusSql. Hint – use the Zipcode to Location API to find your specific Lat/Long.

You specify the latitude and longitude of a center point, the distance/radius from this location, the field names used in your database for latitude and longitude, and a precision. The higher the precision, the more detailed the SQL string will be and the more accurate the results will be. A precision of 2 gives decent results for short distances. Larger distances might require a higher precision. To make your database queries efficient, you should create an index on the latitude/longitude pair in your database.

For example, a precision of 1 in the Zipcode API Live Documentation is done with this setup:

Zipcode API Lat/Long Setup

 

will yield an SQL clause like this:

SQL for Lat/Long Polygon

 

While a precision of 4 would yield:

Lat/Long Polygon

 

Obviously, the higher the precision, the more points on your polygon and the closer approximation to ta true circle and radius.

polygon edges accuracy

 

2013-09-09
Previous Post: Load Testing Graphic Reporting Performance Improvements
Next Post: EU Servers Added for Load Testing

Recent Posts

  • JMeter XML Format Post Processor
  • Order of Elements in JMeter
  • The JMeter Synthesis Report
  • Using the JMeter Plugins Manager
  • JMeter Rotating JTL Listener

Related

  • JMeter XML Format Post Processor
  • Order of Elements in JMeter
  • The JMeter Synthesis Report
  • Using the JMeter Plugins Manager
  • JMeter Rotating JTL Listener
  • Using Test Fragments in JMeter Tests
  • Step-by-Step Guide to Testing with JMeter
  • Functional Testing vs Performance Testing
  • A Gentle Introduction to Load Testing
  • Using the JMeter Counter Element

© RedLine13, LLC | Privacy Policy | Contract
Contact Us: info@redline13.com

Designed using Responsive Brix. Powered by WordPress.