FAQ Database Discussion Community


How to add Hawaii and Alaska to spatial polygons in R?

r,maps,gis,maptools,sp
How can I add Hawaii and Alaska to the following code (taken from Josh O'Brien's answer here: Latitude Longitude Coordinates to State Code in R)? library(sp) library(maps) library(maptools) # The single argument to this function, pointsDF, is a data.frame in which: # - column 1 contains the longitude in degrees...

Adding geoJSON feature attribues to mapbox popup

javascript,gis,leaflet,mapbox,geojson
I am looking to add a popup with geoJSON attributes to each book store marker on my map. I have used "layer.feature.properties.name" within the marker.bindpopup method, but am getting a return of "undefined". L.mapbox.accessToken = 'jk.eyJ1IjsdkjfhskjdfhksdskdjflWNCJ9.Ov2O5PtskdljfsdR0lq3Q'; var map = L.mapbox.map('map', 'example.kks3kec4') .setView([38.633, -90.319],12); //add cafe, books store, and university geoJSON...

What is wrong with this ST_CONTAINS statement PostGIS - Find point in polygon

sql,ruby,gis,postgis
I'm trying the following: Event.where('ST_Contains(?,ST_SetSRID(location, 4326)::geography)', search_polygon::geography) add getting the error *** NoMethodError Exception: undefined method `geography' for but without that (::geography) I get a message telling me to cast, what do I do? HINT: No function matches the given name and argument types. You might need to add explicit...

Which web mapping site can easily do location or direction searches by bookmark?

google-maps,google-chrome,user-interface,gis
Until a couple of days ago, one of my favorite Google Maps bookmarks had been the following (set up as a Chrome search engine with the keyword gm): https://maps.google.com/maps?output=classic&q=%s. This let me quickly display a map of a location or set of directions without having to fuss around with buttons...

Retrieve all latitude longitude points within x distance given an area

location,gis,latitude-longitude,postgis,geo
Given an area defined by x amount of points, I'd like to split that area in to 3 mile blocks and retrieve the center latitude longitude from each block. Here's what I mean: Area covering London: Area split in to 3 mile blocks (not perfect): And then print out the...

Openlayers 3.5 and GeoJSON

gis,geojson,openlayers-3
I'm having a problem with OpenLayers 3.5. I'm trying to use the one-off loading strategy to grab features from a GeoJSON file. I'm adding a new layer to an already instantiated map. My code looks like this: var vectorSource = new ol.source.Vector({ url: layerInfo.url, format: new ol.format.GeoJSON() }); var pointsLayer...

Error: isTRUE(gpclibPermitStatus()) is not TRUE

r,gis,choropleth
This question may be a duplicate of an earlier unanswered one. I still have the problem. I am trying to use a zipcode shapefile and coming up with the following error: tract <- readOGR(dsn = ".", layer = "cb_2013_us_zcta510_500k") tract<-fortify(tract, region="GEOID10") Error: isTRUE(gpclibPermitStatus()) is not TRUE I have tried installing...

Display Data on Leaflet exclusively with Data from PostGIS

gis,leaflet,postgis
First of all let me say what this post is not all about. Am not asking about how to use PostGIS and Leaflet. I have that resolved in this post. What I am asking is a bit extension of the linked post. In the linked post when I show a...

Writing lat/long geometries to a feature class field

python,gis,arcpy
I have a point feature class with over 80 million features that need to have fields added to include both the lat/long coordinates in two different fields. While it is easy to calculate this in ArcMap, I need to write a script that will write both to the table then...

Remove legend on leaflet map

javascript,gis,leaflet
I have a leaflet map set to change styles based on a category when a user clicks a button. Live map: http://maneesha.github.io/test_map.html Source code: https://github.com/maneesha/maneesha.github.io There is a legend for each style. My problem is I can't get the old legend to disappear when another button is clicked (or that...

Plotting markers using leaflet and rCharts from a data frame with lat and lon values

r,gis,leaflet,rcharts
I am trying to learn the Leaflet functionality with rCharts and would like to plot multiple markers and popups garnered from a data.frame object in R df <- data.frame(location = c("White House", "Impound Lot", "Bush Garden", "Rayburn", "Robertson House", "Beers Elementary"), latitude = c(38.89710, 38.81289, 38.94178, 38.8867787, 38.9053894, 38.86466), longitude...

OpenLayers - Get Geometry Projection

javascript,openlayers,gis,map-projections
How can I get projection of a point or geometry in openlayers (2.12)? for example: x = 30.453789 , y = 35.637485 ==> EPSG:4326 and x = 3667550.3453 , y = 2205578.3453 ==> EPSG:900913 appreciate any help...

How to convert GTFS formatted data for plotting in R?

r,dictionary,gis,leaflet,gtfs
I would like to create an interactive map showing the public transport lines of a city. I am trying to do this using Leaflet in R (but I'm open to alternatives, suggestions?) Data: The data of the transport system is in GTFS format, organized in text files (.txt), which I...

I got points on a map. And lines connecting those points. How do I get all independent inner polygons that are formed?

c#,gis
The linked picture describes the problem. http://i.imgur.com/0LdA3ji.jpg I'm supposing I need a tree search algorithm that enumarates all the points and connecting lines in a tree structure and then searches for cycles. But this job is kinda over my head. Any helpful links are much appriciated. (I dont even know...

Separate forward and backward relation in overpass-api

gis,openstreetmap,overpass-api
I need to get from overpass-api all the data about one, specific public transport line. Let's say it has a number 148 in my city. I use something like this example below but this gives me combined ways of forward and backward routes. How can I get them separately? <osm-script...

Custom SQL for Geodjango on ForignKey

django,django-models,gis,postgis,geodjango
I have a following model: class UserProfile(models.Model): user = models.OneToOneField(User) location = models.PointField(blank=True, null=True, srid=CONSTANTS.SRID) objects = models.GeoManager() class Item(models.Model): owner = models.ForeignKey(UserProfile) objects = models.GeoManager() Now I need to sort the Items by distance to some point: p = Point(12.5807203, 50.1250706) Item.objects.all().distance(p, field='owner__location') But that throws me an error:...

How to update/overwrite map and legend content using d3

javascript,svg,d3.js,gis
I've put together a choropleth map using d3, helped by examples written by Mike Bostock. I'm new to d3 (and HTML, JavaScript, CSS to be honest). I've got as far as creating the map and the legend, and being able to switch between different data sets. The map and source...

Representing a map and running A* on it

java,algorithm,gis,dijkstra,a-star
My question is mainly about map representation and I would like your opinions. Having a map represented by a bunch of roads and a connection between them - let's say road A is connected to B,C,D on one edge but there are only turns possible from A to C and...

Is there a way to make a Point feature show as text?

javascript,gis,openlayers-3
In Leaflet there is an option for icons to be div's instead of images. Which meant you could make a marker which is just text, essentially a label which could be moved by the user. Which is what I am trying to reproduce using OL3 with no success. Is there...

Error while loading raster data in netlogo

gis,netlogo
I am unable to load raster image into netlogo. Following is the code i have used: extensions [ gis ] globals [ raster-dataset ] to setup set raster-dataset gis:load-dataset "D:/SUKHJIT PROJECT/1979sup2.asc" end The error message displayed: Extension exception: only GEOGCS and PROJCS are supported error while observer running GIS:LOAD-DATASET called...

Retrieve indexes of min and max values in np.ndarray

python,numpy,gis
i am working on some tif files and i have to plot dependecies between temperature and vegatation index based on .tif file. It was just FYI. Now my programming problem. I'm using python 2.7 (x64). I have big ndarray form NumPy lib, contains values of temerature and second (same size)...

In leaflet/mapbox, why can't I set the duration of `map.fitBounds`?

gis,leaflet,mapbox
I tried this: map.fitBounds(L.polyline([L.latLng(40,9), L.latLng(1,2)]).getBounds(), { padding: [50, 50], maxZoom: 17, animate: true, duration: 10 }); I expect the animation to take 10 seconds to complete, but it completes very fast.. Does anyone have ideas about how to make the duration longer for fitBounds?...

Installing the Python geojson module on Mac OS X Yosemite to use with QGIS

python,gis,qgis
I am new to using QGIS so this question might be real easy but I just can't find the answer anywhere online. I need to use the module geojson in QGIS but it is not yet "installed". I've used import geojson and it says No module named geojson So my...

R Converting contour lines to elevation plot

r,gis,rgdal,maptools,sp
I would like to be able to create an elevation plot from contour lines in R. I am very new to using shape files At the moment I have downloaded data from here which provides .shp files for all of the UK. It also provides the contour lines, summarising the...

How to draw graphics on Google Map from Web Mercator Meters/Feet

javascript,google-maps,gis,geography,cartography
I used to draw graphics on Google Map from decimal degrees (latlng), but recently I found a server that only provide Web Mercator meters (or feet perhaps). Then I found the function to draw decimal degrees does not apply to Web Mercator meters: //this works well var marker = new...

Add lat/long or URM coordinates to shapefiles in R

r,gis,rgdal,maptools
I am new to GIS in R, and I'm attempting to add either lat/long or UTM coordinates to a shapefile. I downloaded the boundaries of the city of Chicago (City_Boundaries.shp)from here: http://www.cityofchicago.org/city/en/depts/doit/supp_info/gis_data.html I loaded the maptools and rgeos libraries: library(maptools) library(rgeos) library(rgdal) I brought the data into R & attempted...

how to get coordinates from SpatialPolygon

r,gis,sp
i'm getting a polygon from the drawpoly using: x<- ogrListLayers(file_map) shape=readOGR(file_map, layer=x) #will load the shapefile to your dataset. plot(shape) polygon<- drawPoly() but, I'm trying to get the coordinates from polygon, but i can't: [email protected] [[1]] An object of class "Polygons" Slot "Polygons": [[1]] An object of class "Polygon" Slot...

Binning longitude/latitude labeled data by census block ID

r,ggplot2,gis,ggmap,binning
I have two data sets, one for crime in Chicago, labeled with longitude and latitude coords and a shapefile of census blocks also in Chicago. Is it possible in R to aggregate crimes within census blocks, given these two files? The purpose is to be able to map out the...

Open Layers 3 - Convert Lat Long to Point

javascript,ruby-on-rails,gis,openlayers-3
I have an array of Lat Longs in an array called lat_longs (which looks like this - [[39.749318, -104.9701129], [..], [..]]), I'm trying to plot them in an OpenStreetMap using Open Layers 3. Here is the code I have - var icon_features = []; $.each(lat_longs, function(index, item){ var point =...

How can I add labels to a choropleth map created using ggplot2?

r,ggplot2,gis
I am attempting and currently failing to add text annotations to a choropleth map I created in ggplot2. I am seeking to label each of the polygons (a local government area) with its name. Before I go on, I know that a similar questions have been asked both on SO...

Control pan and zoom animation duration in mapbox.js

mapping,gis,mapbox,mapbox-gl-js
I'm making an animated map showing a series of points using Mapbox.js. Ideally, I want to smoothly switch focus between points by combining zoom and pan like this example created in d3.js. I wonder if there is anyway to control the pan & zoom animation speed (mainly to slow it...

MapBox ESRI Data Layer

json,gis,spatial,mapbox,esri
I have a mapbox, and want to display a layer of esri data onto it. The data I'm getting is being pulled in from this json file: https://gis.usps.com/arcgis/rest/services/EDDM/selectZIP/GPServer/routes/execute?f=json&env%3AoutSR=102100&ZIP=93003&Rte_Box=R&UserName=EDDM The data['results'][0]['value']['features'] array looks something like this: [{'attributes': {'key':'value'}},{'geometry':{'paths':[[-13273770,4064608],[-13273762,4064613],....]}}, {'attributes':...

Area measurement not showing correct measurements

javascript,gis,openlayers-3
I am trying to get the area of polygons drawn. But the area's I am getting is roughly 50% larger than they should be. draw.on('drawend', funciton(e){ var geom = e.feature.getGeometry(); if(drawType === 'Polygon'){ var rawArea = geom.getArea(); var cleanArea = rawArea / 10000; // Convert to hectares } }); Some...

How can I clip large shapefiles in program R without the computer crashing?

r,gis,ram,raster,shapefile
I am wanting to clip a large shapefile (67MB) in program R and derive a much smaller raster from around ~5% of it. Once loaded the shapefile has 221388 features and 5 fields - and explodes to 746 MB. My difficulty comes when trying to clip the file to a...

Marker or overlay moving animation moving smoothly in openlayers 3

javascript,gis,openlayers-3
I created a plunkr which has a moving marker like a car. var olview = new ol.View({ center: [-5484111.13, -1884437.22], zoom: 18, minZoom: 2, maxZoom: 20 }); var osm = new ol.source.OSM(); var lineString = new ol.geom.LineString([]); var map = new ol.Map({ target: 'map', view: olview, renderer: 'canvas', layers: [...

GeoJSON Not Working with Highmaps

json,highcharts,gis,geojson,highmaps
I am trying to use a custom GeoJSON file (Massachusetts counties) to display random data values using HighMaps. Here is the jfiddle of what I have done so far, but is not working... $(function () { // Prepare random data var data = [ { "COUNTY": "SUFFOLK", "value": 25 },...

GeoTools wms module error

gis,geotools,wms
I'm using GeoTools(12.2) Wms module for getting some wms information. When I was testing my app for different wms servers, encountered a problem. Wms server url : http://wms.geonorge.no/skwms1/wms.stedsnavn_fag Capabilities url: http://wms.geonorge.no/skwms1/wms.stedsnavn_fag?service=wms&request=getcapabilities When I defined WebMapServer object like below wms = new WebMapServer(url); Got this error Error downloading location: http://dbriap004/cgi-bin/stedsnavn_fag?service=WMS&version=1.3.0&request=GetSchemaExtension There...

GeoTools WebMapServer GetMapRequest issue

java,gis,geotools
I'm using GeoTools 12.2 for developing java class library project. Firstly, I'm working on GeoTools WMS module with this guide. The point that I was failed is doing get map request so that I could get capabilities document and layers etc. My wms url http://sampleserver1.arcgisonline.com/ArcGIS/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer/WMSServer It contains 3 layers (States,Rivers,Cities)...

In leaflet, how to calculate the Pixel Distance between two LatLng object?

gis,leaflet,mapbox
There is a latlng distanceTo method: http://leafletjs.com/reference.html#latlng distanceTo( <LatLng> otherLatlng ) Number Returns the distance (in meters) to the given LatLng calculated using the Haversine formula. See description on wikipedia It calculates the distance (in meters) between two LatLng. However, sometimes I needs to know how many pixels are there...

Leaflet slider group by year

jquery-ui,dictionary,slider,gis,leaflet
I'm using leaflet slider - https://github.com/dwilhelm89/LeafletSlider - but I can't get the desired result, even if from the plugin description it seems it can do. I have a collection of features, geometry type is polygon, where I've inserted a property "time" as requested by the plugin. I've tried bot with...

Python Time Filter Not Working

python,time,filter,gis
I have a script I am using to produce GIS maps. The incidents being mapped are filtered by time of day using an "elif" statement to filter incident data: elif iHours == 8: if x == 0: stTime = "00:00:00" endTime = "23:59:59" elif x == 1: stTime = "07:00:00"...